@visactor/vchart 1.11.0-alpha.1 → 1.11.0-alpha.2

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 (222) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +1378 -1185
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/chart/stack.js +1 -2
  6. package/cjs/compile/grammar-item.js +2 -1
  7. package/cjs/component/index.d.ts +2 -2
  8. package/cjs/component/index.js.map +1 -1
  9. package/cjs/component/label/total-label.js +8 -5
  10. package/cjs/component/label/total-label.js.map +1 -1
  11. package/cjs/component/tooltip/constant.d.ts +3 -0
  12. package/cjs/component/tooltip/constant.js +6 -2
  13. package/cjs/component/tooltip/constant.js.map +1 -1
  14. package/cjs/component/tooltip/interface/common.d.ts +10 -5
  15. package/cjs/component/tooltip/interface/common.js.map +1 -1
  16. package/cjs/component/tooltip/interface/spec.d.ts +2 -2
  17. package/cjs/component/tooltip/interface/spec.js.map +1 -1
  18. package/cjs/component/tooltip/processor/base.d.ts +10 -5
  19. package/cjs/component/tooltip/processor/base.js +37 -5
  20. package/cjs/component/tooltip/processor/base.js.map +1 -1
  21. package/cjs/component/tooltip/processor/group-tooltip.d.ts +11 -0
  22. package/cjs/component/tooltip/processor/group-tooltip.js +63 -0
  23. package/cjs/component/tooltip/processor/group-tooltip.js.map +1 -0
  24. package/cjs/component/tooltip/processor/index.d.ts +1 -0
  25. package/cjs/component/tooltip/processor/index.js +2 -2
  26. package/cjs/component/tooltip/processor/index.js.map +1 -1
  27. package/cjs/component/tooltip/processor/interface.d.ts +4 -3
  28. package/cjs/component/tooltip/processor/interface.js.map +1 -1
  29. package/cjs/component/tooltip/processor/mark-tooltip.d.ts +2 -2
  30. package/cjs/component/tooltip/processor/mark-tooltip.js +2 -2
  31. package/cjs/component/tooltip/processor/mark-tooltip.js.map +1 -1
  32. package/cjs/component/tooltip/processor/util.d.ts +1 -1
  33. package/cjs/component/tooltip/tooltip.d.ts +3 -3
  34. package/cjs/component/tooltip/tooltip.js +37 -22
  35. package/cjs/component/tooltip/tooltip.js.map +1 -1
  36. package/cjs/component/tooltip/utils/common.js +3 -2
  37. package/cjs/component/tooltip/utils/common.js.map +1 -1
  38. package/cjs/{plugin/components/tooltip-handler → component/tooltip}/utils/compose.d.ts +2 -2
  39. package/cjs/component/tooltip/utils/compose.js +120 -0
  40. package/cjs/component/tooltip/utils/compose.js.map +1 -0
  41. package/cjs/component/tooltip/utils/get-spec.d.ts +5 -0
  42. package/cjs/component/tooltip/utils/get-spec.js +130 -0
  43. package/cjs/component/tooltip/utils/get-spec.js.map +1 -0
  44. package/cjs/component/tooltip/utils/get-value.d.ts +6 -0
  45. package/cjs/component/tooltip/utils/get-value.js +41 -0
  46. package/cjs/component/tooltip/utils/get-value.js.map +1 -0
  47. package/cjs/component/tooltip/utils/index.d.ts +3 -0
  48. package/cjs/component/tooltip/utils/index.js +3 -1
  49. package/cjs/component/tooltip/utils/index.js.map +1 -1
  50. package/cjs/core/index.d.ts +1 -1
  51. package/cjs/core/index.js +1 -1
  52. package/cjs/core/index.js.map +1 -1
  53. package/cjs/core/interface.d.ts +0 -1
  54. package/cjs/core/interface.js.map +1 -1
  55. package/cjs/core/vchart.js +1 -1
  56. package/cjs/core/vchart.js.map +1 -1
  57. package/cjs/model/tooltip-helper.d.ts +4 -2
  58. package/cjs/model/tooltip-helper.js +4 -2
  59. package/cjs/model/tooltip-helper.js.map +1 -1
  60. package/cjs/plugin/components/tooltip-handler/base.d.ts +4 -9
  61. package/cjs/plugin/components/tooltip-handler/base.js +19 -58
  62. package/cjs/plugin/components/tooltip-handler/base.js.map +1 -1
  63. package/cjs/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.d.ts +1 -2
  64. package/cjs/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.js +2 -2
  65. package/cjs/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.js.map +1 -1
  66. package/cjs/plugin/components/tooltip-handler/constants.d.ts +0 -3
  67. package/cjs/plugin/components/tooltip-handler/constants.js +3 -6
  68. package/cjs/plugin/components/tooltip-handler/constants.js.map +1 -1
  69. package/cjs/plugin/components/tooltip-handler/dom/dom-tooltip-handler.d.ts +1 -1
  70. package/cjs/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js +10 -9
  71. package/cjs/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js.map +1 -1
  72. package/cjs/plugin/components/tooltip-handler/utils/common.d.ts +1 -7
  73. package/cjs/plugin/components/tooltip-handler/utils/common.js +4 -39
  74. package/cjs/plugin/components/tooltip-handler/utils/common.js.map +1 -1
  75. package/cjs/plugin/components/tooltip-handler/utils/index.d.ts +0 -2
  76. package/cjs/plugin/components/tooltip-handler/utils/index.js +1 -2
  77. package/cjs/plugin/components/tooltip-handler/utils/index.js.map +1 -1
  78. package/cjs/series/area/area.js +4 -3
  79. package/cjs/series/area/area.js.map +1 -1
  80. package/cjs/series/bar/bar.js +3 -1
  81. package/cjs/series/bar/bar.js.map +1 -1
  82. package/cjs/series/base/base-series.d.ts +1 -0
  83. package/cjs/series/base/base-series.js +3 -0
  84. package/cjs/series/base/base-series.js.map +1 -1
  85. package/cjs/series/base/tooltip-helper.d.ts +1 -0
  86. package/cjs/series/base/tooltip-helper.js +67 -38
  87. package/cjs/series/base/tooltip-helper.js.map +1 -1
  88. package/cjs/series/index.d.ts +3 -5
  89. package/cjs/series/index.js +2 -16
  90. package/cjs/series/index.js.map +1 -1
  91. package/cjs/series/interface/series.d.ts +1 -0
  92. package/cjs/series/interface/series.js.map +1 -1
  93. package/cjs/series/line/line.js +4 -2
  94. package/cjs/series/line/line.js.map +1 -1
  95. package/cjs/series/progress/linear/tooltip-helper.js +9 -2
  96. package/cjs/series/progress/linear/tooltip-helper.js.map +1 -1
  97. package/cjs/series/radar/radar.js +4 -3
  98. package/cjs/series/radar/radar.js.map +1 -1
  99. package/cjs/series/range-area/tooltip-helper.js +40 -34
  100. package/cjs/series/range-area/tooltip-helper.js.map +1 -1
  101. package/cjs/series/sankey/tooltip-helper.js +46 -41
  102. package/cjs/series/sankey/tooltip-helper.js.map +1 -1
  103. package/cjs/typings/spec/chart.d.ts +0 -2
  104. package/cjs/typings/spec/chart.js.map +1 -1
  105. package/cjs/typings/tooltip/handler.d.ts +1 -1
  106. package/cjs/typings/tooltip/handler.js.map +1 -1
  107. package/cjs/typings/tooltip/tooltip.d.ts +4 -0
  108. package/cjs/typings/tooltip/tooltip.js.map +1 -1
  109. package/esm/chart/stack.js +1 -2
  110. package/esm/compile/grammar-item.js +2 -1
  111. package/esm/component/index.d.ts +2 -2
  112. package/esm/component/index.js.map +1 -1
  113. package/esm/component/label/total-label.js +8 -5
  114. package/esm/component/label/total-label.js.map +1 -1
  115. package/esm/component/tooltip/constant.d.ts +3 -0
  116. package/esm/component/tooltip/constant.js +7 -0
  117. package/esm/component/tooltip/constant.js.map +1 -1
  118. package/esm/component/tooltip/interface/common.d.ts +10 -5
  119. package/esm/component/tooltip/interface/common.js.map +1 -1
  120. package/esm/component/tooltip/interface/spec.d.ts +2 -2
  121. package/esm/component/tooltip/interface/spec.js.map +1 -1
  122. package/esm/component/tooltip/processor/base.d.ts +10 -5
  123. package/esm/component/tooltip/processor/base.js +42 -4
  124. package/esm/component/tooltip/processor/base.js.map +1 -1
  125. package/esm/component/tooltip/processor/group-tooltip.d.ts +11 -0
  126. package/esm/component/tooltip/processor/group-tooltip.js +57 -0
  127. package/esm/component/tooltip/processor/group-tooltip.js.map +1 -0
  128. package/esm/component/tooltip/processor/index.d.ts +1 -0
  129. package/esm/component/tooltip/processor/index.js +2 -0
  130. package/esm/component/tooltip/processor/index.js.map +1 -1
  131. package/esm/component/tooltip/processor/interface.d.ts +4 -3
  132. package/esm/component/tooltip/processor/interface.js.map +1 -1
  133. package/esm/component/tooltip/processor/mark-tooltip.d.ts +2 -2
  134. package/esm/component/tooltip/processor/mark-tooltip.js +2 -2
  135. package/esm/component/tooltip/processor/mark-tooltip.js.map +1 -1
  136. package/esm/component/tooltip/processor/util.d.ts +1 -1
  137. package/esm/component/tooltip/tooltip.d.ts +3 -3
  138. package/esm/component/tooltip/tooltip.js +33 -20
  139. package/esm/component/tooltip/tooltip.js.map +1 -1
  140. package/esm/component/tooltip/utils/common.js +3 -2
  141. package/esm/component/tooltip/utils/common.js.map +1 -1
  142. package/esm/{plugin/components/tooltip-handler → component/tooltip}/utils/compose.d.ts +2 -2
  143. package/esm/{plugin/components/tooltip-handler → component/tooltip}/utils/compose.js +39 -26
  144. package/esm/component/tooltip/utils/compose.js.map +1 -0
  145. package/esm/component/tooltip/utils/get-spec.d.ts +5 -0
  146. package/esm/component/tooltip/utils/get-spec.js +125 -0
  147. package/esm/component/tooltip/utils/get-spec.js.map +1 -0
  148. package/esm/component/tooltip/utils/get-value.d.ts +6 -0
  149. package/esm/component/tooltip/utils/get-value.js +32 -0
  150. package/esm/component/tooltip/utils/get-value.js.map +1 -0
  151. package/esm/component/tooltip/utils/index.d.ts +3 -0
  152. package/esm/component/tooltip/utils/index.js +6 -0
  153. package/esm/component/tooltip/utils/index.js.map +1 -1
  154. package/esm/core/index.d.ts +1 -1
  155. package/esm/core/index.js +1 -1
  156. package/esm/core/index.js.map +1 -1
  157. package/esm/core/interface.d.ts +0 -1
  158. package/esm/core/interface.js.map +1 -1
  159. package/esm/core/vchart.js +1 -1
  160. package/esm/core/vchart.js.map +1 -1
  161. package/esm/model/tooltip-helper.d.ts +4 -2
  162. package/esm/model/tooltip-helper.js +4 -2
  163. package/esm/model/tooltip-helper.js.map +1 -1
  164. package/esm/plugin/components/tooltip-handler/base.d.ts +4 -9
  165. package/esm/plugin/components/tooltip-handler/base.js +19 -58
  166. package/esm/plugin/components/tooltip-handler/base.js.map +1 -1
  167. package/esm/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.d.ts +1 -2
  168. package/esm/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.js +2 -2
  169. package/esm/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.js.map +1 -1
  170. package/esm/plugin/components/tooltip-handler/constants.d.ts +0 -3
  171. package/esm/plugin/components/tooltip-handler/constants.js +0 -7
  172. package/esm/plugin/components/tooltip-handler/constants.js.map +1 -1
  173. package/esm/plugin/components/tooltip-handler/dom/dom-tooltip-handler.d.ts +1 -1
  174. package/esm/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js +10 -9
  175. package/esm/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js.map +1 -1
  176. package/esm/plugin/components/tooltip-handler/utils/common.d.ts +1 -7
  177. package/esm/plugin/components/tooltip-handler/utils/common.js +1 -31
  178. package/esm/plugin/components/tooltip-handler/utils/common.js.map +1 -1
  179. package/esm/plugin/components/tooltip-handler/utils/index.d.ts +0 -2
  180. package/esm/plugin/components/tooltip-handler/utils/index.js +0 -4
  181. package/esm/plugin/components/tooltip-handler/utils/index.js.map +1 -1
  182. package/esm/series/area/area.js +4 -3
  183. package/esm/series/area/area.js.map +1 -1
  184. package/esm/series/bar/bar.js +3 -1
  185. package/esm/series/bar/bar.js.map +1 -1
  186. package/esm/series/base/base-series.d.ts +1 -0
  187. package/esm/series/base/base-series.js +3 -0
  188. package/esm/series/base/base-series.js.map +1 -1
  189. package/esm/series/base/tooltip-helper.d.ts +1 -0
  190. package/esm/series/base/tooltip-helper.js +67 -38
  191. package/esm/series/base/tooltip-helper.js.map +1 -1
  192. package/esm/series/index.d.ts +3 -5
  193. package/esm/series/index.js +2 -4
  194. package/esm/series/index.js.map +1 -1
  195. package/esm/series/interface/series.d.ts +1 -0
  196. package/esm/series/interface/series.js.map +1 -1
  197. package/esm/series/line/line.js +4 -2
  198. package/esm/series/line/line.js.map +1 -1
  199. package/esm/series/progress/linear/tooltip-helper.js +9 -2
  200. package/esm/series/progress/linear/tooltip-helper.js.map +1 -1
  201. package/esm/series/radar/radar.js +4 -3
  202. package/esm/series/radar/radar.js.map +1 -1
  203. package/esm/series/range-area/tooltip-helper.js +40 -34
  204. package/esm/series/range-area/tooltip-helper.js.map +1 -1
  205. package/esm/series/sankey/tooltip-helper.js +46 -41
  206. package/esm/series/sankey/tooltip-helper.js.map +1 -1
  207. package/esm/typings/spec/chart.d.ts +0 -2
  208. package/esm/typings/spec/chart.js.map +1 -1
  209. package/esm/typings/tooltip/handler.d.ts +1 -1
  210. package/esm/typings/tooltip/handler.js.map +1 -1
  211. package/esm/typings/tooltip/tooltip.d.ts +4 -0
  212. package/esm/typings/tooltip/tooltip.js.map +1 -1
  213. package/package.json +2 -2
  214. package/cjs/plugin/components/tooltip-handler/utils/compose.js +0 -107
  215. package/cjs/plugin/components/tooltip-handler/utils/compose.js.map +0 -1
  216. package/cjs/plugin/components/tooltip-handler/utils/get-spec.d.ts +0 -5
  217. package/cjs/plugin/components/tooltip-handler/utils/get-spec.js +0 -106
  218. package/cjs/plugin/components/tooltip-handler/utils/get-spec.js.map +0 -1
  219. package/esm/plugin/components/tooltip-handler/utils/compose.js.map +0 -1
  220. package/esm/plugin/components/tooltip-handler/utils/get-spec.d.ts +0 -5
  221. package/esm/plugin/components/tooltip-handler/utils/get-spec.js +0 -101
  222. package/esm/plugin/components/tooltip-handler/utils/get-spec.js.map +0 -1
package/build/index.js CHANGED
@@ -59541,8 +59541,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
59541
59541
  this._chartPluginApply('releaseAll');
59542
59542
  this._chartPlugin = null;
59543
59543
  this._chartSpecTransformer = null;
59544
- (_b = this._eventDispatcher) === null || _b === void 0 ? void 0 : _b.release();
59545
- (_c = this._chart) === null || _c === void 0 ? void 0 : _c.release();
59544
+ (_b = this._chart) === null || _b === void 0 ? void 0 : _b.release();
59545
+ (_c = this._eventDispatcher) === null || _c === void 0 ? void 0 : _c.release();
59546
59546
  (_d = this._compiler) === null || _d === void 0 ? void 0 : _d.release();
59547
59547
  this._unBindResizeEvent();
59548
59548
  this._releaseData();
@@ -61103,20 +61103,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
61103
61103
  AxisSyncPlugin.pluginType = 'component';
61104
61104
  AxisSyncPlugin.type = 'AxisSyncPlugin';
61105
61105
 
61106
- function getComponentThemeFromOption(type, chartTheme) {
61107
- return get$1(chartTheme, `component.${type}`);
61108
- }
61109
- function getFormatFunction(formatMethod, formatter, text, datum) {
61110
- if (formatMethod) {
61111
- return { formatFunc: formatMethod, args: [text, datum] };
61112
- }
61113
- const formatterImpl = Factory.getFormatter();
61114
- if (formatter && formatterImpl) {
61115
- return { formatFunc: formatterImpl, args: [text, datum, formatter] };
61116
- }
61117
- return {};
61118
- }
61119
-
61120
61106
  function escapeHTML(value) {
61121
61107
  return String(value)
61122
61108
  .replace(/&/g, '&')
@@ -61125,61 +61111,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
61125
61111
  .replace(/\(/g, '(')
61126
61112
  .replace(/ /g, '  ');
61127
61113
  }
61128
- const getTooltipContentValue = (field, datum, params, formatter) => {
61129
- let value;
61130
- if (isFunction$1(field)) {
61131
- value = field(datum, params);
61132
- }
61133
- else {
61134
- value = field;
61135
- }
61136
- if (formatter) {
61137
- const { formatFunc, args } = getFormatFunction(undefined, formatter, field, datum);
61138
- if (formatFunc && args) {
61139
- value = formatFunc(...args);
61140
- }
61141
- }
61142
- return value;
61143
- };
61144
- const getTooltipPatternValue = (field, data, params) => {
61145
- if (isNil$3(field)) {
61146
- return field;
61147
- }
61148
- if (isFunction$1(field)) {
61149
- return field(data, params);
61150
- }
61151
- return field;
61152
- };
61153
- const getTooltipContentPattern = (field, data, params) => {
61154
- if (isNil$3(field)) {
61155
- return field;
61156
- }
61157
- let result = [];
61158
- array(field).forEach(patternItem => {
61159
- if (isFunction$1(patternItem)) {
61160
- result = result.concat(array(patternItem(data, params)));
61161
- }
61162
- else {
61163
- result.push(patternItem);
61164
- }
61165
- });
61166
- return result;
61167
- };
61168
- function getFirstDatumFromTooltipData(data) {
61169
- var _a;
61170
- const dimInfoList = ((_a = data[0]) === null || _a === void 0 ? void 0 : _a.series)
61171
- ? [{ data: data, value: '' }]
61172
- : data;
61173
- for (const { data: dataList } of dimInfoList) {
61174
- for (const { datum: datumList } of dataList) {
61175
- for (const datumItem of datumList !== null && datumList !== void 0 ? datumList : []) {
61176
- if (datumItem) {
61177
- return datumItem;
61178
- }
61179
- }
61180
- }
61181
- }
61182
- }
61183
61114
  const getScale = (element, boundingClientRect) => {
61184
61115
  if (!element) {
61185
61116
  return 1;
@@ -61226,18 +61157,27 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
61226
61157
  };
61227
61158
 
61228
61159
  const TOOLTIP_CONTAINER_EL_CLASS_NAME = 'vchart-tooltip-container';
61229
- const TOOLTIP_MAX_LINE_COUNT = 20;
61230
61160
  const TOOLTIP_EMPTY_STRING = '';
61231
- const TOOLTIP_OTHERS_LINE = {
61232
- key: '其他',
61233
- value: '...'
61234
- };
61235
61161
  const DEFAULT_OPTIONS = {
61236
61162
  offsetX: 10,
61237
61163
  offsetY: 10,
61238
61164
  sanitize: escapeHTML
61239
61165
  };
61240
61166
 
61167
+ function getComponentThemeFromOption(type, chartTheme) {
61168
+ return get$1(chartTheme, `component.${type}`);
61169
+ }
61170
+ function getFormatFunction(formatMethod, formatter, text, datum) {
61171
+ if (formatMethod) {
61172
+ return { formatFunc: formatMethod, args: [text, datum] };
61173
+ }
61174
+ const formatterImpl = Factory.getFormatter();
61175
+ if (formatter && formatterImpl) {
61176
+ return { formatFunc: formatterImpl, args: [text, datum, formatter] };
61177
+ }
61178
+ return {};
61179
+ }
61180
+
61241
61181
  const DEFAULT_TITLE_STYLE = {
61242
61182
  left: {
61243
61183
  textAlign: 'center',
@@ -61774,6 +61714,218 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
61774
61714
  (isValid$3(obj.x) || isValid$3(obj.y)));
61775
61715
  };
61776
61716
 
61717
+ const DEFAULT_TEXT_ATTRIBUTES = {
61718
+ fontFamily: token.fontFamily,
61719
+ spacing: 10,
61720
+ wordBreak: 'break-word'
61721
+ };
61722
+ function getTextAttributes(style = {}, globalTheme, defaultAttributes) {
61723
+ var _a, _b;
61724
+ const attrs = Object.assign(Object.assign({}, (defaultAttributes !== null && defaultAttributes !== void 0 ? defaultAttributes : DEFAULT_TEXT_ATTRIBUTES)), { fill: ((_a = style.fill) !== null && _a !== void 0 ? _a : style.fontColor), textAlign: style.textAlign, textBaseline: style.textBaseline, fontFamily: (_b = style.fontFamily) !== null && _b !== void 0 ? _b : globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.fontFamily, fontSize: style.fontSize, fontWeight: style.fontWeight, lineHeight: style.lineHeight, spacing: style.spacing, multiLine: style.multiLine, maxWidth: style.maxWidth, wordBreak: style.wordBreak, autoWidth: style.autoWidth });
61725
+ return attrs;
61726
+ }
61727
+ const getPanelAttributes = (style) => {
61728
+ var _a;
61729
+ const { backgroundColor, border, shadow } = style;
61730
+ const panelAttrs = {
61731
+ lineWidth: (_a = border === null || border === void 0 ? void 0 : border.width) !== null && _a !== void 0 ? _a : 0,
61732
+ shadow: !!shadow
61733
+ };
61734
+ if (border === null || border === void 0 ? void 0 : border.color) {
61735
+ panelAttrs.stroke = border.color;
61736
+ }
61737
+ if (backgroundColor) {
61738
+ panelAttrs.fill = backgroundColor;
61739
+ }
61740
+ if (shadow) {
61741
+ panelAttrs.shadowColor = shadow.color;
61742
+ panelAttrs.shadowBlur = shadow.blur;
61743
+ panelAttrs.shadowOffsetX = shadow.x;
61744
+ panelAttrs.shadowOffsetY = shadow.y;
61745
+ panelAttrs.shadowSpread = shadow.spread;
61746
+ }
61747
+ const { radius } = border !== null && border !== void 0 ? border : {};
61748
+ if (isValid$3(radius)) {
61749
+ panelAttrs.cornerRadius = [radius, radius, radius, radius];
61750
+ }
61751
+ return panelAttrs;
61752
+ };
61753
+ const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
61754
+ var _a, _b, _c, _d, _e;
61755
+ const { style = {}, enterable, transitionDuration } = spec;
61756
+ const { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, maxContentHeight } = style;
61757
+ const padding = normalizePadding$1(panel.padding);
61758
+ const paddingSpec = normalizeLayoutPaddingSpec(panel.padding);
61759
+ const titleStyle = getTextAttributes(titleLabel, globalTheme);
61760
+ const keyStyle = getTextAttributes(keyLabel, globalTheme);
61761
+ const valueStyle = getTextAttributes(valueLabel, globalTheme);
61762
+ const shapeStyle = {
61763
+ fill: true,
61764
+ size: (_a = shape === null || shape === void 0 ? void 0 : shape.size) !== null && _a !== void 0 ? _a : 8,
61765
+ spacing: (_b = shape === null || shape === void 0 ? void 0 : shape.spacing) !== null && _b !== void 0 ? _b : 6
61766
+ };
61767
+ const attributes = {
61768
+ panel: getPanelAttributes(panel),
61769
+ padding,
61770
+ title: {},
61771
+ content: [],
61772
+ titleStyle: {
61773
+ value: titleStyle,
61774
+ spaceRow: commonSpaceRow
61775
+ },
61776
+ contentStyle: {
61777
+ shape: shapeStyle,
61778
+ key: keyStyle,
61779
+ value: valueStyle,
61780
+ spaceRow: commonSpaceRow
61781
+ },
61782
+ hasContentShape: false,
61783
+ keyWidth: 0,
61784
+ valueWidth: 0,
61785
+ maxContentHeight,
61786
+ enterable,
61787
+ transitionDuration
61788
+ };
61789
+ const { title = {}, content = [] } = actualTooltip;
61790
+ let panelWidth = paddingSpec.left + paddingSpec.right;
61791
+ let panelHeight = paddingSpec.top + paddingSpec.bottom;
61792
+ let panelDomHeight = paddingSpec.top + paddingSpec.bottom;
61793
+ let contentMaxWidth = 0;
61794
+ const filteredContent = content.filter(item => {
61795
+ return (item.key || item.value) && item.visible !== false;
61796
+ });
61797
+ const hasContent = !!filteredContent.length;
61798
+ let maxKeyWidth = 0;
61799
+ let maxAdaptiveKeyWidth = 0;
61800
+ let maxValueWidth = 0;
61801
+ let maxShapeWidth = 0;
61802
+ if (hasContent) {
61803
+ const keyWidths = [];
61804
+ const adaptiveKeyWidths = [];
61805
+ const valueWidths = [];
61806
+ const shapeWidths = [];
61807
+ let contentHeight = 0;
61808
+ attributes.content = filteredContent.map((item, i) => {
61809
+ let itemHeight = 0;
61810
+ const { hasShape: actualHasShape, key: actualKey, shapeType: actualShapeType = '', shapeFill: actualShapeFill, shapeStroke: actualShapeStroke, shapeLineWidth: actualShapeLineWidth, shapeSize: actualShapeSize, value: actualValue, isKeyAdaptive: actualIsKeyAdaptive, spaceRow: actualSpaceRow, keyStyle: actualKeyStyle, valueStyle: actualValueStyle, shapeHollow: actualShapeHollow, shapeColor: actualShapeColor } = item;
61811
+ const itemAttrs = { height: 0, spaceRow: actualSpaceRow !== null && actualSpaceRow !== void 0 ? actualSpaceRow : commonSpaceRow };
61812
+ if (isValid$3(actualKey)) {
61813
+ const itemKeyStyle = mergeSpec({}, keyStyle, getTextAttributes(actualKeyStyle, undefined, {}));
61814
+ const { width, height, text } = measureTooltipText(actualKey, itemKeyStyle);
61815
+ itemAttrs.key = Object.assign(Object.assign({ width,
61816
+ height }, itemKeyStyle), { text });
61817
+ if (!actualIsKeyAdaptive) {
61818
+ keyWidths.push(width);
61819
+ }
61820
+ else {
61821
+ adaptiveKeyWidths.push(width);
61822
+ }
61823
+ itemHeight = Math.max(itemHeight, height);
61824
+ }
61825
+ if (isValid$3(actualValue)) {
61826
+ const itemValueStyle = mergeSpec({}, valueStyle, getTextAttributes(actualValueStyle, undefined, {}));
61827
+ const { width, height, text } = measureTooltipText(actualValue, itemValueStyle);
61828
+ itemAttrs.value = Object.assign(Object.assign({ width,
61829
+ height }, itemValueStyle), { text });
61830
+ valueWidths.push(width);
61831
+ itemHeight = Math.max(itemHeight, height);
61832
+ }
61833
+ if (actualHasShape) {
61834
+ const shape = {
61835
+ visible: true,
61836
+ symbolType: actualShapeType
61837
+ };
61838
+ const adaptiveShapeFill = actualShapeFill !== null && actualShapeFill !== void 0 ? actualShapeFill : actualShapeColor;
61839
+ if (actualShapeHollow) {
61840
+ shape.stroke = adaptiveShapeFill;
61841
+ }
61842
+ else {
61843
+ shape.fill = adaptiveShapeFill;
61844
+ }
61845
+ shape.stroke = actualShapeStroke !== null && actualShapeStroke !== void 0 ? actualShapeStroke : adaptiveShapeFill;
61846
+ shape.lineWidth = actualShapeLineWidth;
61847
+ itemAttrs.shape = shape;
61848
+ const shapeWidth = actualShapeSize !== null && actualShapeSize !== void 0 ? actualShapeSize : shapeStyle.size;
61849
+ itemHeight = Math.max(shapeWidth, itemHeight);
61850
+ shapeWidths.push(shapeWidth);
61851
+ }
61852
+ else {
61853
+ itemAttrs.shape = { visible: false };
61854
+ }
61855
+ itemAttrs.height = itemHeight;
61856
+ contentHeight += itemHeight;
61857
+ if (i < filteredContent.length - 1) {
61858
+ contentHeight += itemAttrs.spaceRow;
61859
+ }
61860
+ return itemAttrs;
61861
+ });
61862
+ panelHeight += contentHeight;
61863
+ panelDomHeight += Math.min(contentHeight, maxContentHeight !== null && maxContentHeight !== void 0 ? maxContentHeight : Infinity);
61864
+ maxKeyWidth = keyWidths.length ? maxInArray(keyWidths) : 0;
61865
+ maxAdaptiveKeyWidth = adaptiveKeyWidths.length ? maxInArray(adaptiveKeyWidths) : 0;
61866
+ maxValueWidth = valueWidths.length ? maxInArray(valueWidths) : 0;
61867
+ maxShapeWidth = shapeWidths.length ? maxInArray(shapeWidths) + shapeStyle.spacing : 0;
61868
+ contentMaxWidth = Math.max(maxShapeWidth + maxKeyWidth + keyStyle.spacing + maxValueWidth + valueStyle.spacing, maxShapeWidth + maxAdaptiveKeyWidth, contentMaxWidth);
61869
+ attributes.hasContentShape = !!shapeWidths.length;
61870
+ attributes.keyWidth = maxKeyWidth;
61871
+ attributes.valueWidth = maxValueWidth;
61872
+ }
61873
+ let titleMaxWidth = 0;
61874
+ let titleMaxHeight = 0;
61875
+ let titleHeightWithSpace = 0;
61876
+ const { visible: actualTitleVisible = true, value: actualTitleValue = '', valueStyle: actualTitleValueStyle, spaceRow: actualTitleSpaceRow } = title;
61877
+ attributes.title.visible = actualTitleVisible;
61878
+ attributes.title.spaceRow = actualTitleSpaceRow !== null && actualTitleSpaceRow !== void 0 ? actualTitleSpaceRow : commonSpaceRow;
61879
+ let titleValueStyle = {};
61880
+ const isAutoWidthMode = () => titleValueStyle.autoWidth && titleValueStyle.multiLine !== false;
61881
+ if (actualTitleVisible) {
61882
+ titleValueStyle = mergeSpec({}, titleStyle, getTextAttributes(actualTitleValueStyle, undefined, {}));
61883
+ if (isAutoWidthMode()) {
61884
+ titleValueStyle.multiLine = (_c = titleValueStyle.multiLine) !== null && _c !== void 0 ? _c : true;
61885
+ titleValueStyle.maxWidth = (_d = titleValueStyle.maxWidth) !== null && _d !== void 0 ? _d : (hasContent ? Math.ceil(contentMaxWidth) : undefined);
61886
+ }
61887
+ const { text, width, height } = measureTooltipText(actualTitleValue, titleValueStyle);
61888
+ attributes.title.value = Object.assign(Object.assign({ width: isAutoWidthMode() ? Math.min(width, (_e = titleValueStyle.maxWidth) !== null && _e !== void 0 ? _e : Number.MAX_VALUE) : width, height }, titleValueStyle), { text });
61889
+ titleMaxWidth = attributes.title.value.width;
61890
+ titleMaxHeight = attributes.title.value.height;
61891
+ titleHeightWithSpace = titleMaxHeight + (hasContent ? attributes.title.spaceRow : 0);
61892
+ }
61893
+ panelHeight += titleHeightWithSpace;
61894
+ panelDomHeight += titleHeightWithSpace;
61895
+ attributes.title.width = titleMaxWidth;
61896
+ attributes.title.height = titleMaxHeight;
61897
+ if (isAutoWidthMode()) {
61898
+ panelWidth += contentMaxWidth ? contentMaxWidth : titleMaxWidth;
61899
+ }
61900
+ else {
61901
+ panelWidth += Math.max(titleMaxWidth, contentMaxWidth);
61902
+ }
61903
+ if (hasContent) {
61904
+ attributes.content.forEach(item => {
61905
+ var _a;
61906
+ const value = item.value;
61907
+ if (value && ((_a = value.autoWidth) !== null && _a !== void 0 ? _a : true)) {
61908
+ value.width =
61909
+ panelWidth -
61910
+ paddingSpec.left -
61911
+ paddingSpec.right -
61912
+ maxShapeWidth -
61913
+ maxKeyWidth -
61914
+ keyStyle.spacing -
61915
+ valueStyle.spacing;
61916
+ if (!value.maxWidth) {
61917
+ value.maxWidth = Math.ceil(value.width);
61918
+ }
61919
+ attributes.valueWidth = Math.max(attributes.valueWidth, value.width);
61920
+ }
61921
+ });
61922
+ }
61923
+ attributes.panel.width = panelWidth;
61924
+ attributes.panel.height = panelHeight;
61925
+ attributes.panelDomHeight = panelDomHeight;
61926
+ return attributes;
61927
+ };
61928
+
61777
61929
  const getDataArrayFromFieldArray = (fields, datum) => isValid$3(datum) ? fields.map(f => datum[f]) : undefined;
61778
61930
  const datumContainsArray = (fields, data) => (datum) => fields.every((key, i) => datum[key] === (data === null || data === void 0 ? void 0 : data[i]));
61779
61931
  const hasData = (data) => {
@@ -62116,13 +62268,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62116
62268
  }
62117
62269
 
62118
62270
  const getTooltipActualActiveType = (spec) => {
62119
- var _a, _b;
62271
+ var _a, _b, _c;
62120
62272
  if ((spec === null || spec === void 0 ? void 0 : spec.visible) === false) {
62121
62273
  return [];
62122
62274
  }
62123
62275
  const activeTypeMap = {
62124
62276
  mark: ((_a = spec === null || spec === void 0 ? void 0 : spec.mark) === null || _a === void 0 ? void 0 : _a.visible) !== false,
62125
- dimension: ((_b = spec === null || spec === void 0 ? void 0 : spec.dimension) === null || _b === void 0 ? void 0 : _b.visible) !== false
62277
+ dimension: ((_b = spec === null || spec === void 0 ? void 0 : spec.dimension) === null || _b === void 0 ? void 0 : _b.visible) !== false,
62278
+ group: ((_c = spec === null || spec === void 0 ? void 0 : spec.group) === null || _c === void 0 ? void 0 : _c.visible) !== false
62126
62279
  };
62127
62280
  if (isValid$3(spec === null || spec === void 0 ? void 0 : spec.activeType)) {
62128
62281
  Object.keys(activeTypeMap).forEach(t => {
@@ -62136,150 +62289,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62136
62289
  return isNil$3(params.mark) && isNil$3(params.model) && isNil$3(params.datum);
62137
62290
  }
62138
62291
 
62139
- const getTimeString = (value, timeFormat, timeFormatMode) => {
62140
- if (!timeFormat && !timeFormatMode) {
62141
- if (typeof value !== 'object') {
62142
- return value === null || value === void 0 ? void 0 : value.toString();
62143
- }
62144
- return value;
62145
- }
62146
- const timeUtil = TimeUtil.getInstance();
62147
- timeFormat = timeFormat || '%Y%m%d';
62148
- timeFormatMode = timeFormatMode || 'local';
62149
- const timeFormatter = timeFormatMode === 'local' ? timeUtil.timeFormat : timeUtil.timeUTCFormat;
62150
- return timeFormatter(timeFormat, value);
62151
- };
62152
- const getShowContent = (pattern, data, params) => {
62153
- var _a, _b, _c, _d;
62154
- if (!data ||
62155
- ((_a = params === null || params === void 0 ? void 0 : params.event) === null || _a === void 0 ? void 0 : _a.type) === 'mouseout') {
62156
- return null;
62157
- }
62158
- const tooltipActualTitleContent = {
62159
- title: {},
62160
- content: []
62161
- };
62162
- const patternTitle = getTooltipPatternValue(pattern.title, data, params);
62163
- const { visible, value, valueTimeFormat, valueTimeFormatMode, valueStyle, hasShape, valueFormatter } = patternTitle !== null && patternTitle !== void 0 ? patternTitle : {};
62164
- const patternTitleVisible = getTooltipContentValue(visible, data, params) !== false;
62165
- if (!patternTitle || !patternTitleVisible) {
62166
- tooltipActualTitleContent.title = {
62167
- hasShape: false,
62168
- visible: false
62169
- };
62170
- }
62171
- else {
62172
- const datum = getFirstDatumFromTooltipData(data);
62173
- tooltipActualTitleContent.title = {
62174
- value: getTimeString(getTooltipContentValue(value, datum, params, valueFormatter), valueTimeFormat, valueTimeFormatMode),
62175
- valueStyle: getTooltipContentValue(valueStyle, datum, params),
62176
- hasShape
62177
- };
62178
- }
62179
- const patternContent = getTooltipContentPattern(pattern.content, data, params);
62180
- const { maxLineCount = TOOLTIP_MAX_LINE_COUNT } = pattern;
62181
- if (pattern.activeType === 'mark') {
62182
- for (const content of patternContent !== null && patternContent !== void 0 ? patternContent : []) {
62183
- const oneLineData = getOneLineData((_b = data[0]) === null || _b === void 0 ? void 0 : _b.datum[0], content, params);
62184
- if (oneLineData.visible !== false) {
62185
- if (tooltipActualTitleContent.content.length === maxLineCount - 1) {
62186
- tooltipActualTitleContent.content.push(Object.assign(Object.assign({}, oneLineData), TOOLTIP_OTHERS_LINE));
62187
- break;
62188
- }
62189
- else if (tooltipActualTitleContent.content.length < maxLineCount) {
62190
- tooltipActualTitleContent.content.push(oneLineData);
62191
- }
62192
- else {
62193
- break;
62194
- }
62195
- }
62196
- }
62197
- }
62198
- else if (pattern.activeType === 'dimension') {
62199
- for (const { data: d } of data) {
62200
- for (const { datum, series } of d) {
62201
- if (!getTooltipActualActiveType((_c = series.tooltipHelper) === null || _c === void 0 ? void 0 : _c.spec).includes('dimension')) {
62202
- continue;
62203
- }
62204
- const contentPatterns = (_d = patternContent === null || patternContent === void 0 ? void 0 : patternContent.filter(c => isNil$3(c.seriesId) || c.seriesId === series.id)) !== null && _d !== void 0 ? _d : [];
62205
- for (const datumItem of datum) {
62206
- for (const linePattern of contentPatterns) {
62207
- const oneLineData = getOneLineData(datumItem, linePattern, params);
62208
- if (oneLineData.visible === false) {
62209
- continue;
62210
- }
62211
- if (tooltipActualTitleContent.content.length === maxLineCount - 1) {
62212
- tooltipActualTitleContent.content.push(Object.assign(Object.assign({}, oneLineData), TOOLTIP_OTHERS_LINE));
62213
- break;
62214
- }
62215
- else if (tooltipActualTitleContent.content.length < maxLineCount) {
62216
- tooltipActualTitleContent.content.push(oneLineData);
62217
- }
62218
- else {
62219
- break;
62220
- }
62221
- }
62222
- if (tooltipActualTitleContent.content.length >= maxLineCount) {
62223
- break;
62224
- }
62225
- }
62226
- if (tooltipActualTitleContent.content.length >= maxLineCount) {
62227
- break;
62228
- }
62229
- }
62230
- if (tooltipActualTitleContent.content.length >= maxLineCount) {
62231
- break;
62232
- }
62233
- }
62234
- }
62235
- if (tooltipActualTitleContent.title) {
62236
- if (tooltipActualTitleContent.content.length > 0 && tooltipActualTitleContent.content[0].shapeType) {
62237
- if (isNil$3(tooltipActualTitleContent.title.shapeType)) {
62238
- tooltipActualTitleContent.title.shapeType = tooltipActualTitleContent.content[0].shapeType;
62239
- }
62240
- if (isNil$3(tooltipActualTitleContent.title.shapeColor)) {
62241
- tooltipActualTitleContent.title.shapeColor = tooltipActualTitleContent.content[0].shapeColor;
62242
- }
62243
- }
62244
- else {
62245
- tooltipActualTitleContent.title.hasShape = false;
62246
- }
62247
- }
62248
- return tooltipActualTitleContent;
62249
- };
62250
- const getOneLineData = (datum, config, params) => {
62251
- const key = getTimeString(getTooltipContentValue(config.key, datum, params, config.keyFormatter), config.keyTimeFormat, config.keyTimeFormatMode);
62252
- const value = getTimeString(getTooltipContentValue(config.value, datum, params, config.valueFormatter), config.valueTimeFormat, config.valueTimeFormatMode);
62253
- const visible = getTooltipContentValue(config.visible, datum, params) !== false && (isValid$3(key) || isValid$3(value));
62254
- const isKeyAdaptive = getTooltipContentValue(config.isKeyAdaptive, datum, params);
62255
- const spaceRow = getTooltipContentValue(config.spaceRow, datum, params);
62256
- const shapeType = getTooltipContentValue(config.shapeType, datum, params);
62257
- const shapeColor = getTooltipContentValue(config.shapeColor, datum, params);
62258
- const shapeFill = getTooltipContentValue(config.shapeFill, datum, params);
62259
- const shapeStroke = getTooltipContentValue(config.shapeStroke, datum, params);
62260
- const shapeLineWidth = getTooltipContentValue(config.shapeLineWidth, datum, params);
62261
- const shapeHollow = getTooltipContentValue(config.shapeHollow, datum, params);
62262
- const keyStyle = getTooltipContentValue(config.keyStyle, datum, params);
62263
- const valueStyle = getTooltipContentValue(config.valueStyle, datum, params);
62264
- return {
62265
- key,
62266
- value,
62267
- visible,
62268
- isKeyAdaptive,
62269
- hasShape: config.hasShape,
62270
- shapeType,
62271
- shapeFill,
62272
- shapeStroke,
62273
- shapeLineWidth,
62274
- shapeHollow,
62275
- shapeColor,
62276
- keyStyle,
62277
- valueStyle,
62278
- spaceRow,
62279
- datum
62280
- };
62281
- };
62282
-
62283
62292
  const makeDefaultPattern = (series, activeType, dimensionInfo) => {
62284
62293
  var _a, _b;
62285
62294
  return (_b = (_a = series.tooltipHelper) === null || _a === void 0 ? void 0 : _a.getDefaultTooltipPattern(activeType, dimensionInfo)) !== null && _b !== void 0 ? _b : null;
@@ -62289,11 +62298,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62289
62298
  constructor() {
62290
62299
  this.activeTriggerSet = {
62291
62300
  mark: new Set(),
62292
- dimension: new Set()
62301
+ dimension: new Set(),
62302
+ group: new Set()
62293
62303
  };
62294
62304
  this.ignoreTriggerSet = {
62295
62305
  mark: new Set(),
62296
- dimension: new Set()
62306
+ dimension: new Set(),
62307
+ group: new Set()
62297
62308
  };
62298
62309
  }
62299
62310
  }
@@ -62321,6 +62332,17 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62321
62332
  const { measureFields } = this._seriesCacheInfo;
62322
62333
  return measureFields[0] && (datum === null || datum === void 0 ? void 0 : datum[measureFields[0]]);
62323
62334
  };
62335
+ this._getSeriesFieldData = (datum) => {
62336
+ const { dimensionFields, seriesFields } = this._seriesCacheInfo;
62337
+ if (isValid$3(seriesFields[0]) && (datum === null || datum === void 0 ? void 0 : datum[seriesFields[0]])) {
62338
+ return datum === null || datum === void 0 ? void 0 : datum[seriesFields[0]];
62339
+ }
62340
+ const subDimensionField = dimensionFields[dimensionFields.length - 1];
62341
+ if (dimensionFields.length > 1 && (seriesFields.length === 0 || this.series.getSeriesKeys().length <= 1)) {
62342
+ return datum === null || datum === void 0 ? void 0 : datum[subDimensionField];
62343
+ }
62344
+ return datum === null || datum === void 0 ? void 0 : datum[subDimensionField];
62345
+ };
62324
62346
  this._getSeriesStyle = (datum, styleKey, defaultValue) => {
62325
62347
  var _a;
62326
62348
  for (const key of array(styleKey)) {
@@ -62332,15 +62354,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62332
62354
  return defaultValue;
62333
62355
  };
62334
62356
  this.contentKeyCallback = (datum, params) => {
62335
- const { dimensionFields, seriesFields } = this._seriesCacheInfo;
62336
- const subDimensionField = dimensionFields[dimensionFields.length - 1];
62337
- if (isValid$3(seriesFields[0]) && (datum === null || datum === void 0 ? void 0 : datum[seriesFields[0]])) {
62338
- return datum === null || datum === void 0 ? void 0 : datum[seriesFields[0]];
62339
- }
62340
- if (dimensionFields.length > 1 && (seriesFields.length === 0 || this.series.getSeriesKeys().length <= 1)) {
62341
- return datum === null || datum === void 0 ? void 0 : datum[subDimensionField];
62342
- }
62343
- return datum === null || datum === void 0 ? void 0 : datum[subDimensionField];
62357
+ return this._getSeriesFieldData(datum);
62344
62358
  };
62345
62359
  this.contentValueCallback = (datum, params) => {
62346
62360
  return this._getMeasureData(datum);
@@ -62363,7 +62377,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62363
62377
  const seriesTooltipSpec = (_b = (_a = this.series.getSpec()) === null || _a === void 0 ? void 0 : _a.tooltip) !== null && _b !== void 0 ? _b : {};
62364
62378
  const chartTooltipSpec = (_d = (_c = this.series.getChart().getSpec()) === null || _c === void 0 ? void 0 : _c.tooltip) !== null && _d !== void 0 ? _d : {};
62365
62379
  const spec = Object.assign(Object.assign({}, chartTooltipSpec), seriesTooltipSpec);
62366
- ['mark', 'dimension'].forEach(activeType => {
62380
+ ['mark', 'dimension', 'group'].forEach(activeType => {
62367
62381
  const pattern = spec[activeType];
62368
62382
  if (isValid$3(pattern)) {
62369
62383
  spec[activeType] = Object.assign(Object.assign({}, pattern), { title: addExtraInfoToTooltipTitlePattern(pattern.title, {
@@ -62378,54 +62392,79 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62378
62392
  this._seriesCacheInfo = this._getSeriesCacheInfo();
62379
62393
  }
62380
62394
  getDefaultTooltipPattern(activeType, dimensionInfo) {
62381
- if (activeType === 'mark') {
62382
- return {
62383
- visible: true,
62384
- activeType,
62385
- title: {
62386
- key: undefined,
62387
- value: this.titleValueCallback,
62388
- hasShape: false
62389
- },
62390
- content: [
62391
- {
62392
- seriesId: this.series.id,
62393
- key: this.contentKeyCallback,
62394
- value: this.contentValueCallback,
62395
- hasShape: true,
62396
- shapeType: this.contentShapeTypeCallback,
62397
- shapeColor: this.contentShapeColorCallback,
62398
- shapeStroke: this.contentShapeColorCallback,
62399
- shapeHollow: false
62400
- }
62401
- ]
62402
- };
62403
- }
62404
- else if (activeType === 'dimension' && dimensionInfo) {
62405
- const title = {
62406
- key: undefined,
62407
- value: this._getDimensionData,
62408
- hasShape: false
62409
- };
62410
- const content = [];
62411
- dimensionInfo.forEach(({ data }) => data.forEach(({ series }) => {
62412
- content.push({
62413
- seriesId: series.id,
62414
- key: this.contentKeyCallback,
62415
- value: this.contentValueCallback,
62416
- hasShape: true,
62417
- shapeType: this.contentShapeTypeCallback,
62418
- shapeColor: this.contentShapeColorCallback,
62419
- shapeStroke: this.contentShapeColorCallback,
62420
- shapeHollow: false
62421
- });
62422
- }));
62423
- return {
62424
- visible: true,
62425
- activeType,
62426
- title,
62427
- content
62428
- };
62395
+ switch (activeType) {
62396
+ case 'mark':
62397
+ return {
62398
+ visible: true,
62399
+ activeType,
62400
+ title: {
62401
+ key: undefined,
62402
+ value: this.titleValueCallback,
62403
+ hasShape: false
62404
+ },
62405
+ content: [
62406
+ {
62407
+ seriesId: this.series.id,
62408
+ key: this.contentKeyCallback,
62409
+ value: this.contentValueCallback,
62410
+ hasShape: true,
62411
+ shapeType: this.contentShapeTypeCallback,
62412
+ shapeColor: this.contentShapeColorCallback,
62413
+ shapeStroke: this.contentShapeColorCallback,
62414
+ shapeHollow: false
62415
+ }
62416
+ ]
62417
+ };
62418
+ case 'group':
62419
+ return {
62420
+ visible: true,
62421
+ activeType,
62422
+ title: {
62423
+ key: undefined,
62424
+ value: this.contentKeyCallback,
62425
+ hasShape: false
62426
+ },
62427
+ content: [
62428
+ {
62429
+ seriesId: this.series.id,
62430
+ key: this.titleValueCallback,
62431
+ value: this.contentValueCallback,
62432
+ hasShape: true,
62433
+ shapeType: this.contentShapeTypeCallback,
62434
+ shapeColor: this.contentShapeColorCallback,
62435
+ shapeStroke: this.contentShapeColorCallback,
62436
+ shapeHollow: false
62437
+ }
62438
+ ]
62439
+ };
62440
+ case 'dimension':
62441
+ if (dimensionInfo) {
62442
+ const title = {
62443
+ key: undefined,
62444
+ value: this._getDimensionData,
62445
+ hasShape: false
62446
+ };
62447
+ const content = [];
62448
+ dimensionInfo.forEach(({ data }) => data.forEach(({ series }) => {
62449
+ content.push({
62450
+ seriesId: series.id,
62451
+ key: this.contentKeyCallback,
62452
+ value: this.contentValueCallback,
62453
+ hasShape: true,
62454
+ shapeType: this.contentShapeTypeCallback,
62455
+ shapeColor: this.contentShapeColorCallback,
62456
+ shapeStroke: this.contentShapeColorCallback,
62457
+ shapeHollow: false
62458
+ });
62459
+ }));
62460
+ return {
62461
+ visible: true,
62462
+ activeType,
62463
+ title,
62464
+ content
62465
+ };
62466
+ }
62467
+ break;
62429
62468
  }
62430
62469
  return null;
62431
62470
  }
@@ -62455,37 +62494,44 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62455
62494
  var _a, _b, _c, _d, _e, _f, _g;
62456
62495
  const finalSpec = Object.assign(Object.assign({}, globalSpec), { activeType });
62457
62496
  const { style = {} } = globalSpec;
62458
- if (activeType === 'mark' && series) {
62459
- const seriesSpec = ((_b = (_a = series.tooltipHelper) === null || _a === void 0 ? void 0 : _a.spec) !== null && _b !== void 0 ? _b : {});
62460
- if (isValid$3(seriesSpec.visible) || isValid$3(seriesSpec.activeType)) {
62461
- finalSpec.visible = getTooltipActualActiveType(seriesSpec).includes('mark');
62462
- }
62463
- else if (isValid$3(globalSpec.visible) || isValid$3(globalSpec.activeType)) {
62464
- finalSpec.visible = getTooltipActualActiveType(globalSpec).includes('mark');
62465
- }
62466
- else {
62467
- finalSpec.visible = true;
62468
- }
62469
- finalSpec.handler = (_d = (_c = seriesSpec.handler) !== null && _c !== void 0 ? _c : globalSpec.handler) !== null && _d !== void 0 ? _d : undefined;
62470
- if ((_e = finalSpec.handler) === null || _e === void 0 ? void 0 : _e.showTooltip) {
62471
- return finalSpec;
62472
- }
62473
- }
62474
- else if (activeType === 'dimension' && (dimensionInfo === null || dimensionInfo === void 0 ? void 0 : dimensionInfo.length)) {
62475
- const seriesList = getSeriesListFromDimensionInfo(dimensionInfo);
62476
- if (seriesList.every(series => { var _a; return !getTooltipActualActiveType((_a = series.tooltipHelper) === null || _a === void 0 ? void 0 : _a.spec).includes('dimension'); })) {
62477
- finalSpec.visible = false;
62478
- }
62479
- else if (isValid$3(globalSpec.visible) || isValid$3(globalSpec.activeType)) {
62480
- finalSpec.visible = getTooltipActualActiveType(globalSpec).includes('dimension');
62481
- }
62482
- else {
62483
- finalSpec.visible = true;
62484
- }
62485
- finalSpec.handler = (_f = globalSpec.handler) !== null && _f !== void 0 ? _f : undefined;
62486
- if ((_g = finalSpec.handler) === null || _g === void 0 ? void 0 : _g.showTooltip) {
62487
- return finalSpec;
62488
- }
62497
+ switch (activeType) {
62498
+ case 'mark':
62499
+ case 'group':
62500
+ if (series) {
62501
+ const seriesSpec = ((_b = (_a = series.tooltipHelper) === null || _a === void 0 ? void 0 : _a.spec) !== null && _b !== void 0 ? _b : {});
62502
+ if (isValid$3(seriesSpec.visible) || isValid$3(seriesSpec.activeType)) {
62503
+ finalSpec.visible = getTooltipActualActiveType(seriesSpec).includes(activeType);
62504
+ }
62505
+ else if (isValid$3(globalSpec.visible) || isValid$3(globalSpec.activeType)) {
62506
+ finalSpec.visible = getTooltipActualActiveType(globalSpec).includes(activeType);
62507
+ }
62508
+ else {
62509
+ finalSpec.visible = true;
62510
+ }
62511
+ finalSpec.handler = (_d = (_c = seriesSpec.handler) !== null && _c !== void 0 ? _c : globalSpec.handler) !== null && _d !== void 0 ? _d : undefined;
62512
+ if ((_e = finalSpec.handler) === null || _e === void 0 ? void 0 : _e.showTooltip) {
62513
+ return finalSpec;
62514
+ }
62515
+ }
62516
+ break;
62517
+ case 'dimension':
62518
+ if (dimensionInfo === null || dimensionInfo === void 0 ? void 0 : dimensionInfo.length) {
62519
+ const seriesList = getSeriesListFromDimensionInfo(dimensionInfo);
62520
+ if (seriesList.every(series => { var _a; return !getTooltipActualActiveType((_a = series.tooltipHelper) === null || _a === void 0 ? void 0 : _a.spec).includes('dimension'); })) {
62521
+ finalSpec.visible = false;
62522
+ }
62523
+ else if (isValid$3(globalSpec.visible) || isValid$3(globalSpec.activeType)) {
62524
+ finalSpec.visible = getTooltipActualActiveType(globalSpec).includes('dimension');
62525
+ }
62526
+ else {
62527
+ finalSpec.visible = true;
62528
+ }
62529
+ finalSpec.handler = (_f = globalSpec.handler) !== null && _f !== void 0 ? _f : undefined;
62530
+ if ((_g = finalSpec.handler) === null || _g === void 0 ? void 0 : _g.showTooltip) {
62531
+ return finalSpec;
62532
+ }
62533
+ }
62534
+ break;
62489
62535
  }
62490
62536
  const defaultPattern = getDefaultTooltipPattern(activeType, series, dimensionInfo);
62491
62537
  const seriesPattern = getSeriesTooltipPattern(activeType, series, dimensionInfo);
@@ -62512,70 +62558,84 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62512
62558
  const getDefaultTooltipPattern = (activeType, series, dimensionInfo) => {
62513
62559
  var _a;
62514
62560
  let defaultPattern = {};
62515
- if (activeType === 'mark' && series) {
62516
- defaultPattern = (_a = makeDefaultPattern(series, 'mark')) !== null && _a !== void 0 ? _a : {};
62517
- }
62518
- else if (activeType === 'dimension' && (dimensionInfo === null || dimensionInfo === void 0 ? void 0 : dimensionInfo.length)) {
62519
- const patternList = [];
62520
- dimensionInfo.forEach(({ data }) => data.forEach(data => {
62521
- const { series } = data;
62522
- const mockDimensionInfo = [
62523
- Object.assign(Object.assign({}, dimensionInfo[0]), { data: [data] })
62524
- ];
62525
- const pattern = makeDefaultPattern(series, 'dimension', mockDimensionInfo);
62526
- if (pattern) {
62527
- patternList.push(pattern);
62528
- }
62529
- }));
62530
- const defaultPatternContent = [];
62531
- patternList.forEach(({ content }) => {
62532
- if (isFunction$1(content)) {
62533
- defaultPatternContent.push(content);
62561
+ switch (activeType) {
62562
+ case 'mark':
62563
+ case 'group':
62564
+ if (series) {
62565
+ defaultPattern = (_a = makeDefaultPattern(series, activeType)) !== null && _a !== void 0 ? _a : {};
62534
62566
  }
62535
- else {
62536
- defaultPatternContent.push(...array(content));
62567
+ break;
62568
+ case 'dimension':
62569
+ if (dimensionInfo === null || dimensionInfo === void 0 ? void 0 : dimensionInfo.length) {
62570
+ const patternList = [];
62571
+ dimensionInfo.forEach(({ data }) => data.forEach(data => {
62572
+ const { series } = data;
62573
+ const mockDimensionInfo = [
62574
+ Object.assign(Object.assign({}, dimensionInfo[0]), { data: [data] })
62575
+ ];
62576
+ const pattern = makeDefaultPattern(series, 'dimension', mockDimensionInfo);
62577
+ if (pattern) {
62578
+ patternList.push(pattern);
62579
+ }
62580
+ }));
62581
+ const defaultPatternContent = [];
62582
+ patternList.forEach(({ content }) => {
62583
+ if (isFunction$1(content)) {
62584
+ defaultPatternContent.push(content);
62585
+ }
62586
+ else {
62587
+ defaultPatternContent.push(...array(content));
62588
+ }
62589
+ });
62590
+ defaultPattern = Object.assign(Object.assign({}, patternList[0]), { content: defaultPatternContent });
62537
62591
  }
62538
- });
62539
- defaultPattern = Object.assign(Object.assign({}, patternList[0]), { content: defaultPatternContent });
62592
+ break;
62540
62593
  }
62541
62594
  return defaultPattern;
62542
62595
  };
62543
62596
  const getSeriesTooltipPattern = (activeType, series, dimensionInfo) => {
62544
62597
  var _a, _b;
62545
62598
  let seriesPattern = {};
62546
- if (activeType === 'mark' && series) {
62547
- const seriesSpec = ((_b = (_a = series.tooltipHelper) === null || _a === void 0 ? void 0 : _a.spec) !== null && _b !== void 0 ? _b : {});
62548
- seriesPattern = seriesSpec.mark ? cloneDeep(seriesSpec.mark) : {};
62549
- }
62550
- else if (activeType === 'dimension' && (dimensionInfo === null || dimensionInfo === void 0 ? void 0 : dimensionInfo.length)) {
62551
- const seriesList = getSeriesListFromDimensionInfo(dimensionInfo);
62552
- const seriesPatternList = seriesList
62553
- .filter(series => {
62554
- var _a;
62555
- const spec = (_a = series.tooltipHelper) === null || _a === void 0 ? void 0 : _a.spec;
62556
- return isValid$3(spec === null || spec === void 0 ? void 0 : spec.dimension) && getTooltipActualActiveType(spec).includes('dimension');
62557
- })
62558
- .map(series => series.tooltipHelper.spec.dimension);
62559
- if (seriesPatternList.length) {
62560
- let seriesPatternContent = [];
62561
- if (seriesPatternList.every(({ content }) => isNil$3(content))) {
62562
- seriesPatternContent = undefined;
62599
+ switch (activeType) {
62600
+ case 'mark':
62601
+ case 'group':
62602
+ if (series) {
62603
+ const seriesSpec = ((_b = (_a = series.tooltipHelper) === null || _a === void 0 ? void 0 : _a.spec) !== null && _b !== void 0 ? _b : {});
62604
+ seriesPattern = seriesSpec[activeType] ? cloneDeep(seriesSpec[activeType]) : {};
62563
62605
  }
62564
- else {
62565
- seriesPatternList.forEach(({ content }) => {
62566
- if (isNil$3(content)) {
62567
- return;
62568
- }
62569
- if (isFunction$1(content)) {
62570
- seriesPatternContent === null || seriesPatternContent === void 0 ? void 0 : seriesPatternContent.push(content);
62606
+ break;
62607
+ case 'dimension':
62608
+ if (dimensionInfo === null || dimensionInfo === void 0 ? void 0 : dimensionInfo.length) {
62609
+ const seriesList = getSeriesListFromDimensionInfo(dimensionInfo);
62610
+ const seriesPatternList = seriesList
62611
+ .filter(series => {
62612
+ var _a;
62613
+ const spec = (_a = series.tooltipHelper) === null || _a === void 0 ? void 0 : _a.spec;
62614
+ return isValid$3(spec === null || spec === void 0 ? void 0 : spec.dimension) && getTooltipActualActiveType(spec).includes('dimension');
62615
+ })
62616
+ .map(series => series.tooltipHelper.spec.dimension);
62617
+ if (seriesPatternList.length) {
62618
+ let seriesPatternContent = [];
62619
+ if (seriesPatternList.every(({ content }) => isNil$3(content))) {
62620
+ seriesPatternContent = undefined;
62571
62621
  }
62572
62622
  else {
62573
- seriesPatternContent === null || seriesPatternContent === void 0 ? void 0 : seriesPatternContent.push(...array(content));
62623
+ seriesPatternList.forEach(({ content }) => {
62624
+ if (isNil$3(content)) {
62625
+ return;
62626
+ }
62627
+ if (isFunction$1(content)) {
62628
+ seriesPatternContent === null || seriesPatternContent === void 0 ? void 0 : seriesPatternContent.push(content);
62629
+ }
62630
+ else {
62631
+ seriesPatternContent === null || seriesPatternContent === void 0 ? void 0 : seriesPatternContent.push(...array(content));
62632
+ }
62633
+ });
62574
62634
  }
62575
- });
62635
+ seriesPattern = Object.assign(Object.assign({}, seriesPatternList[0]), { content: seriesPatternContent });
62636
+ }
62576
62637
  }
62577
- seriesPattern = Object.assign(Object.assign({}, seriesPatternList[0]), { content: seriesPatternContent });
62578
- }
62638
+ break;
62579
62639
  }
62580
62640
  return seriesPattern;
62581
62641
  };
@@ -62617,216 +62677,228 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62617
62677
  return shapePattern;
62618
62678
  };
62619
62679
 
62620
- const DEFAULT_TEXT_ATTRIBUTES = {
62621
- fontFamily: token.fontFamily,
62622
- spacing: 10,
62623
- wordBreak: 'break-word'
62624
- };
62625
- function getTextAttributes(style = {}, globalTheme, defaultAttributes) {
62626
- var _a, _b;
62627
- const attrs = Object.assign(Object.assign({}, (defaultAttributes !== null && defaultAttributes !== void 0 ? defaultAttributes : DEFAULT_TEXT_ATTRIBUTES)), { fill: ((_a = style.fill) !== null && _a !== void 0 ? _a : style.fontColor), textAlign: style.textAlign, textBaseline: style.textBaseline, fontFamily: (_b = style.fontFamily) !== null && _b !== void 0 ? _b : globalTheme === null || globalTheme === void 0 ? void 0 : globalTheme.fontFamily, fontSize: style.fontSize, fontWeight: style.fontWeight, lineHeight: style.lineHeight, spacing: style.spacing, multiLine: style.multiLine, maxWidth: style.maxWidth, wordBreak: style.wordBreak, autoWidth: style.autoWidth });
62628
- return attrs;
62629
- }
62630
- const getPanelAttributes = (style) => {
62631
- var _a;
62632
- const { backgroundColor, border, shadow } = style;
62633
- const panelAttrs = {
62634
- lineWidth: (_a = border === null || border === void 0 ? void 0 : border.width) !== null && _a !== void 0 ? _a : 0,
62635
- shadow: !!shadow
62636
- };
62637
- if (border === null || border === void 0 ? void 0 : border.color) {
62638
- panelAttrs.stroke = border.color;
62680
+ const getTooltipContentValue = (field, datum, params, formatter) => {
62681
+ let value;
62682
+ if (isFunction$1(field)) {
62683
+ value = field(datum, params);
62639
62684
  }
62640
- if (backgroundColor) {
62641
- panelAttrs.fill = backgroundColor;
62685
+ else {
62686
+ value = field;
62642
62687
  }
62643
- if (shadow) {
62644
- panelAttrs.shadowColor = shadow.color;
62645
- panelAttrs.shadowBlur = shadow.blur;
62646
- panelAttrs.shadowOffsetX = shadow.x;
62647
- panelAttrs.shadowOffsetY = shadow.y;
62648
- panelAttrs.shadowSpread = shadow.spread;
62688
+ if (formatter) {
62689
+ const { formatFunc, args } = getFormatFunction(undefined, formatter, field, datum);
62690
+ if (formatFunc && args) {
62691
+ value = formatFunc(...args);
62692
+ }
62649
62693
  }
62650
- const { radius } = border !== null && border !== void 0 ? border : {};
62651
- if (isValid$3(radius)) {
62652
- panelAttrs.cornerRadius = [radius, radius, radius, radius];
62694
+ return value;
62695
+ };
62696
+ const getTooltipPatternValue = (field, data, params) => {
62697
+ if (isNil$3(field)) {
62698
+ return field;
62653
62699
  }
62654
- return panelAttrs;
62700
+ if (isFunction$1(field)) {
62701
+ return field(data, params);
62702
+ }
62703
+ return field;
62655
62704
  };
62656
- const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
62657
- var _a, _b, _c, _d, _e;
62658
- const { style = {}, enterable, transitionDuration } = spec;
62659
- const { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, maxContentHeight } = style;
62660
- const padding = normalizePadding$1(panel.padding);
62661
- const paddingSpec = normalizeLayoutPaddingSpec(panel.padding);
62662
- const titleStyle = getTextAttributes(titleLabel, globalTheme);
62663
- const keyStyle = getTextAttributes(keyLabel, globalTheme);
62664
- const valueStyle = getTextAttributes(valueLabel, globalTheme);
62665
- const shapeStyle = {
62666
- fill: true,
62667
- size: (_a = shape === null || shape === void 0 ? void 0 : shape.size) !== null && _a !== void 0 ? _a : 8,
62668
- spacing: (_b = shape === null || shape === void 0 ? void 0 : shape.spacing) !== null && _b !== void 0 ? _b : 6
62669
- };
62670
- const attributes = {
62671
- panel: getPanelAttributes(panel),
62672
- padding,
62673
- title: {},
62674
- content: [],
62675
- titleStyle: {
62676
- value: titleStyle,
62677
- spaceRow: commonSpaceRow
62678
- },
62679
- contentStyle: {
62680
- shape: shapeStyle,
62681
- key: keyStyle,
62682
- value: valueStyle,
62683
- spaceRow: commonSpaceRow
62684
- },
62685
- hasContentShape: false,
62686
- keyWidth: 0,
62687
- valueWidth: 0,
62688
- maxContentHeight,
62689
- enterable,
62690
- transitionDuration
62691
- };
62692
- const { title = {}, content = [] } = actualTooltip;
62693
- let panelWidth = paddingSpec.left + paddingSpec.right;
62694
- let panelHeight = paddingSpec.top + paddingSpec.bottom;
62695
- let panelDomHeight = paddingSpec.top + paddingSpec.bottom;
62696
- let contentMaxWidth = 0;
62697
- const filteredContent = content.filter(item => {
62698
- return (item.key || item.value) && item.visible !== false;
62705
+ const getTooltipContentPattern = (field, data, params) => {
62706
+ if (isNil$3(field)) {
62707
+ return field;
62708
+ }
62709
+ let result = [];
62710
+ array(field).forEach(patternItem => {
62711
+ if (isFunction$1(patternItem)) {
62712
+ result = result.concat(array(patternItem(data, params)));
62713
+ }
62714
+ else {
62715
+ result.push(patternItem);
62716
+ }
62699
62717
  });
62700
- const hasContent = !!filteredContent.length;
62701
- let maxKeyWidth = 0;
62702
- let maxAdaptiveKeyWidth = 0;
62703
- let maxValueWidth = 0;
62704
- let maxShapeWidth = 0;
62705
- if (hasContent) {
62706
- const keyWidths = [];
62707
- const adaptiveKeyWidths = [];
62708
- const valueWidths = [];
62709
- const shapeWidths = [];
62710
- let contentHeight = 0;
62711
- attributes.content = filteredContent.map((item, i) => {
62712
- let itemHeight = 0;
62713
- const { hasShape: actualHasShape, key: actualKey, shapeType: actualShapeType = '', shapeFill: actualShapeFill, shapeStroke: actualShapeStroke, shapeLineWidth: actualShapeLineWidth, shapeSize: actualShapeSize, value: actualValue, isKeyAdaptive: actualIsKeyAdaptive, spaceRow: actualSpaceRow, keyStyle: actualKeyStyle, valueStyle: actualValueStyle, shapeHollow: actualShapeHollow, shapeColor: actualShapeColor } = item;
62714
- const itemAttrs = { height: 0, spaceRow: actualSpaceRow !== null && actualSpaceRow !== void 0 ? actualSpaceRow : commonSpaceRow };
62715
- if (isValid$3(actualKey)) {
62716
- const itemKeyStyle = mergeSpec({}, keyStyle, getTextAttributes(actualKeyStyle, undefined, {}));
62717
- const { width, height, text } = measureTooltipText(actualKey, itemKeyStyle);
62718
- itemAttrs.key = Object.assign(Object.assign({ width,
62719
- height }, itemKeyStyle), { text });
62720
- if (!actualIsKeyAdaptive) {
62721
- keyWidths.push(width);
62722
- }
62723
- else {
62724
- adaptiveKeyWidths.push(width);
62725
- }
62726
- itemHeight = Math.max(itemHeight, height);
62727
- }
62728
- if (isValid$3(actualValue)) {
62729
- const itemValueStyle = mergeSpec({}, valueStyle, getTextAttributes(actualValueStyle, undefined, {}));
62730
- const { width, height, text } = measureTooltipText(actualValue, itemValueStyle);
62731
- itemAttrs.value = Object.assign(Object.assign({ width,
62732
- height }, itemValueStyle), { text });
62733
- valueWidths.push(width);
62734
- itemHeight = Math.max(itemHeight, height);
62735
- }
62736
- if (actualHasShape) {
62737
- const shape = {
62738
- visible: true,
62739
- symbolType: actualShapeType
62740
- };
62741
- const adaptiveShapeFill = actualShapeFill !== null && actualShapeFill !== void 0 ? actualShapeFill : actualShapeColor;
62742
- if (actualShapeHollow) {
62743
- shape.stroke = adaptiveShapeFill;
62744
- }
62745
- else {
62746
- shape.fill = adaptiveShapeFill;
62718
+ return result;
62719
+ };
62720
+ function getFirstDatumFromTooltipData(data) {
62721
+ var _a;
62722
+ const dimInfoList = ((_a = data[0]) === null || _a === void 0 ? void 0 : _a.series)
62723
+ ? [{ data: data, value: '' }]
62724
+ : data;
62725
+ for (const { data: dataList } of dimInfoList) {
62726
+ for (const { datum: datumList } of dataList) {
62727
+ for (const datumItem of datumList !== null && datumList !== void 0 ? datumList : []) {
62728
+ if (datumItem) {
62729
+ return datumItem;
62747
62730
  }
62748
- shape.stroke = actualShapeStroke !== null && actualShapeStroke !== void 0 ? actualShapeStroke : adaptiveShapeFill;
62749
- shape.lineWidth = actualShapeLineWidth;
62750
- itemAttrs.shape = shape;
62751
- const shapeWidth = actualShapeSize !== null && actualShapeSize !== void 0 ? actualShapeSize : shapeStyle.size;
62752
- itemHeight = Math.max(shapeWidth, itemHeight);
62753
- shapeWidths.push(shapeWidth);
62754
62731
  }
62755
- else {
62756
- itemAttrs.shape = { visible: false };
62757
- }
62758
- itemAttrs.height = itemHeight;
62759
- contentHeight += itemHeight;
62760
- if (i < filteredContent.length - 1) {
62761
- contentHeight += itemAttrs.spaceRow;
62762
- }
62763
- return itemAttrs;
62764
- });
62765
- panelHeight += contentHeight;
62766
- panelDomHeight += Math.min(contentHeight, maxContentHeight !== null && maxContentHeight !== void 0 ? maxContentHeight : Infinity);
62767
- maxKeyWidth = keyWidths.length ? maxInArray(keyWidths) : 0;
62768
- maxAdaptiveKeyWidth = adaptiveKeyWidths.length ? maxInArray(adaptiveKeyWidths) : 0;
62769
- maxValueWidth = valueWidths.length ? maxInArray(valueWidths) : 0;
62770
- maxShapeWidth = shapeWidths.length ? maxInArray(shapeWidths) + shapeStyle.spacing : 0;
62771
- contentMaxWidth = Math.max(maxShapeWidth + maxKeyWidth + keyStyle.spacing + maxValueWidth + valueStyle.spacing, maxShapeWidth + maxAdaptiveKeyWidth, contentMaxWidth);
62772
- attributes.hasContentShape = !!shapeWidths.length;
62773
- attributes.keyWidth = maxKeyWidth;
62774
- attributes.valueWidth = maxValueWidth;
62732
+ }
62775
62733
  }
62776
- let titleMaxWidth = 0;
62777
- let titleMaxHeight = 0;
62778
- let titleHeightWithSpace = 0;
62779
- const { visible: actualTitleVisible = true, value: actualTitleValue = '', valueStyle: actualTitleValueStyle, spaceRow: actualTitleSpaceRow } = title;
62780
- attributes.title.visible = actualTitleVisible;
62781
- attributes.title.spaceRow = actualTitleSpaceRow !== null && actualTitleSpaceRow !== void 0 ? actualTitleSpaceRow : commonSpaceRow;
62782
- let titleValueStyle = {};
62783
- const isAutoWidthMode = () => titleValueStyle.autoWidth && titleValueStyle.multiLine !== false;
62784
- if (actualTitleVisible) {
62785
- titleValueStyle = mergeSpec({}, titleStyle, getTextAttributes(actualTitleValueStyle, undefined, {}));
62786
- if (isAutoWidthMode()) {
62787
- titleValueStyle.multiLine = (_c = titleValueStyle.multiLine) !== null && _c !== void 0 ? _c : true;
62788
- titleValueStyle.maxWidth = (_d = titleValueStyle.maxWidth) !== null && _d !== void 0 ? _d : (hasContent ? Math.ceil(contentMaxWidth) : undefined);
62734
+ return undefined;
62735
+ }
62736
+
62737
+ class TooltipHandlerType {
62738
+ }
62739
+ TooltipHandlerType.dom = `${PREFIX}_TOOLTIP_HANDLER_DOM`;
62740
+ TooltipHandlerType.canvas = `${PREFIX}_TOOLTIP_HANDLER_CANVAS`;
62741
+ const TOOLTIP_EL_CLASS_NAME = 'vchart-tooltip-element';
62742
+ const TOOLTIP_MAX_LINE_COUNT = 20;
62743
+ const TOOLTIP_OTHERS_LINE = {
62744
+ key: '其他',
62745
+ value: '...'
62746
+ };
62747
+
62748
+ const getTimeString = (value, timeFormat, timeFormatMode) => {
62749
+ if (!timeFormat && !timeFormatMode) {
62750
+ if (typeof value !== 'object') {
62751
+ return value === null || value === void 0 ? void 0 : value.toString();
62789
62752
  }
62790
- const { text, width, height } = measureTooltipText(actualTitleValue, titleValueStyle);
62791
- attributes.title.value = Object.assign(Object.assign({ width: isAutoWidthMode() ? Math.min(width, (_e = titleValueStyle.maxWidth) !== null && _e !== void 0 ? _e : Number.MAX_VALUE) : width, height }, titleValueStyle), { text });
62792
- titleMaxWidth = attributes.title.value.width;
62793
- titleMaxHeight = attributes.title.value.height;
62794
- titleHeightWithSpace = titleMaxHeight + (hasContent ? attributes.title.spaceRow : 0);
62753
+ return value;
62795
62754
  }
62796
- panelHeight += titleHeightWithSpace;
62797
- panelDomHeight += titleHeightWithSpace;
62798
- attributes.title.width = titleMaxWidth;
62799
- attributes.title.height = titleMaxHeight;
62800
- if (isAutoWidthMode()) {
62801
- panelWidth += contentMaxWidth ? contentMaxWidth : titleMaxWidth;
62755
+ const timeUtil = TimeUtil.getInstance();
62756
+ timeFormat = timeFormat || '%Y%m%d';
62757
+ timeFormatMode = timeFormatMode || 'local';
62758
+ const timeFormatter = timeFormatMode === 'local' ? timeUtil.timeFormat : timeUtil.timeUTCFormat;
62759
+ return timeFormatter(timeFormat, value);
62760
+ };
62761
+ const getShowContent = (pattern, data, params) => {
62762
+ var _a, _b, _c, _d;
62763
+ if (!data ||
62764
+ ((_a = params === null || params === void 0 ? void 0 : params.event) === null || _a === void 0 ? void 0 : _a.type) === 'mouseout') {
62765
+ return null;
62766
+ }
62767
+ const tooltipActualTitleContent = {
62768
+ title: {},
62769
+ content: []
62770
+ };
62771
+ const patternTitle = getTooltipPatternValue(pattern.title, data, params);
62772
+ const { visible, value, valueTimeFormat, valueTimeFormatMode, valueStyle, hasShape, valueFormatter } = patternTitle !== null && patternTitle !== void 0 ? patternTitle : {};
62773
+ const patternTitleVisible = getTooltipContentValue(visible, data, params) !== false;
62774
+ if (!patternTitle || !patternTitleVisible) {
62775
+ tooltipActualTitleContent.title = {
62776
+ hasShape: false,
62777
+ visible: false
62778
+ };
62802
62779
  }
62803
62780
  else {
62804
- panelWidth += Math.max(titleMaxWidth, contentMaxWidth);
62781
+ const datum = getFirstDatumFromTooltipData(data);
62782
+ tooltipActualTitleContent.title = {
62783
+ value: getTimeString(getTooltipContentValue(value, datum, params, valueFormatter), valueTimeFormat, valueTimeFormatMode),
62784
+ valueStyle: getTooltipContentValue(valueStyle, datum, params),
62785
+ hasShape
62786
+ };
62805
62787
  }
62806
- if (hasContent) {
62807
- attributes.content.forEach(item => {
62808
- var _a;
62809
- const value = item.value;
62810
- if (value && ((_a = value.autoWidth) !== null && _a !== void 0 ? _a : true)) {
62811
- value.width =
62812
- panelWidth -
62813
- paddingSpec.left -
62814
- paddingSpec.right -
62815
- maxShapeWidth -
62816
- maxKeyWidth -
62817
- keyStyle.spacing -
62818
- valueStyle.spacing;
62819
- if (!value.maxWidth) {
62820
- value.maxWidth = Math.ceil(value.width);
62788
+ const patternContent = getTooltipContentPattern(pattern.content, data, params);
62789
+ const { maxLineCount = TOOLTIP_MAX_LINE_COUNT } = pattern;
62790
+ const getTooltipContentFromDatumList = (datumList) => {
62791
+ if (datumList === null || datumList === void 0 ? void 0 : datumList.length) {
62792
+ for (const datum of datumList) {
62793
+ for (const content of patternContent !== null && patternContent !== void 0 ? patternContent : []) {
62794
+ const oneLineData = getOneLineData(datum, content, params);
62795
+ if (oneLineData.visible !== false) {
62796
+ if (tooltipActualTitleContent.content.length === maxLineCount - 1) {
62797
+ tooltipActualTitleContent.content.push(Object.assign(Object.assign({}, oneLineData), TOOLTIP_OTHERS_LINE));
62798
+ break;
62799
+ }
62800
+ else if (tooltipActualTitleContent.content.length < maxLineCount) {
62801
+ tooltipActualTitleContent.content.push(oneLineData);
62802
+ }
62803
+ else {
62804
+ break;
62805
+ }
62806
+ }
62821
62807
  }
62822
- attributes.valueWidth = Math.max(attributes.valueWidth, value.width);
62823
62808
  }
62824
- });
62809
+ }
62810
+ };
62811
+ switch (pattern.activeType) {
62812
+ case 'mark':
62813
+ getTooltipContentFromDatumList((_b = data[0]) === null || _b === void 0 ? void 0 : _b.datum);
62814
+ break;
62815
+ case 'group':
62816
+ getTooltipContentFromDatumList(params.groupDatum);
62817
+ break;
62818
+ case 'dimension':
62819
+ for (const { data: d } of data) {
62820
+ for (const { datum: datumList, series } of d) {
62821
+ if (!getTooltipActualActiveType((_c = series.tooltipHelper) === null || _c === void 0 ? void 0 : _c.spec).includes('dimension')) {
62822
+ continue;
62823
+ }
62824
+ const contentPatterns = (_d = patternContent === null || patternContent === void 0 ? void 0 : patternContent.filter(c => isNil$3(c.seriesId) || c.seriesId === series.id)) !== null && _d !== void 0 ? _d : [];
62825
+ for (const datum of datumList) {
62826
+ for (const linePattern of contentPatterns) {
62827
+ const oneLineData = getOneLineData(datum, linePattern, params);
62828
+ if (oneLineData.visible === false) {
62829
+ continue;
62830
+ }
62831
+ if (tooltipActualTitleContent.content.length === maxLineCount - 1) {
62832
+ tooltipActualTitleContent.content.push(Object.assign(Object.assign({}, oneLineData), TOOLTIP_OTHERS_LINE));
62833
+ break;
62834
+ }
62835
+ else if (tooltipActualTitleContent.content.length < maxLineCount) {
62836
+ tooltipActualTitleContent.content.push(oneLineData);
62837
+ }
62838
+ else {
62839
+ break;
62840
+ }
62841
+ }
62842
+ if (tooltipActualTitleContent.content.length >= maxLineCount) {
62843
+ break;
62844
+ }
62845
+ }
62846
+ if (tooltipActualTitleContent.content.length >= maxLineCount) {
62847
+ break;
62848
+ }
62849
+ }
62850
+ if (tooltipActualTitleContent.content.length >= maxLineCount) {
62851
+ break;
62852
+ }
62853
+ }
62854
+ break;
62825
62855
  }
62826
- attributes.panel.width = panelWidth;
62827
- attributes.panel.height = panelHeight;
62828
- attributes.panelDomHeight = panelDomHeight;
62829
- return attributes;
62856
+ if (tooltipActualTitleContent.title) {
62857
+ if (tooltipActualTitleContent.content.length > 0 && tooltipActualTitleContent.content[0].shapeType) {
62858
+ if (isNil$3(tooltipActualTitleContent.title.shapeType)) {
62859
+ tooltipActualTitleContent.title.shapeType = tooltipActualTitleContent.content[0].shapeType;
62860
+ }
62861
+ if (isNil$3(tooltipActualTitleContent.title.shapeColor)) {
62862
+ tooltipActualTitleContent.title.shapeColor = tooltipActualTitleContent.content[0].shapeColor;
62863
+ }
62864
+ }
62865
+ else {
62866
+ tooltipActualTitleContent.title.hasShape = false;
62867
+ }
62868
+ }
62869
+ return tooltipActualTitleContent;
62870
+ };
62871
+ const getOneLineData = (datum, config, params) => {
62872
+ const key = getTimeString(getTooltipContentValue(config.key, datum, params, config.keyFormatter), config.keyTimeFormat, config.keyTimeFormatMode);
62873
+ const value = getTimeString(getTooltipContentValue(config.value, datum, params, config.valueFormatter), config.valueTimeFormat, config.valueTimeFormatMode);
62874
+ const visible = getTooltipContentValue(config.visible, datum, params) !== false && (isValid$3(key) || isValid$3(value));
62875
+ const isKeyAdaptive = getTooltipContentValue(config.isKeyAdaptive, datum, params);
62876
+ const spaceRow = getTooltipContentValue(config.spaceRow, datum, params);
62877
+ const shapeType = getTooltipContentValue(config.shapeType, datum, params);
62878
+ const shapeColor = getTooltipContentValue(config.shapeColor, datum, params);
62879
+ const shapeFill = getTooltipContentValue(config.shapeFill, datum, params);
62880
+ const shapeStroke = getTooltipContentValue(config.shapeStroke, datum, params);
62881
+ const shapeLineWidth = getTooltipContentValue(config.shapeLineWidth, datum, params);
62882
+ const shapeHollow = getTooltipContentValue(config.shapeHollow, datum, params);
62883
+ const keyStyle = getTooltipContentValue(config.keyStyle, datum, params);
62884
+ const valueStyle = getTooltipContentValue(config.valueStyle, datum, params);
62885
+ return {
62886
+ key,
62887
+ value,
62888
+ visible,
62889
+ isKeyAdaptive,
62890
+ hasShape: config.hasShape,
62891
+ shapeType,
62892
+ shapeFill,
62893
+ shapeStroke,
62894
+ shapeLineWidth,
62895
+ shapeHollow,
62896
+ shapeColor,
62897
+ keyStyle,
62898
+ valueStyle,
62899
+ spaceRow,
62900
+ datum
62901
+ };
62830
62902
  };
62831
62903
 
62832
62904
  class BaseTooltipHandler extends BasePlugin {
@@ -62836,79 +62908,31 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62836
62908
  this._attributes = null;
62837
62909
  this._isReleased = false;
62838
62910
  this.showTooltip = (activeType, data, params) => {
62839
- var _a;
62840
- let changePositionOnly = !!params.changePositionOnly;
62841
- if (!params.changePositionOnly || ((_a = this._cacheActualTooltip) === null || _a === void 0 ? void 0 : _a.activeType) !== activeType) {
62842
- changePositionOnly = false;
62843
- this._clearCacheOfContent();
62911
+ const { changePositionOnly } = params;
62912
+ if (changePositionOnly) {
62913
+ return this.changeTooltipPosition(params, data);
62844
62914
  }
62845
- if (changePositionOnly && this._cacheViewSpec && this._cacheActualTooltip) {
62846
- return this.changeTooltipPosition(changePositionOnly, data, params);
62847
- }
62848
- return this.changeTooltip(true, params, changePositionOnly, activeType, data);
62915
+ return this.changeTooltip(true, params, data);
62849
62916
  };
62850
- this._changeTooltip = (visible, params, changePositionOnly, activeType, data) => {
62851
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
62852
- const tooltipSpec = this._component.getSpec();
62853
- if (this._isReleased || !tooltipSpec) {
62917
+ this._changeTooltip = (visible, params, data) => {
62918
+ if (this._isReleased) {
62854
62919
  return 1;
62855
62920
  }
62856
62921
  if (!visible) {
62857
62922
  this._clearAllCache();
62858
- if (tooltipSpec.handler) {
62859
- return (_c = (_b = (_a = tooltipSpec.handler).hideTooltip) === null || _b === void 0 ? void 0 : _b.call(_a, params)) !== null && _c !== void 0 ? _c : 0;
62860
- }
62861
62923
  this._updateTooltip(false, params);
62862
62924
  return 0;
62863
62925
  }
62864
- if (isNil$3(activeType) || isNil$3(data)) {
62865
- return 1;
62866
- }
62867
- let spec;
62868
- if (changePositionOnly && this._cacheViewSpec) {
62869
- spec = this._cacheViewSpec;
62870
- }
62871
- else {
62872
- spec = getTooltipSpecForShow(activeType, tooltipSpec, params.model, params.dimensionInfo);
62873
- this._cacheViewSpec = spec;
62874
- }
62875
- if (spec.visible === false) {
62876
- return 1;
62877
- }
62878
- if (spec.handler) {
62879
- return (_f = (_e = (_d = spec.handler).showTooltip) === null || _e === void 0 ? void 0 : _e.call(_d, activeType, data, params)) !== null && _f !== void 0 ? _f : 0;
62880
- }
62881
- const pattern = spec[activeType];
62882
- if (!pattern) {
62883
- return 1;
62884
- }
62885
- let actualTooltip;
62886
- if (changePositionOnly && this._cacheActualTooltip) {
62887
- actualTooltip = this._cacheActualTooltip;
62888
- }
62889
- else {
62890
- actualTooltip = this._getActualTooltipContent(pattern, data, params);
62891
- actualTooltip.title = (_h = (_g = pattern.updateTitle) === null || _g === void 0 ? void 0 : _g.call(pattern, actualTooltip.title, data, params)) !== null && _h !== void 0 ? _h : actualTooltip.title;
62892
- actualTooltip.content = (_k = (_j = pattern.updateContent) === null || _j === void 0 ? void 0 : _j.call(pattern, actualTooltip.content, data, params)) !== null && _k !== void 0 ? _k : actualTooltip.content;
62893
- }
62894
- if (isNil$3((_l = actualTooltip.title) === null || _l === void 0 ? void 0 : _l.key) && isNil$3((_m = actualTooltip.title) === null || _m === void 0 ? void 0 : _m.value) && !((_o = actualTooltip.content) === null || _o === void 0 ? void 0 : _o.length)) {
62895
- return 1;
62896
- }
62897
- this._cacheActualTooltip = actualTooltip;
62898
- return this._changeTooltipPosition(!!changePositionOnly, data, params);
62926
+ return this._changeTooltipPosition(params, data);
62899
62927
  };
62900
- this._changeTooltipPosition = (changePositionOnly, data, params) => {
62928
+ this._changeTooltipPosition = (params, data) => {
62901
62929
  var _a, _b, _c;
62902
62930
  if (this._isReleased) {
62903
62931
  return 1;
62904
62932
  }
62905
62933
  const event = params.event;
62906
- const spec = this._cacheViewSpec;
62907
- const actualTooltip = this._cacheActualTooltip;
62908
- if (!spec || !actualTooltip) {
62909
- return 1;
62910
- }
62911
- if (spec.enterable) {
62934
+ const { tooltipSpec, tooltipActual, changePositionOnly } = params;
62935
+ if (tooltipSpec.enterable) {
62912
62936
  if (!this._isPointerEscaped && this._isPointerMovingToTooltip(params)) {
62913
62937
  if (!this._isTooltipPaused) {
62914
62938
  this._isTooltipPaused = true;
@@ -62923,46 +62947,39 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62923
62947
  clearTimeout(this._cachePointerTimer);
62924
62948
  this._cachePointerPosition = this._getPointerPositionRelativeToTooltipParent(params);
62925
62949
  }
62926
- const activeType = actualTooltip.activeType;
62927
- if (spec.handler) {
62928
- return (_c = (_b = (_a = spec.handler).showTooltip) === null || _b === void 0 ? void 0 : _b.call(_a, activeType, data, params)) !== null && _c !== void 0 ? _c : 0;
62950
+ const activeType = tooltipActual.activeType;
62951
+ if (tooltipSpec.handler) {
62952
+ return (_c = (_b = (_a = tooltipSpec.handler).showTooltip) === null || _b === void 0 ? void 0 : _b.call(_a, activeType, data, params)) !== null && _c !== void 0 ? _c : 0;
62929
62953
  }
62930
- const pattern = spec[activeType];
62954
+ const pattern = tooltipSpec[activeType];
62931
62955
  if (!pattern) {
62932
62956
  return 1;
62933
62957
  }
62934
- const position = this._getActualTooltipPosition(actualTooltip, params, this._getTooltipBoxSize(actualTooltip, changePositionOnly));
62935
- actualTooltip.position = position;
62958
+ const position = this._getActualTooltipPosition(tooltipActual, params, this._getTooltipBoxSize(tooltipActual, changePositionOnly));
62959
+ tooltipActual.position = position;
62936
62960
  if (pattern.updatePosition) {
62937
- actualTooltip.position = pattern.updatePosition(actualTooltip.position, data, params);
62961
+ tooltipActual.position = pattern.updatePosition(tooltipActual.position, data, params);
62938
62962
  }
62939
62963
  let tooltipVisible = (pattern === null || pattern === void 0 ? void 0 : pattern.visible) !== false;
62940
62964
  if (!data ||
62941
62965
  event.type === 'pointerout' ||
62942
- !actualTooltip.visible ||
62943
- (!actualTooltip.title && !actualTooltip.content)) {
62966
+ !tooltipActual.visible ||
62967
+ (!tooltipActual.title && !tooltipActual.content)) {
62944
62968
  tooltipVisible = false;
62945
62969
  }
62946
- this._updateTooltip(tooltipVisible, Object.assign(Object.assign({}, params), { changePositionOnly }), actualTooltip);
62970
+ this._updateTooltip(tooltipVisible, Object.assign(Object.assign({}, params), { changePositionOnly }));
62947
62971
  return 0;
62948
62972
  };
62949
- this._getActualTooltipContent = (pattern, data, params) => {
62950
- const patternVisible = getTooltipPatternValue(pattern.visible, data, params);
62951
- let tooltipContent = null;
62952
- tooltipContent = getShowContent(pattern, data, params);
62953
- const actualTooltip = Object.assign(Object.assign({}, tooltipContent), { visible: isValid$3(tooltipContent) ? patternVisible !== false : false, activeType: pattern.activeType, data });
62954
- return actualTooltip;
62955
- };
62956
62973
  this._getActualTooltipPosition = (actualTooltip, params, tooltipBoxSize) => {
62957
62974
  var _a, _b, _c, _d, _e, _f, _g;
62958
62975
  const event = params.event;
62976
+ const { tooltipSpec } = params;
62959
62977
  const firstDimensionInfo = (_a = params.dimensionInfo) === null || _a === void 0 ? void 0 : _a[0];
62960
62978
  const invalidPosition = {
62961
62979
  x: Infinity,
62962
62980
  y: Infinity
62963
62981
  };
62964
62982
  let { offsetX, offsetY } = this._option;
62965
- const tooltipSpec = this._cacheViewSpec;
62966
62983
  if (!tooltipSpec) {
62967
62984
  this._cacheTooltipPosition = undefined;
62968
62985
  return invalidPosition;
@@ -63352,14 +63369,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
63352
63369
  this._isReleased = true;
63353
63370
  }
63354
63371
  _clearAllCache() {
63355
- this._clearCacheOfContent();
63356
- this._clearCacheOfPosition();
63357
- }
63358
- _clearCacheOfContent() {
63359
- this._cacheViewSpec = undefined;
63360
- this._cacheActualTooltip = undefined;
63361
- }
63362
- _clearCacheOfPosition() {
63363
63372
  this._isTooltipPaused = false;
63364
63373
  this._isPointerEscaped = false;
63365
63374
  clearTimeout(this._cachePointerTimer);
@@ -63404,11 +63413,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
63404
63413
  _getPointerPositionRelativeToTooltipParent(params) {
63405
63414
  var _a, _b;
63406
63415
  let { canvasX: x, canvasY: y } = params.event;
63416
+ const { tooltipSpec } = params;
63407
63417
  const invalidPosition = {
63408
63418
  x: Infinity,
63409
63419
  y: Infinity
63410
63420
  };
63411
- const tooltipSpec = this._cacheViewSpec;
63412
63421
  const isCanvas = tooltipSpec.renderMode === 'canvas';
63413
63422
  const tooltipParentElement = this._getParentElement(tooltipSpec);
63414
63423
  let relativePosOffset = { x: 0, y: 0 };
@@ -64304,12 +64313,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
64304
64313
  Factory.registerComponentPlugin(plugin.type, plugin);
64305
64314
  };
64306
64315
 
64307
- class TooltipHandlerType {
64308
- }
64309
- TooltipHandlerType.dom = `${PREFIX}_TOOLTIP_HANDLER_DOM`;
64310
- TooltipHandlerType.canvas = `${PREFIX}_TOOLTIP_HANDLER_CANVAS`;
64311
- const TOOLTIP_EL_CLASS_NAME = 'vchart-tooltip-element';
64312
-
64313
64316
  class DomTooltipHandler extends BaseTooltipHandler {
64314
64317
  getVisibility() {
64315
64318
  var _a;
@@ -64362,15 +64365,16 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
64362
64365
  (_a = this.model) === null || _a === void 0 ? void 0 : _a.release();
64363
64366
  this._container = null;
64364
64367
  }
64365
- _updateTooltip(visible, params, actualTooltip) {
64366
- var _a, _b, _c;
64368
+ _updateTooltip(visible, params) {
64369
+ var _a, _b;
64370
+ const { tooltipActual, tooltipSpec } = params;
64367
64371
  if (!visible || !this.model) {
64368
64372
  this.setVisibility(visible);
64369
64373
  this._cacheCustomTooltipPosition = undefined;
64370
64374
  }
64371
64375
  else {
64372
64376
  if (!params.changePositionOnly) {
64373
- this._tooltipActual = actualTooltip;
64377
+ this._tooltipActual = tooltipActual;
64374
64378
  this._initStyle();
64375
64379
  const firstInit = !this.model.product;
64376
64380
  this.model.initAll();
@@ -64383,11 +64387,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
64383
64387
  this.setVisibility(visible);
64384
64388
  const el = this.model.product;
64385
64389
  if (el) {
64386
- const { x = 0, y = 0 } = (_a = actualTooltip.position) !== null && _a !== void 0 ? _a : {};
64387
- if ((_b = this._cacheViewSpec) === null || _b === void 0 ? void 0 : _b.updateElement) {
64388
- this._updatePosition((_c = this._cacheCustomTooltipPosition) !== null && _c !== void 0 ? _c : { x, y });
64389
- this._cacheViewSpec.updateElement(el, actualTooltip, params);
64390
- const position = this._getActualTooltipPosition(actualTooltip, params, {
64390
+ const { x = 0, y = 0 } = (_a = tooltipActual.position) !== null && _a !== void 0 ? _a : {};
64391
+ if (tooltipSpec.updateElement) {
64392
+ this._updatePosition((_b = this._cacheCustomTooltipPosition) !== null && _b !== void 0 ? _b : { x, y });
64393
+ tooltipSpec.updateElement(el, tooltipActual, params);
64394
+ const position = this._getActualTooltipPosition(tooltipActual, params, {
64391
64395
  width: el.offsetWidth,
64392
64396
  height: el.offsetHeight
64393
64397
  });
@@ -64422,7 +64426,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
64422
64426
  }
64423
64427
  _initEvent(el) {
64424
64428
  el.addEventListener('pointerleave', event => {
64425
- const { renderMode, enterable } = this._cacheViewSpec;
64429
+ const { renderMode, enterable } = this._component.getSpec();
64426
64430
  const relatedTarget = event.relatedTarget;
64427
64431
  if (renderMode === 'html' && enterable) {
64428
64432
  if (isNil$3(relatedTarget) ||
@@ -64475,7 +64479,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
64475
64479
  }
64476
64480
  this._attributes = null;
64477
64481
  }
64478
- _updateTooltip(visible, params, actualTooltip) {
64482
+ _updateTooltip(visible, params) {
64479
64483
  this._visible = visible;
64480
64484
  const stage = this._compiler.getStage();
64481
64485
  if (!stage) {
@@ -64493,7 +64497,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
64493
64497
  if (!this._tooltipComponent) {
64494
64498
  this._initTooltipComponent(stage);
64495
64499
  }
64496
- const pos = actualTooltip === null || actualTooltip === void 0 ? void 0 : actualTooltip.position;
64500
+ const { tooltipActual } = params;
64501
+ const pos = tooltipActual.position;
64497
64502
  if (!params.changePositionOnly) {
64498
64503
  this._tooltipComponent.setAttributes(Object.assign(Object.assign({}, this._attributes), pos));
64499
64504
  }
@@ -64522,7 +64527,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
64522
64527
  registerComponentPlugin(CanvasTooltipHandler);
64523
64528
  };
64524
64529
 
64525
- const version = "1.11.0-alpha.1";
64530
+ const version = "1.11.0-alpha.2";
64526
64531
 
64527
64532
  const addVChartProperty = (data, op) => {
64528
64533
  const context = op.beforeCall();
@@ -65066,6 +65071,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
65066
65071
  getRootMark() {
65067
65072
  return this._rootMark;
65068
65073
  }
65074
+ getSeriesMark() {
65075
+ return this._seriesMark;
65076
+ }
65069
65077
  getRawData() {
65070
65078
  return this._rawData;
65071
65079
  }
@@ -66972,8 +66980,15 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
66972
66980
  }
66973
66981
  initTooltip() {
66974
66982
  super.initTooltip();
66975
- this._lineMark && this._tooltipHelper.activeTriggerSet.dimension.add(this._lineMark);
66976
- this._symbolMark && this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark);
66983
+ const { dimension, group, mark } = this._tooltipHelper.activeTriggerSet;
66984
+ if (this._lineMark) {
66985
+ dimension.add(this._lineMark);
66986
+ group.add(this._lineMark);
66987
+ }
66988
+ if (this._symbolMark) {
66989
+ mark.add(this._symbolMark);
66990
+ group.add(this._symbolMark);
66991
+ }
66977
66992
  }
66978
66993
  initMarkStyle() {
66979
66994
  this.initLineMarkStyle(this._direction);
@@ -68967,9 +68982,19 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
68967
68982
  }
68968
68983
  initTooltip() {
68969
68984
  this._tooltipHelper = new AreaSeriesTooltipHelper(this);
68970
- this._areaMark && this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark);
68971
- this._lineMark && this._tooltipHelper.activeTriggerSet.dimension.add(this._lineMark);
68972
- this._symbolMark && this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark);
68985
+ const { dimension, group, mark } = this._tooltipHelper.activeTriggerSet;
68986
+ if (this._areaMark) {
68987
+ dimension.add(this._areaMark);
68988
+ group.add(this._areaMark);
68989
+ }
68990
+ if (this._lineMark) {
68991
+ dimension.add(this._lineMark);
68992
+ group.add(this._lineMark);
68993
+ }
68994
+ if (this._symbolMark) {
68995
+ mark.add(this._symbolMark);
68996
+ group.add(this._symbolMark);
68997
+ }
68973
68998
  }
68974
68999
  viewDataStatisticsUpdate(d) {
68975
69000
  super.viewDataStatisticsUpdate(d);
@@ -69308,7 +69333,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
69308
69333
  }
69309
69334
  initTooltip() {
69310
69335
  super.initTooltip();
69311
- this._barMark && this._tooltipHelper.activeTriggerSet.mark.add(this._barMark);
69336
+ const { mark, group } = this._tooltipHelper.activeTriggerSet;
69337
+ if (this._barMark) {
69338
+ mark.add(this._barMark);
69339
+ group.add(this._barMark);
69340
+ }
69312
69341
  }
69313
69342
  _statisticViewData() {
69314
69343
  var _a, _b;
@@ -73315,59 +73344,63 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
73315
73344
 
73316
73345
  class RangeAreaSeriesTooltipHelper extends BaseSeriesTooltipHelper {
73317
73346
  getDefaultTooltipPattern(activeType, dimensionInfo) {
73318
- if (activeType === 'mark') {
73319
- return {
73320
- visible: true,
73321
- activeType,
73322
- title: {
73323
- key: undefined,
73324
- value: this.titleValueCallback,
73325
- hasShape: false
73326
- },
73327
- content: [
73328
- {
73329
- key: this.contentKeyCallback,
73330
- value: this.contentValueCallback,
73331
- hasShape: true,
73332
- shapeType: this.contentShapeTypeCallback,
73333
- shapeColor: this.contentShapeColorCallback,
73334
- shapeStroke: this.contentShapeColorCallback,
73335
- shapeHollow: false
73336
- }
73337
- ]
73338
- };
73339
- }
73340
- else if (activeType === 'dimension' && dimensionInfo) {
73341
- const title = {
73342
- key: undefined,
73343
- value: this._getDimensionData,
73344
- hasShape: false
73345
- };
73346
- const content = [];
73347
- dimensionInfo.forEach(({ data }) => data.forEach(({ series }) => {
73348
- if (series.type === 'rangeArea') {
73349
- content.push({
73350
- seriesId: series.id,
73351
- key: this.contentKeyCallback,
73352
- value: (datum) => {
73353
- return this.series.getSpec().direction === "horizontal"
73354
- ? datum[this.series.getSpec().xField[0]] + '-' + datum[this.series.getSpec().xField[1]]
73355
- : datum[this.series.getSpec().yField[0]] + '-' + datum[this.series.getSpec().yField[1]];
73356
- },
73357
- hasShape: true,
73358
- shapeType: this.contentShapeTypeCallback,
73359
- shapeColor: this.contentShapeColorCallback,
73360
- shapeStroke: this.contentShapeColorCallback,
73361
- shapeHollow: false
73362
- });
73347
+ switch (activeType) {
73348
+ case 'mark':
73349
+ case 'group':
73350
+ return {
73351
+ visible: true,
73352
+ activeType,
73353
+ title: {
73354
+ key: undefined,
73355
+ value: this.titleValueCallback,
73356
+ hasShape: false
73357
+ },
73358
+ content: [
73359
+ {
73360
+ key: this.contentKeyCallback,
73361
+ value: this.contentValueCallback,
73362
+ hasShape: true,
73363
+ shapeType: this.contentShapeTypeCallback,
73364
+ shapeColor: this.contentShapeColorCallback,
73365
+ shapeStroke: this.contentShapeColorCallback,
73366
+ shapeHollow: false
73367
+ }
73368
+ ]
73369
+ };
73370
+ case 'dimension':
73371
+ if (dimensionInfo) {
73372
+ const title = {
73373
+ key: undefined,
73374
+ value: this._getDimensionData,
73375
+ hasShape: false
73376
+ };
73377
+ const content = [];
73378
+ dimensionInfo.forEach(({ data }) => data.forEach(({ series }) => {
73379
+ if (series.type === 'rangeArea') {
73380
+ content.push({
73381
+ seriesId: series.id,
73382
+ key: this.contentKeyCallback,
73383
+ value: (datum) => {
73384
+ return this.series.getSpec().direction === "horizontal"
73385
+ ? datum[this.series.getSpec().xField[0]] + '-' + datum[this.series.getSpec().xField[1]]
73386
+ : datum[this.series.getSpec().yField[0]] + '-' + datum[this.series.getSpec().yField[1]];
73387
+ },
73388
+ hasShape: true,
73389
+ shapeType: this.contentShapeTypeCallback,
73390
+ shapeColor: this.contentShapeColorCallback,
73391
+ shapeStroke: this.contentShapeColorCallback,
73392
+ shapeHollow: false
73393
+ });
73394
+ }
73395
+ }));
73396
+ return {
73397
+ visible: true,
73398
+ activeType,
73399
+ title,
73400
+ content
73401
+ };
73363
73402
  }
73364
- }));
73365
- return {
73366
- visible: true,
73367
- activeType,
73368
- title,
73369
- content
73370
- };
73403
+ break;
73371
73404
  }
73372
73405
  return null;
73373
73406
  }
@@ -74873,9 +74906,19 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
74873
74906
  }
74874
74907
  initTooltip() {
74875
74908
  super.initTooltip();
74876
- this._lineMark && this._tooltipHelper.activeTriggerSet.dimension.add(this._lineMark);
74877
- this._symbolMark && this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark);
74878
- this._areaMark && this._tooltipHelper.activeTriggerSet.dimension.add(this._areaMark);
74909
+ const { dimension, group, mark } = this._tooltipHelper.activeTriggerSet;
74910
+ if (this._lineMark) {
74911
+ dimension.add(this._lineMark);
74912
+ group.add(this._lineMark);
74913
+ }
74914
+ if (this._areaMark) {
74915
+ dimension.add(this._areaMark);
74916
+ group.add(this._areaMark);
74917
+ }
74918
+ if (this._symbolMark) {
74919
+ mark.add(this._symbolMark);
74920
+ group.add(this._symbolMark);
74921
+ }
74879
74922
  }
74880
74923
  initAnimation() {
74881
74924
  var _a, _b, _c, _d;
@@ -76178,12 +76221,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
76178
76221
  class LinearProgressSeriesTooltipHelper extends BaseSeriesTooltipHelper {
76179
76222
  getDefaultTooltipPattern(activeType, dimensionInfo) {
76180
76223
  const result = super.getDefaultTooltipPattern(activeType, dimensionInfo);
76181
- if (activeType === 'mark') {
76182
- return result;
76183
- }
76184
- if (activeType === 'dimension') {
76185
- result.visible = false;
76186
- return result;
76224
+ switch (activeType) {
76225
+ case 'mark':
76226
+ case 'group':
76227
+ return result;
76228
+ case 'dimension':
76229
+ result.visible = false;
76230
+ return result;
76187
76231
  }
76188
76232
  return null;
76189
76233
  }
@@ -81864,64 +81908,67 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
81864
81908
 
81865
81909
  class SankeySeriesTooltipHelper extends BaseSeriesTooltipHelper {
81866
81910
  getDefaultTooltipPattern(activeType, dimensionInfo) {
81867
- if (activeType === 'mark') {
81868
- return {
81869
- visible: true,
81870
- activeType,
81871
- title: {
81872
- key: undefined,
81873
- value: (datum) => {
81874
- if (datum.source) {
81875
- if (isNumber$3(datum.source)) {
81876
- const seriesKeys = this.series.getSeriesKeys();
81877
- return seriesKeys[datum.source] + ' => ' + seriesKeys[datum.target];
81878
- }
81879
- return datum.source + ' => ' + datum.target;
81880
- }
81881
- return datum.datum[this.series.getSpec().categoryField];
81882
- },
81883
- hasShape: false
81884
- },
81885
- content: [
81886
- {
81887
- key: this.contentKeyCallback,
81911
+ switch (activeType) {
81912
+ case 'mark':
81913
+ return {
81914
+ visible: true,
81915
+ activeType,
81916
+ title: {
81917
+ key: undefined,
81888
81918
  value: (datum) => {
81889
- return datum.value;
81919
+ if (datum.source) {
81920
+ if (isNumber$3(datum.source)) {
81921
+ const seriesKeys = this.series.getSeriesKeys();
81922
+ return seriesKeys[datum.source] + ' => ' + seriesKeys[datum.target];
81923
+ }
81924
+ return datum.source + ' => ' + datum.target;
81925
+ }
81926
+ return datum.datum[this.series.getSpec().categoryField];
81890
81927
  },
81891
- hasShape: true,
81892
- shapeType: this.contentShapeTypeCallback,
81893
- shapeColor: this.contentShapeColorCallback,
81894
- shapeStroke: this.contentShapeColorCallback,
81895
- shapeHollow: false
81896
- }
81897
- ]
81898
- };
81899
- }
81900
- else if (activeType === 'dimension' && dimensionInfo) {
81901
- const title = {
81902
- key: undefined,
81903
- value: this._getDimensionData,
81904
- hasShape: false
81905
- };
81906
- const content = [];
81907
- dimensionInfo.forEach(({ data }) => data.forEach(({ series }) => {
81908
- content.push({
81909
- seriesId: series.id,
81910
- key: this.contentKeyCallback,
81911
- value: this.contentValueCallback,
81912
- hasShape: true,
81913
- shapeType: this.contentShapeTypeCallback,
81914
- shapeColor: this.contentShapeColorCallback,
81915
- shapeStroke: this.contentShapeColorCallback,
81916
- shapeHollow: false
81917
- });
81918
- }));
81919
- return {
81920
- visible: true,
81921
- activeType,
81922
- title,
81923
- content
81924
- };
81928
+ hasShape: false
81929
+ },
81930
+ content: [
81931
+ {
81932
+ key: this.contentKeyCallback,
81933
+ value: (datum) => {
81934
+ return datum.value;
81935
+ },
81936
+ hasShape: true,
81937
+ shapeType: this.contentShapeTypeCallback,
81938
+ shapeColor: this.contentShapeColorCallback,
81939
+ shapeStroke: this.contentShapeColorCallback,
81940
+ shapeHollow: false
81941
+ }
81942
+ ]
81943
+ };
81944
+ case 'dimension':
81945
+ if (dimensionInfo) {
81946
+ const title = {
81947
+ key: undefined,
81948
+ value: this._getDimensionData,
81949
+ hasShape: false
81950
+ };
81951
+ const content = [];
81952
+ dimensionInfo.forEach(({ data }) => data.forEach(({ series }) => {
81953
+ content.push({
81954
+ seriesId: series.id,
81955
+ key: this.contentKeyCallback,
81956
+ value: this.contentValueCallback,
81957
+ hasShape: true,
81958
+ shapeType: this.contentShapeTypeCallback,
81959
+ shapeColor: this.contentShapeColorCallback,
81960
+ shapeStroke: this.contentShapeColorCallback,
81961
+ shapeHollow: false
81962
+ });
81963
+ }));
81964
+ return {
81965
+ visible: true,
81966
+ activeType,
81967
+ title,
81968
+ content
81969
+ };
81970
+ }
81971
+ break;
81925
81972
  }
81926
81973
  return null;
81927
81974
  }
@@ -84569,372 +84616,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
84569
84616
  registerCorrelationAnimation();
84570
84617
  };
84571
84618
 
84572
- const Appear_Wave = {
84573
- duration: 2000,
84574
- loop: true,
84575
- channel: {
84576
- wave: { from: 0, to: 1 }
84577
- }
84578
- };
84579
- const Appear_Grow = (params) => {
84580
- return {
84581
- duration: 2000,
84582
- channel: {
84583
- wave: { from: 0, to: 1 },
84584
- height: params.height,
84585
- y: params.y
84586
- }
84587
- };
84588
- };
84589
- const Appear_WaveGrow = (params) => {
84590
- return {
84591
- duration: 2000,
84592
- channel: {
84593
- wave: { from: 0, to: 1 },
84594
- height: params.height,
84595
- y: params.y
84596
- }
84597
- };
84598
- };
84599
- function liquidPresetAnimation(params, preset) {
84600
- switch (preset) {
84601
- case 'wave':
84602
- return Appear_Wave;
84603
- case 'grow':
84604
- return Appear_Grow(params);
84605
- case 'waveGrow':
84606
- return Appear_WaveGrow(params);
84607
- default:
84608
- return Appear_Wave;
84609
- }
84610
- }
84611
- const registerLiquidAnimation = () => {
84612
- Factory.registerAnimation('liquid', (params, preset) => {
84613
- return {
84614
- appear: liquidPresetAnimation(params, preset),
84615
- enter: liquidPresetAnimation(params, preset),
84616
- exit: liquidPresetAnimation(params, preset)
84617
- };
84618
- });
84619
- };
84620
-
84621
- const WAVE_GLYPH_TYPE = 'wave';
84622
- class LiquidMark extends BaseMark {
84623
- constructor() {
84624
- super(...arguments);
84625
- this.type = LiquidMark.type;
84626
- }
84627
- _getDefaultStyle() {
84628
- const defaultStyle = Object.assign(Object.assign({}, super._getDefaultStyle()), { wave: 0 });
84629
- return defaultStyle;
84630
- }
84631
- _initProduct(group) {
84632
- const view = this.getVGrammarView();
84633
- const id = this.getProductId();
84634
- this._product = view.glyph(WAVE_GLYPH_TYPE, group !== null && group !== void 0 ? group : view.rootMark).id(id);
84635
- this._compiledProductId = id;
84636
- }
84637
- }
84638
- LiquidMark.type = "liquid";
84639
- const registerLiquidMark = () => {
84640
- Factory.registerMark(LiquidMark.type, LiquidMark);
84641
- registerWaveGlyph();
84642
- };
84643
-
84644
- const getShapes = (shapesType, size) => {
84645
- if (shapesType === 'drop') {
84646
- return pin(0, 0, size / 2);
84647
- }
84648
- return shapesType;
84649
- };
84650
- function pin(x, y, radius) {
84651
- const w = (radius * 4) / 3;
84652
- const h = Math.max(w, radius * 2);
84653
- const r = w / 2;
84654
- const cx = x;
84655
- const cy = r + y - h / 2;
84656
- const theta = Math.asin(r / ((h - r) * 0.85));
84657
- const dy = Math.sin(theta) * r;
84658
- const dx = Math.cos(theta) * r;
84659
- const x0 = cx - dx;
84660
- const y0 = cy + dy;
84661
- const cpX = x;
84662
- const cpY = cy + r / Math.sin(theta);
84663
- return `
84664
- M ${x0} ${y0}
84665
- A ${r} ${r} 0 1 1 ${x0 + dx * 2} ${y0}
84666
- Q ${cpX} ${cpY} ${x} ${y + h / 2}
84667
- Q ${cpX} ${cpY} ${x0} ${y0}
84668
- Z
84669
- `;
84670
- }
84671
-
84672
- class LiquidSeriesTooltipHelper extends BaseSeriesTooltipHelper {
84673
- constructor() {
84674
- super(...arguments);
84675
- this.getContentKey = () => (datum) => {
84676
- return this.series.getValueField();
84677
- };
84678
- this.getContentValue = () => (datum) => {
84679
- const valueField = this.series.getValueField();
84680
- return datum[valueField];
84681
- };
84682
- this.getLiquidFillColor = (datum) => {
84683
- return this.series.getMarkInName('liquid').getAttribute('fill', datum);
84684
- };
84685
- }
84686
- getDefaultTooltipPattern(activeType) {
84687
- return {
84688
- visible: true,
84689
- activeType,
84690
- title: {
84691
- key: undefined,
84692
- value: this.titleValueCallback,
84693
- hasShape: false
84694
- },
84695
- content: [
84696
- {
84697
- key: this.getContentKey(),
84698
- value: this.getContentValue(),
84699
- hasShape: true,
84700
- shapeType: this.contentShapeTypeCallback,
84701
- shapeColor: this.getLiquidFillColor,
84702
- shapeStroke: this.getLiquidFillColor,
84703
- shapeHollow: false
84704
- }
84705
- ]
84706
- };
84707
- }
84708
- }
84709
-
84710
- class LiquidSeries extends BaseSeries {
84711
- constructor() {
84712
- super(...arguments);
84713
- this.type = exports.SeriesTypeEnum.liquid;
84714
- this.transformerConstructor = LineLikeSeriesSpecTransformer;
84715
- this._liquidBackgroundMark = null;
84716
- this._liquidOutlineMark = null;
84717
- }
84718
- setValueField(field) {
84719
- if (isValid$3(field)) {
84720
- this._valueField = field;
84721
- }
84722
- }
84723
- getValueField() {
84724
- return this._valueField;
84725
- }
84726
- setAttrFromSpec() {
84727
- super.setAttrFromSpec();
84728
- this._marginSpec = normalizeLayoutPaddingSpec(this._spec.outlineMargin);
84729
- this._paddingSpec = normalizeLayoutPaddingSpec(this._spec.outlinePadding);
84730
- this.setValueField(this._spec.valueField);
84731
- }
84732
- rawDataUpdate(d) {
84733
- super.rawDataUpdate(d);
84734
- this._heightRatio = max$1(...this._data.getLatestData().map((d) => d[this._valueField]));
84735
- }
84736
- initMark() {
84737
- this._initLiquidOutlineMark();
84738
- this._initLiquidBackgroundMark();
84739
- this._initLiquidMark();
84740
- }
84741
- initMarkStyle() {
84742
- this._initLiquidOutlineMarkStyle();
84743
- this._initLiquidBackgroundMarkStyle();
84744
- this._initLiquidMarkStyle();
84745
- }
84746
- _initLiquidOutlineMark() {
84747
- this._liquidOutlineMark = this._createMark(LiquidSeries.mark.liquidOutline, {
84748
- isSeriesMark: true,
84749
- skipBeforeLayouted: false
84750
- });
84751
- return this._liquidOutlineMark;
84752
- }
84753
- _initLiquidBackgroundMark() {
84754
- this._liquidBackgroundMark = this._createMark(LiquidSeries.mark.liquidBackground, {
84755
- isSeriesMark: true,
84756
- skipBeforeLayouted: false
84757
- });
84758
- return this._liquidBackgroundMark;
84759
- }
84760
- _initLiquidMark() {
84761
- this._liquidMark = this._createMark(LiquidSeries.mark.liquid, {
84762
- parent: this._liquidBackgroundMark,
84763
- isSeriesMark: true,
84764
- skipBeforeLayouted: false
84765
- });
84766
- return this._liquidMark;
84767
- }
84768
- _getPosAndSizeFormRegion(isOutline = false) {
84769
- const { top: marginTop = 0, bottom: marginBottom = 0, left: marginLeft = 0, right: marginRight = 0 } = this._marginSpec;
84770
- const { top: paddingTop = 0, bottom: paddingBottom = 0, left: paddingLeft = 0, right: paddingRight = 0 } = this._paddingSpec;
84771
- const { width: regionWidth, height: regionHeight } = this._region.getLayoutRect();
84772
- if (!isOutline) {
84773
- return {
84774
- x: regionWidth / 2 + (marginLeft + paddingRight - (marginRight + paddingRight)) / 2,
84775
- y: regionHeight / 2 + (marginTop + paddingTop - (marginBottom + paddingBottom)) / 2,
84776
- size: Math.min(regionWidth - (marginLeft + marginRight + paddingLeft + paddingRight), regionHeight - (marginTop + marginBottom + paddingTop + paddingBottom))
84777
- };
84778
- }
84779
- return {
84780
- x: regionWidth / 2 + (marginLeft - marginRight) / 2,
84781
- y: regionHeight / 2 + (marginTop - marginBottom) / 2,
84782
- size: Math.min(regionWidth - (marginLeft + marginRight), regionHeight - (marginTop + marginBottom))
84783
- };
84784
- }
84785
- _initLiquidOutlineMarkStyle() {
84786
- const liquidOutlineMark = this._liquidOutlineMark;
84787
- liquidOutlineMark.setZIndex(this.layoutZIndex);
84788
- liquidOutlineMark.created();
84789
- this.setMarkStyle(liquidOutlineMark, {
84790
- stroke: this.getColorAttribute(),
84791
- x: () => this._getPosAndSizeFormRegion(true).x,
84792
- y: () => this._getPosAndSizeFormRegion(true).y,
84793
- size: () => this._getPosAndSizeFormRegion(true).size,
84794
- symbolType: () => { var _a; return getShapes((_a = this._spec.maskShape) !== null && _a !== void 0 ? _a : 'circle', this._getPosAndSizeFormRegion(true).size); }
84795
- }, 'normal', exports.AttributeLevel.Series);
84796
- this._liquidOutlineMark.setInteractive(false);
84797
- }
84798
- _initLiquidBackgroundMarkStyle() {
84799
- const liquidBackgroundMark = this._liquidBackgroundMark;
84800
- liquidBackgroundMark.setZIndex(this.layoutZIndex);
84801
- liquidBackgroundMark.created();
84802
- this.setMarkStyle(liquidBackgroundMark, {
84803
- clip: true,
84804
- width: () => this._region.getLayoutRect().width,
84805
- height: () => this._region.getLayoutRect().height,
84806
- path: () => {
84807
- var _a;
84808
- const { x, y, size } = this._getPosAndSizeFormRegion();
84809
- const symbolPath = createSymbol({
84810
- x,
84811
- y,
84812
- size,
84813
- symbolType: getShapes((_a = this._spec.maskShape) !== null && _a !== void 0 ? _a : 'circle', size),
84814
- fill: true
84815
- });
84816
- return [symbolPath];
84817
- }
84818
- }, 'normal', exports.AttributeLevel.Series);
84819
- this._liquidBackgroundMark.setInteractive(false);
84820
- }
84821
- _initLiquidMarkStyle() {
84822
- const liquidMark = this._liquidMark;
84823
- if (liquidMark) {
84824
- this.setMarkStyle(liquidMark, {
84825
- dx: () => {
84826
- return this._region.getLayoutStartPoint().x + this._region.getLayoutRect().width / 2;
84827
- },
84828
- y: () => {
84829
- const { y: liquidBackY, size: liquidBackSize } = this._getPosAndSizeFormRegion();
84830
- return liquidBackY - liquidBackSize / 2 + liquidBackSize - liquidBackSize * this._heightRatio;
84831
- },
84832
- height: () => {
84833
- const { size: liquidBackSize } = this._getPosAndSizeFormRegion();
84834
- return liquidBackSize * this._heightRatio;
84835
- },
84836
- fill: this.getColorAttribute(),
84837
- wave: 0
84838
- }, 'normal', exports.AttributeLevel.Series);
84839
- }
84840
- }
84841
- initTooltip() {
84842
- this._tooltipHelper = new LiquidSeriesTooltipHelper(this);
84843
- this._liquidMark && this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark);
84844
- }
84845
- initInteraction() {
84846
- this._parseInteractionConfig(this._liquidMark ? [this._liquidMark] : []);
84847
- }
84848
- initAnimation() {
84849
- var _a, _b, _c;
84850
- const animationParams = {
84851
- y: {
84852
- from: () => {
84853
- const { y: liquidBackY, size: liquidBackSize } = this._getPosAndSizeFormRegion();
84854
- return liquidBackY - liquidBackSize / 2 + liquidBackSize;
84855
- },
84856
- to: () => {
84857
- const { y: liquidBackY, size: liquidBackSize } = this._getPosAndSizeFormRegion();
84858
- return liquidBackY - liquidBackSize / 2 + liquidBackSize - liquidBackSize * this._heightRatio;
84859
- }
84860
- },
84861
- height: {
84862
- from: 0,
84863
- to: () => {
84864
- const { size: liquidBackSize } = this._getPosAndSizeFormRegion();
84865
- return liquidBackSize * this._heightRatio;
84866
- }
84867
- }
84868
- };
84869
- const appearPreset = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.animationAppear) === null || _b === void 0 ? void 0 : _b.preset;
84870
- this._liquidMark.setAnimationConfig(animationConfig((_c = Factory.getAnimationInKey('liquid')) === null || _c === void 0 ? void 0 : _c(animationParams, appearPreset), userAnimationConfig("liquid", this._spec, this._markAttributeContext)));
84871
- }
84872
- initEvent() {
84873
- super.initEvent();
84874
- if (!this._spec.indicatorSmartInvert || !this._option.getChart().getComponentsByKey('indicator')) {
84875
- return;
84876
- }
84877
- this.event.on(exports.ChartEvent.renderFinished, () => {
84878
- this._option
84879
- .getChart()
84880
- .getComponentsByKey('indicator')
84881
- .forEach((indicatorComponent) => {
84882
- var _a, _b;
84883
- const grammarMark = this._liquidMark.getProduct();
84884
- const waveItem = grammarMark.elements[0].glyphGraphicItems.wave1;
84885
- let { y1: waveY1, y2: waveY2 } = waveItem.globalAABBBounds;
84886
- waveY1 += this._region.getLayoutStartPoint().y;
84887
- waveY2 += this._region.getLayoutStartPoint().y;
84888
- (_b = (_a = indicatorComponent === null || indicatorComponent === void 0 ? void 0 : indicatorComponent.getIndicatorComponent()) === null || _a === void 0 ? void 0 : _a.getChildren()[0]) === null || _b === void 0 ? void 0 : _b.getChildren().forEach((text) => {
84889
- const { y1: textY1, y2: textY2 } = text.globalAABBBounds;
84890
- if (waveY1 < textY1 && waveY2 > textY2) {
84891
- const foregroundColor = text.attribute.fill;
84892
- const backgroundColor = waveItem.attribute.fill;
84893
- const invertColor = labelSmartInvert(foregroundColor, backgroundColor);
84894
- text.setAttribute('fill', invertColor);
84895
- }
84896
- });
84897
- });
84898
- });
84899
- }
84900
- dataToPosition(data) {
84901
- return null;
84902
- }
84903
- dataToPositionX(data) {
84904
- return null;
84905
- }
84906
- dataToPositionY(data) {
84907
- return null;
84908
- }
84909
- valueToPosition(value1, value2) {
84910
- return null;
84911
- }
84912
- getStatisticFields() {
84913
- return [];
84914
- }
84915
- getGroupFields() {
84916
- return [];
84917
- }
84918
- getStackGroupFields() {
84919
- return [];
84920
- }
84921
- getStackValueField() {
84922
- return '';
84923
- }
84924
- getActiveMarks() {
84925
- return [this._liquidMark];
84926
- }
84927
- }
84928
- LiquidSeries.type = exports.SeriesTypeEnum.liquid;
84929
- LiquidSeries.mark = LiquidSeriesMark;
84930
- LiquidSeries.transformerConstructor = LineLikeSeriesSpecTransformer;
84931
- const registerLiquidSeries = () => {
84932
- registerLiquidMark();
84933
- registerGroupMark();
84934
- registerLiquidAnimation();
84935
- Factory.registerSeries(LiquidSeries.type, LiquidSeries);
84936
- };
84937
-
84938
84619
  class MapChartSpecTransformer extends BaseChartSpecTransformer {
84939
84620
  _isValidSeries(type) {
84940
84621
  return type === exports.SeriesTypeEnum.map;
@@ -89667,10 +89348,35 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
89667
89348
  class BaseTooltipProcessor {
89668
89349
  constructor(component) {
89669
89350
  this._showTooltipByHandler = (data, params) => {
89670
- var _a, _b;
89351
+ var _a, _b, _c;
89352
+ if (isNil$3(data)) {
89353
+ return 1;
89354
+ }
89355
+ if (!params.changePositionOnly) {
89356
+ this.clearCache();
89357
+ }
89358
+ this._updateViewSpec(params);
89359
+ const spec = this._cacheViewSpec;
89360
+ if (isNil$3(spec === null || spec === void 0 ? void 0 : spec[this.activeType]) || spec.visible === false) {
89361
+ return 1;
89362
+ }
89363
+ params.tooltipSpec = spec;
89364
+ this._updateActualTooltip(data, params);
89365
+ params.tooltipActual = this._cacheActualTooltip;
89671
89366
  this.component.event.emit(exports.ChartEvent.tooltipShow, Object.assign(Object.assign({}, params), { tooltipData: data, activeType: this.activeType, tooltip: this.component }));
89672
- if (((_a = this.component.tooltipHandler) === null || _a === void 0 ? void 0 : _a.showTooltip) && isValid$3(data)) {
89673
- return (_b = this.component.tooltipHandler.showTooltip(this.activeType, data, params)) !== null && _b !== void 0 ? _b : 0;
89367
+ const { title, content } = this._cacheActualTooltip;
89368
+ if (isNil$3(title === null || title === void 0 ? void 0 : title.key) && isNil$3(title === null || title === void 0 ? void 0 : title.value) && !(content === null || content === void 0 ? void 0 : content.length)) {
89369
+ return 1;
89370
+ }
89371
+ let showTooltip;
89372
+ if ((_a = spec.handler) === null || _a === void 0 ? void 0 : _a.showTooltip) {
89373
+ showTooltip = spec.handler.showTooltip.bind(spec.handler);
89374
+ }
89375
+ else if ((_b = this.component.tooltipHandler) === null || _b === void 0 ? void 0 : _b.showTooltip) {
89376
+ showTooltip = this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler);
89377
+ }
89378
+ if (showTooltip) {
89379
+ return (_c = showTooltip(this.activeType, data, params)) !== null && _c !== void 0 ? _c : 0;
89674
89380
  }
89675
89381
  return 1;
89676
89382
  };
@@ -89746,6 +89452,29 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
89746
89452
  }
89747
89453
  return targetDimensionInfo;
89748
89454
  }
89455
+ _updateViewSpec(params) {
89456
+ const { changePositionOnly, model, dimensionInfo } = params;
89457
+ if (!changePositionOnly || !this._cacheViewSpec) {
89458
+ this._cacheViewSpec = getTooltipSpecForShow(this.activeType, this.component.getSpec(), model, dimensionInfo);
89459
+ }
89460
+ }
89461
+ _updateActualTooltip(data, params) {
89462
+ var _a, _b, _c, _d;
89463
+ const pattern = this._cacheViewSpec[this.activeType];
89464
+ const { changePositionOnly } = params;
89465
+ if (!changePositionOnly || !this._cacheActualTooltip) {
89466
+ const tooltipContent = getShowContent(pattern, data, params);
89467
+ const visible = isValid$3(tooltipContent) ? getTooltipPatternValue(pattern.visible, data, params) !== false : false;
89468
+ this._cacheActualTooltip = Object.assign(Object.assign({}, tooltipContent), { visible, activeType: pattern.activeType, data });
89469
+ const { title, content } = this._cacheActualTooltip;
89470
+ this._cacheActualTooltip.title = (_b = (_a = pattern.updateTitle) === null || _a === void 0 ? void 0 : _a.call(pattern, title, data, params)) !== null && _b !== void 0 ? _b : title;
89471
+ this._cacheActualTooltip.content = (_d = (_c = pattern.updateContent) === null || _c === void 0 ? void 0 : _c.call(pattern, content, data, params)) !== null && _d !== void 0 ? _d : content;
89472
+ }
89473
+ }
89474
+ clearCache() {
89475
+ this._cacheViewSpec = undefined;
89476
+ this._cacheActualTooltip = undefined;
89477
+ }
89749
89478
  }
89750
89479
 
89751
89480
  class DimensionTooltipProcessor extends BaseTooltipProcessor {
@@ -89783,9 +89512,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
89783
89512
  }
89784
89513
  }
89785
89514
 
89786
- const isMarkInfo = (info) => isValid$3(info) && !isArray$3(info);
89787
- const isDimensionInfo = (info) => isValid$3(info) && isArray$3(info);
89788
-
89789
89515
  class MarkTooltipProcessor extends BaseTooltipProcessor {
89790
89516
  constructor() {
89791
89517
  super(...arguments);
@@ -89809,7 +89535,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
89809
89535
  }
89810
89536
  return true;
89811
89537
  }
89812
- getMouseEventData(params) {
89538
+ getMouseEventData(params, dimensionInfo) {
89813
89539
  var _a;
89814
89540
  let info;
89815
89541
  let ignore;
@@ -89823,7 +89549,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
89823
89549
  mark: params.mark,
89824
89550
  datum: params.datum,
89825
89551
  series,
89826
- dimensionInfo: this._getDimensionInfo(params)
89552
+ dimensionInfo
89827
89553
  };
89828
89554
  }
89829
89555
  else if ((ignoreTriggers === null || ignoreTriggers === void 0 ? void 0 : ignoreTriggers.has(params.model)) || (ignoreTriggers === null || ignoreTriggers === void 0 ? void 0 : ignoreTriggers.has(params.mark))) {
@@ -89837,6 +89563,78 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
89837
89563
  }
89838
89564
  }
89839
89565
 
89566
+ class GroupTooltipProcessor extends BaseTooltipProcessor {
89567
+ constructor() {
89568
+ super(...arguments);
89569
+ this.activeType = 'group';
89570
+ }
89571
+ showTooltip(info, params, changePositionOnly) {
89572
+ const { datum, series, dimensionInfo } = info;
89573
+ const tooltipData = [{ datum: array(datum), series }];
89574
+ const newParams = Object.assign(Object.assign({}, params), { groupDatum: this._getGroupDatum(params), dimensionInfo: this._preprocessDimensionInfo(dimensionInfo), changePositionOnly, tooltip: this.component });
89575
+ return this._showTooltipByHandler(tooltipData, newParams);
89576
+ }
89577
+ shouldHandleTooltip(params, mouseEventData) {
89578
+ var _a;
89579
+ const { tooltipInfo: info } = mouseEventData;
89580
+ if (isNil$3(info)) {
89581
+ return false;
89582
+ }
89583
+ const helper = (_a = params.model) === null || _a === void 0 ? void 0 : _a.tooltipHelper;
89584
+ if (!(helper === null || helper === void 0 ? void 0 : helper.activeType.includes('group'))) {
89585
+ return false;
89586
+ }
89587
+ return true;
89588
+ }
89589
+ getMouseEventData(params, dimensionInfo) {
89590
+ var _a, _b;
89591
+ let info;
89592
+ let ignore;
89593
+ if (((_a = params.model) === null || _a === void 0 ? void 0 : _a.modelType) === 'series') {
89594
+ const series = params.model;
89595
+ const helper = series.tooltipHelper;
89596
+ const activeTriggers = helper === null || helper === void 0 ? void 0 : helper.activeTriggerSet.group;
89597
+ const ignoreTriggers = helper === null || helper === void 0 ? void 0 : helper.ignoreTriggerSet.group;
89598
+ if ((activeTriggers === null || activeTriggers === void 0 ? void 0 : activeTriggers.has(params.model)) || (activeTriggers === null || activeTriggers === void 0 ? void 0 : activeTriggers.has(params.mark))) {
89599
+ const patternSpec = this.component.getSpec()[this.activeType];
89600
+ const triggerMark = (patternSpec === null || patternSpec === void 0 ? void 0 : patternSpec.triggerMark) ? array(patternSpec.triggerMark) : [];
89601
+ if (triggerMark.includes((_b = params.mark) === null || _b === void 0 ? void 0 : _b.name)) {
89602
+ info = {
89603
+ mark: params.mark,
89604
+ datum: params.datum,
89605
+ series,
89606
+ dimensionInfo
89607
+ };
89608
+ }
89609
+ }
89610
+ else if ((ignoreTriggers === null || ignoreTriggers === void 0 ? void 0 : ignoreTriggers.has(params.model)) || (ignoreTriggers === null || ignoreTriggers === void 0 ? void 0 : ignoreTriggers.has(params.mark))) {
89611
+ ignore = true;
89612
+ }
89613
+ }
89614
+ return {
89615
+ tooltipInfo: info,
89616
+ ignore
89617
+ };
89618
+ }
89619
+ _getGroupDatum(params) {
89620
+ const { model, mark, datum } = params;
89621
+ const series = model;
89622
+ if (['line', 'area'].includes(mark.type)) {
89623
+ return array(datum);
89624
+ }
89625
+ const datumList = series.getViewData().latestData;
89626
+ const seriesField = series.getSeriesField();
89627
+ if (!seriesField) {
89628
+ return datumList;
89629
+ }
89630
+ const seriesFieldValue = array(datum)[0][seriesField];
89631
+ return datumList.filter((d) => d[seriesField] === seriesFieldValue);
89632
+ }
89633
+ }
89634
+
89635
+ const isMarkInfo = (info) => isValid$3(info) && !isArray$3(info);
89636
+ const isDimensionInfo = (info) => isValid$3(info) && isArray$3(info);
89637
+
89840
89638
  class TooltipSpecTransformer extends BaseComponentSpecTransformer {
89841
89639
  _shouldMergeThemeToSpec() {
89842
89640
  return false;
@@ -89922,6 +89720,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
89922
89720
  this._hideTooltipByHandler(Object.assign(Object.assign({}, params), { tooltip: this }));
89923
89721
  this._cacheInfo = undefined;
89924
89722
  this._cacheParams = undefined;
89723
+ this._cacheActiveType = undefined;
89925
89724
  }
89926
89725
  };
89927
89726
  this._getMouseMoveHandler = (isClick) => (params) => {
@@ -89942,24 +89741,30 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
89942
89741
  }
89943
89742
  const mouseEventData = this._getMouseEventData(params);
89944
89743
  const { tooltipInfo: { dimension: dimensionInfo }, ignore: { mark: ignoreMark, dimension: ignoreDimension } } = mouseEventData;
89945
- let markTooltipSuccess = false;
89946
- let dimensionTooltipSuccess = false;
89947
- markTooltipSuccess = this._showTooltipByMouseEvent('mark', mouseEventData, params, isClick);
89948
- if (!markTooltipSuccess) {
89949
- dimensionTooltipSuccess = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick);
89744
+ const success = {
89745
+ mark: false,
89746
+ dimension: false,
89747
+ group: false
89748
+ };
89749
+ success.group = this._showTooltipByMouseEvent('group', mouseEventData, params, isClick);
89750
+ if (!success.group) {
89751
+ success.mark = this._showTooltipByMouseEvent('mark', mouseEventData, params, isClick);
89950
89752
  }
89951
- if (!markTooltipSuccess && !dimensionTooltipSuccess && !isEmptyPos(params)) {
89753
+ if (!success.mark && !success.group) {
89754
+ success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick);
89755
+ }
89756
+ if (Object.values(success).every(val => !val) && !isEmptyPos(params)) {
89952
89757
  if (ignoreMark && isMarkInfo(this._cacheInfo)) {
89953
- markTooltipSuccess = this._showTooltipByMouseEvent('mark', mouseEventData, params, isClick, true);
89758
+ success.mark = this._showTooltipByMouseEvent('mark', mouseEventData, params, isClick, true);
89954
89759
  }
89955
89760
  else if (ignoreDimension && isDimensionInfo(this._cacheInfo)) {
89956
- dimensionTooltipSuccess = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick, true);
89761
+ success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick, true);
89957
89762
  }
89958
89763
  else if (isValid$3(dimensionInfo)) {
89959
- dimensionTooltipSuccess = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick);
89764
+ success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick);
89960
89765
  }
89961
89766
  }
89962
- if (!markTooltipSuccess && (!dimensionTooltipSuccess || isNil$3(dimensionInfo))) {
89767
+ if (!success.mark && !success.group && (!success.dimension || isNil$3(dimensionInfo))) {
89963
89768
  this._handleChartMouseOut(params);
89964
89769
  if (isClick && this._clickLock) {
89965
89770
  this._clickLock = false;
@@ -89981,11 +89786,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
89981
89786
  }
89982
89787
  else {
89983
89788
  const tooltipInfo = mouseEventData.tooltipInfo[activeType];
89984
- const isSameAsCache = this._isSameAsCache(tooltipInfo, params);
89789
+ const isSameAsCache = this._isSameAsCache(tooltipInfo, params, activeType);
89985
89790
  success = !processor.showTooltip(tooltipInfo, params, isSameAsCache);
89986
89791
  if (success) {
89987
89792
  this._cacheInfo = tooltipInfo;
89988
89793
  this._cacheParams = params;
89794
+ this._cacheActiveType = activeType;
89989
89795
  }
89990
89796
  }
89991
89797
  if (success) {
@@ -90005,21 +89811,38 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90005
89811
  tooltipInfo: {},
90006
89812
  ignore: {}
90007
89813
  };
90008
- Object.keys(this._processor).forEach(activeType => {
90009
- const { tooltipInfo, ignore } = this._processor[activeType].getMouseEventData(params);
90010
- result.tooltipInfo[activeType] = tooltipInfo;
90011
- result.ignore[activeType] = ignore;
90012
- });
89814
+ let activeType = 'dimension';
89815
+ const { tooltipInfo, ignore } = this._processor[activeType].getMouseEventData(params);
89816
+ result.tooltipInfo[activeType] = tooltipInfo;
89817
+ result.ignore[activeType] = ignore;
89818
+ const dimensionInfo = tooltipInfo;
89819
+ for (activeType of Object.keys(this._processor)) {
89820
+ if (activeType !== 'dimension') {
89821
+ const { tooltipInfo, ignore } = this._processor[activeType].getMouseEventData(params, dimensionInfo);
89822
+ result.tooltipInfo[activeType] = tooltipInfo;
89823
+ result.ignore[activeType] = ignore;
89824
+ }
89825
+ }
90013
89826
  return result;
90014
89827
  };
90015
89828
  this._hideTooltipByHandler = (params) => {
90016
- var _a, _b, _c;
89829
+ var _a, _b, _c, _d;
90017
89830
  if (!this._isTooltipShown && !((_b = (_a = this.tooltipHandler) === null || _a === void 0 ? void 0 : _a.isTooltipShown) === null || _b === void 0 ? void 0 : _b.call(_a))) {
90018
89831
  return 0;
90019
89832
  }
90020
89833
  this.event.emit(exports.ChartEvent.tooltipHide, Object.assign(Object.assign({}, params), { source: exports.Event_Source_Type.chart, tooltip: this }));
90021
- if ((_c = this.tooltipHandler) === null || _c === void 0 ? void 0 : _c.hideTooltip) {
90022
- const result = this.tooltipHandler.hideTooltip(params);
89834
+ Object.values(this._processor).forEach((processor) => {
89835
+ processor.clearCache();
89836
+ });
89837
+ let hideTooltip;
89838
+ if ((_c = this._spec.handler) === null || _c === void 0 ? void 0 : _c.hideTooltip) {
89839
+ hideTooltip = this._spec.handler.hideTooltip.bind(this._spec.handler);
89840
+ }
89841
+ else if ((_d = this.tooltipHandler) === null || _d === void 0 ? void 0 : _d.hideTooltip) {
89842
+ hideTooltip = this.tooltipHandler.hideTooltip.bind(this.tooltipHandler);
89843
+ }
89844
+ if (hideTooltip) {
89845
+ const result = hideTooltip(params);
90023
89846
  if (!result) {
90024
89847
  this._isTooltipShown = false;
90025
89848
  }
@@ -90117,7 +89940,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90117
89940
  _initProcessor() {
90118
89941
  this._processor = {
90119
89942
  mark: new MarkTooltipProcessor(this),
90120
- dimension: new DimensionTooltipProcessor(this)
89943
+ dimension: new DimensionTooltipProcessor(this),
89944
+ group: new GroupTooltipProcessor(this)
90121
89945
  };
90122
89946
  }
90123
89947
  _initEvent() {
@@ -90178,7 +90002,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90178
90002
  this._alwaysShow = false;
90179
90003
  return !this._hideTooltipByHandler(params);
90180
90004
  }
90181
- _isSameAsCache(nextInfo, nextParams) {
90005
+ _isSameAsCache(nextInfo, nextParams, nextActiveType) {
90006
+ if (nextActiveType !== this._cacheActiveType) {
90007
+ return false;
90008
+ }
90182
90009
  if (nextInfo === this._cacheInfo) {
90183
90010
  return true;
90184
90011
  }
@@ -95108,11 +94935,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
95108
94935
  var _a;
95109
94936
  const series = this._getSeries();
95110
94937
  if ((_a = series.getSpec().totalLabel) === null || _a === void 0 ? void 0 : _a.visible) {
95111
- const mark = series.getMarkInName(series.type);
95112
- const textMark = this._createMark({ type: "label", name: `${mark.name}-total-label` });
95113
- this._baseMark = mark;
95114
- this._textMark = textMark;
95115
- this._initTextMarkStyle();
94938
+ const mark = series.getSeriesMark();
94939
+ if (mark) {
94940
+ const textMark = this._createMark({ type: "label", name: `${mark.name}-total-label` });
94941
+ this._baseMark = mark;
94942
+ this._textMark = textMark;
94943
+ this._initTextMarkStyle();
94944
+ }
95116
94945
  }
95117
94946
  }
95118
94947
  _initTextMarkStyle() {
@@ -97124,6 +96953,372 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
97124
96953
  }
97125
96954
  }
97126
96955
 
96956
+ const Appear_Wave = {
96957
+ duration: 2000,
96958
+ loop: true,
96959
+ channel: {
96960
+ wave: { from: 0, to: 1 }
96961
+ }
96962
+ };
96963
+ const Appear_Grow = (params) => {
96964
+ return {
96965
+ duration: 2000,
96966
+ channel: {
96967
+ wave: { from: 0, to: 1 },
96968
+ height: params.height,
96969
+ y: params.y
96970
+ }
96971
+ };
96972
+ };
96973
+ const Appear_WaveGrow = (params) => {
96974
+ return {
96975
+ duration: 2000,
96976
+ channel: {
96977
+ wave: { from: 0, to: 1 },
96978
+ height: params.height,
96979
+ y: params.y
96980
+ }
96981
+ };
96982
+ };
96983
+ function liquidPresetAnimation(params, preset) {
96984
+ switch (preset) {
96985
+ case 'wave':
96986
+ return Appear_Wave;
96987
+ case 'grow':
96988
+ return Appear_Grow(params);
96989
+ case 'waveGrow':
96990
+ return Appear_WaveGrow(params);
96991
+ default:
96992
+ return Appear_Wave;
96993
+ }
96994
+ }
96995
+ const registerLiquidAnimation = () => {
96996
+ Factory.registerAnimation('liquid', (params, preset) => {
96997
+ return {
96998
+ appear: liquidPresetAnimation(params, preset),
96999
+ enter: liquidPresetAnimation(params, preset),
97000
+ exit: liquidPresetAnimation(params, preset)
97001
+ };
97002
+ });
97003
+ };
97004
+
97005
+ const WAVE_GLYPH_TYPE = 'wave';
97006
+ class LiquidMark extends BaseMark {
97007
+ constructor() {
97008
+ super(...arguments);
97009
+ this.type = LiquidMark.type;
97010
+ }
97011
+ _getDefaultStyle() {
97012
+ const defaultStyle = Object.assign(Object.assign({}, super._getDefaultStyle()), { wave: 0 });
97013
+ return defaultStyle;
97014
+ }
97015
+ _initProduct(group) {
97016
+ const view = this.getVGrammarView();
97017
+ const id = this.getProductId();
97018
+ this._product = view.glyph(WAVE_GLYPH_TYPE, group !== null && group !== void 0 ? group : view.rootMark).id(id);
97019
+ this._compiledProductId = id;
97020
+ }
97021
+ }
97022
+ LiquidMark.type = "liquid";
97023
+ const registerLiquidMark = () => {
97024
+ Factory.registerMark(LiquidMark.type, LiquidMark);
97025
+ registerWaveGlyph();
97026
+ };
97027
+
97028
+ const getShapes = (shapesType, size) => {
97029
+ if (shapesType === 'drop') {
97030
+ return pin(0, 0, size / 2);
97031
+ }
97032
+ return shapesType;
97033
+ };
97034
+ function pin(x, y, radius) {
97035
+ const w = (radius * 4) / 3;
97036
+ const h = Math.max(w, radius * 2);
97037
+ const r = w / 2;
97038
+ const cx = x;
97039
+ const cy = r + y - h / 2;
97040
+ const theta = Math.asin(r / ((h - r) * 0.85));
97041
+ const dy = Math.sin(theta) * r;
97042
+ const dx = Math.cos(theta) * r;
97043
+ const x0 = cx - dx;
97044
+ const y0 = cy + dy;
97045
+ const cpX = x;
97046
+ const cpY = cy + r / Math.sin(theta);
97047
+ return `
97048
+ M ${x0} ${y0}
97049
+ A ${r} ${r} 0 1 1 ${x0 + dx * 2} ${y0}
97050
+ Q ${cpX} ${cpY} ${x} ${y + h / 2}
97051
+ Q ${cpX} ${cpY} ${x0} ${y0}
97052
+ Z
97053
+ `;
97054
+ }
97055
+
97056
+ class LiquidSeriesTooltipHelper extends BaseSeriesTooltipHelper {
97057
+ constructor() {
97058
+ super(...arguments);
97059
+ this.getContentKey = () => (datum) => {
97060
+ return this.series.getValueField();
97061
+ };
97062
+ this.getContentValue = () => (datum) => {
97063
+ const valueField = this.series.getValueField();
97064
+ return datum[valueField];
97065
+ };
97066
+ this.getLiquidFillColor = (datum) => {
97067
+ return this.series.getMarkInName('liquid').getAttribute('fill', datum);
97068
+ };
97069
+ }
97070
+ getDefaultTooltipPattern(activeType) {
97071
+ return {
97072
+ visible: true,
97073
+ activeType,
97074
+ title: {
97075
+ key: undefined,
97076
+ value: this.titleValueCallback,
97077
+ hasShape: false
97078
+ },
97079
+ content: [
97080
+ {
97081
+ key: this.getContentKey(),
97082
+ value: this.getContentValue(),
97083
+ hasShape: true,
97084
+ shapeType: this.contentShapeTypeCallback,
97085
+ shapeColor: this.getLiquidFillColor,
97086
+ shapeStroke: this.getLiquidFillColor,
97087
+ shapeHollow: false
97088
+ }
97089
+ ]
97090
+ };
97091
+ }
97092
+ }
97093
+
97094
+ class LiquidSeries extends BaseSeries {
97095
+ constructor() {
97096
+ super(...arguments);
97097
+ this.type = exports.SeriesTypeEnum.liquid;
97098
+ this.transformerConstructor = LineLikeSeriesSpecTransformer;
97099
+ this._liquidBackgroundMark = null;
97100
+ this._liquidOutlineMark = null;
97101
+ }
97102
+ setValueField(field) {
97103
+ if (isValid$3(field)) {
97104
+ this._valueField = field;
97105
+ }
97106
+ }
97107
+ getValueField() {
97108
+ return this._valueField;
97109
+ }
97110
+ setAttrFromSpec() {
97111
+ super.setAttrFromSpec();
97112
+ this._marginSpec = normalizeLayoutPaddingSpec(this._spec.outlineMargin);
97113
+ this._paddingSpec = normalizeLayoutPaddingSpec(this._spec.outlinePadding);
97114
+ this.setValueField(this._spec.valueField);
97115
+ }
97116
+ rawDataUpdate(d) {
97117
+ super.rawDataUpdate(d);
97118
+ this._heightRatio = max$1(...this._data.getLatestData().map((d) => d[this._valueField]));
97119
+ }
97120
+ initMark() {
97121
+ this._initLiquidOutlineMark();
97122
+ this._initLiquidBackgroundMark();
97123
+ this._initLiquidMark();
97124
+ }
97125
+ initMarkStyle() {
97126
+ this._initLiquidOutlineMarkStyle();
97127
+ this._initLiquidBackgroundMarkStyle();
97128
+ this._initLiquidMarkStyle();
97129
+ }
97130
+ _initLiquidOutlineMark() {
97131
+ this._liquidOutlineMark = this._createMark(LiquidSeries.mark.liquidOutline, {
97132
+ isSeriesMark: true,
97133
+ skipBeforeLayouted: false
97134
+ });
97135
+ return this._liquidOutlineMark;
97136
+ }
97137
+ _initLiquidBackgroundMark() {
97138
+ this._liquidBackgroundMark = this._createMark(LiquidSeries.mark.liquidBackground, {
97139
+ isSeriesMark: true,
97140
+ skipBeforeLayouted: false
97141
+ });
97142
+ return this._liquidBackgroundMark;
97143
+ }
97144
+ _initLiquidMark() {
97145
+ this._liquidMark = this._createMark(LiquidSeries.mark.liquid, {
97146
+ parent: this._liquidBackgroundMark,
97147
+ isSeriesMark: true,
97148
+ skipBeforeLayouted: false
97149
+ });
97150
+ return this._liquidMark;
97151
+ }
97152
+ _getPosAndSizeFormRegion(isOutline = false) {
97153
+ const { top: marginTop = 0, bottom: marginBottom = 0, left: marginLeft = 0, right: marginRight = 0 } = this._marginSpec;
97154
+ const { top: paddingTop = 0, bottom: paddingBottom = 0, left: paddingLeft = 0, right: paddingRight = 0 } = this._paddingSpec;
97155
+ const { width: regionWidth, height: regionHeight } = this._region.getLayoutRect();
97156
+ if (!isOutline) {
97157
+ return {
97158
+ x: regionWidth / 2 + (marginLeft + paddingRight - (marginRight + paddingRight)) / 2,
97159
+ y: regionHeight / 2 + (marginTop + paddingTop - (marginBottom + paddingBottom)) / 2,
97160
+ size: Math.min(regionWidth - (marginLeft + marginRight + paddingLeft + paddingRight), regionHeight - (marginTop + marginBottom + paddingTop + paddingBottom))
97161
+ };
97162
+ }
97163
+ return {
97164
+ x: regionWidth / 2 + (marginLeft - marginRight) / 2,
97165
+ y: regionHeight / 2 + (marginTop - marginBottom) / 2,
97166
+ size: Math.min(regionWidth - (marginLeft + marginRight), regionHeight - (marginTop + marginBottom))
97167
+ };
97168
+ }
97169
+ _initLiquidOutlineMarkStyle() {
97170
+ const liquidOutlineMark = this._liquidOutlineMark;
97171
+ liquidOutlineMark.setZIndex(this.layoutZIndex);
97172
+ liquidOutlineMark.created();
97173
+ this.setMarkStyle(liquidOutlineMark, {
97174
+ stroke: this.getColorAttribute(),
97175
+ x: () => this._getPosAndSizeFormRegion(true).x,
97176
+ y: () => this._getPosAndSizeFormRegion(true).y,
97177
+ size: () => this._getPosAndSizeFormRegion(true).size,
97178
+ symbolType: () => { var _a; return getShapes((_a = this._spec.maskShape) !== null && _a !== void 0 ? _a : 'circle', this._getPosAndSizeFormRegion(true).size); }
97179
+ }, 'normal', exports.AttributeLevel.Series);
97180
+ this._liquidOutlineMark.setInteractive(false);
97181
+ }
97182
+ _initLiquidBackgroundMarkStyle() {
97183
+ const liquidBackgroundMark = this._liquidBackgroundMark;
97184
+ liquidBackgroundMark.setZIndex(this.layoutZIndex);
97185
+ liquidBackgroundMark.created();
97186
+ this.setMarkStyle(liquidBackgroundMark, {
97187
+ clip: true,
97188
+ width: () => this._region.getLayoutRect().width,
97189
+ height: () => this._region.getLayoutRect().height,
97190
+ path: () => {
97191
+ var _a;
97192
+ const { x, y, size } = this._getPosAndSizeFormRegion();
97193
+ const symbolPath = createSymbol({
97194
+ x,
97195
+ y,
97196
+ size,
97197
+ symbolType: getShapes((_a = this._spec.maskShape) !== null && _a !== void 0 ? _a : 'circle', size),
97198
+ fill: true
97199
+ });
97200
+ return [symbolPath];
97201
+ }
97202
+ }, 'normal', exports.AttributeLevel.Series);
97203
+ this._liquidBackgroundMark.setInteractive(false);
97204
+ }
97205
+ _initLiquidMarkStyle() {
97206
+ const liquidMark = this._liquidMark;
97207
+ if (liquidMark) {
97208
+ this.setMarkStyle(liquidMark, {
97209
+ dx: () => {
97210
+ return this._region.getLayoutStartPoint().x + this._region.getLayoutRect().width / 2;
97211
+ },
97212
+ y: () => {
97213
+ const { y: liquidBackY, size: liquidBackSize } = this._getPosAndSizeFormRegion();
97214
+ return liquidBackY - liquidBackSize / 2 + liquidBackSize - liquidBackSize * this._heightRatio;
97215
+ },
97216
+ height: () => {
97217
+ const { size: liquidBackSize } = this._getPosAndSizeFormRegion();
97218
+ return liquidBackSize * this._heightRatio;
97219
+ },
97220
+ fill: this.getColorAttribute(),
97221
+ wave: 0
97222
+ }, 'normal', exports.AttributeLevel.Series);
97223
+ }
97224
+ }
97225
+ initTooltip() {
97226
+ this._tooltipHelper = new LiquidSeriesTooltipHelper(this);
97227
+ this._liquidMark && this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark);
97228
+ }
97229
+ initInteraction() {
97230
+ this._parseInteractionConfig(this._liquidMark ? [this._liquidMark] : []);
97231
+ }
97232
+ initAnimation() {
97233
+ var _a, _b, _c;
97234
+ const animationParams = {
97235
+ y: {
97236
+ from: () => {
97237
+ const { y: liquidBackY, size: liquidBackSize } = this._getPosAndSizeFormRegion();
97238
+ return liquidBackY - liquidBackSize / 2 + liquidBackSize;
97239
+ },
97240
+ to: () => {
97241
+ const { y: liquidBackY, size: liquidBackSize } = this._getPosAndSizeFormRegion();
97242
+ return liquidBackY - liquidBackSize / 2 + liquidBackSize - liquidBackSize * this._heightRatio;
97243
+ }
97244
+ },
97245
+ height: {
97246
+ from: 0,
97247
+ to: () => {
97248
+ const { size: liquidBackSize } = this._getPosAndSizeFormRegion();
97249
+ return liquidBackSize * this._heightRatio;
97250
+ }
97251
+ }
97252
+ };
97253
+ const appearPreset = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.animationAppear) === null || _b === void 0 ? void 0 : _b.preset;
97254
+ this._liquidMark.setAnimationConfig(animationConfig((_c = Factory.getAnimationInKey('liquid')) === null || _c === void 0 ? void 0 : _c(animationParams, appearPreset), userAnimationConfig("liquid", this._spec, this._markAttributeContext)));
97255
+ }
97256
+ initEvent() {
97257
+ super.initEvent();
97258
+ if (!this._spec.indicatorSmartInvert || !this._option.getChart().getComponentsByKey('indicator')) {
97259
+ return;
97260
+ }
97261
+ this.event.on(exports.ChartEvent.renderFinished, () => {
97262
+ this._option
97263
+ .getChart()
97264
+ .getComponentsByKey('indicator')
97265
+ .forEach((indicatorComponent) => {
97266
+ var _a, _b;
97267
+ const grammarMark = this._liquidMark.getProduct();
97268
+ const waveItem = grammarMark.elements[0].glyphGraphicItems.wave1;
97269
+ let { y1: waveY1, y2: waveY2 } = waveItem.globalAABBBounds;
97270
+ waveY1 += this._region.getLayoutStartPoint().y;
97271
+ waveY2 += this._region.getLayoutStartPoint().y;
97272
+ (_b = (_a = indicatorComponent === null || indicatorComponent === void 0 ? void 0 : indicatorComponent.getIndicatorComponent()) === null || _a === void 0 ? void 0 : _a.getChildren()[0]) === null || _b === void 0 ? void 0 : _b.getChildren().forEach((text) => {
97273
+ const { y1: textY1, y2: textY2 } = text.globalAABBBounds;
97274
+ if (waveY1 < textY1 && waveY2 > textY2) {
97275
+ const foregroundColor = text.attribute.fill;
97276
+ const backgroundColor = waveItem.attribute.fill;
97277
+ const invertColor = labelSmartInvert(foregroundColor, backgroundColor);
97278
+ text.setAttribute('fill', invertColor);
97279
+ }
97280
+ });
97281
+ });
97282
+ });
97283
+ }
97284
+ dataToPosition(data) {
97285
+ return null;
97286
+ }
97287
+ dataToPositionX(data) {
97288
+ return null;
97289
+ }
97290
+ dataToPositionY(data) {
97291
+ return null;
97292
+ }
97293
+ valueToPosition(value1, value2) {
97294
+ return null;
97295
+ }
97296
+ getStatisticFields() {
97297
+ return [];
97298
+ }
97299
+ getGroupFields() {
97300
+ return [];
97301
+ }
97302
+ getStackGroupFields() {
97303
+ return [];
97304
+ }
97305
+ getStackValueField() {
97306
+ return '';
97307
+ }
97308
+ getActiveMarks() {
97309
+ return [this._liquidMark];
97310
+ }
97311
+ }
97312
+ LiquidSeries.type = exports.SeriesTypeEnum.liquid;
97313
+ LiquidSeries.mark = LiquidSeriesMark;
97314
+ LiquidSeries.transformerConstructor = LineLikeSeriesSpecTransformer;
97315
+ const registerLiquidSeries = () => {
97316
+ registerLiquidMark();
97317
+ registerGroupMark();
97318
+ registerLiquidAnimation();
97319
+ Factory.registerSeries(LiquidSeries.type, LiquidSeries);
97320
+ };
97321
+
97127
97322
  class LiquidChart extends BaseChart {
97128
97323
  constructor() {
97129
97324
  super(...arguments);
@@ -97246,7 +97441,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
97246
97441
  exports.LinkPathMark = LinkPathMark;
97247
97442
  exports.LinkSeries = LinkSeries;
97248
97443
  exports.LiquidChart = LiquidChart;
97249
- exports.LiquidSeries = LiquidSeries;
97250
97444
  exports.MapChart = MapChart;
97251
97445
  exports.MapLabelComponent = MapLabelComponent;
97252
97446
  exports.MapSeries = MapSeries;
@@ -97399,7 +97593,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
97399
97593
  exports.registerLinearProgressSeries = registerLinearProgressSeries;
97400
97594
  exports.registerLinkSeries = registerLinkSeries;
97401
97595
  exports.registerLiquidChart = registerLiquidChart;
97402
- exports.registerLiquidSeries = registerLiquidSeries;
97403
97596
  exports.registerLynxEnv = registerLynxEnv;
97404
97597
  exports.registerMapChart = registerMapChart;
97405
97598
  exports.registerMapLabel = registerMapLabel;