@visactor/vchart 2.0.22-alpha.4 → 2.0.22

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 (46) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +95 -30
  3. package/build/index.js +95 -30
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/component/interface/theme.d.ts +2 -2
  7. package/cjs/component/interface/theme.js.map +1 -1
  8. package/cjs/component/tooltip/tooltip-transformer.js +11 -9
  9. package/cjs/component/tooltip/tooltip-transformer.js.map +1 -1
  10. package/cjs/core/index.d.ts +1 -1
  11. package/cjs/core/index.js +2 -2
  12. package/cjs/core/index.js.map +1 -1
  13. package/cjs/core/instance-manager.js +1 -1
  14. package/cjs/core/vchart.js +4 -3
  15. package/cjs/core/vchart.js.map +1 -1
  16. package/cjs/data/initialize.js +1 -1
  17. package/cjs/data/register.js +1 -1
  18. package/cjs/series/bar/bar.js +14 -9
  19. package/cjs/series/bar/bar.js.map +1 -1
  20. package/cjs/series/map/map.js +18 -6
  21. package/cjs/series/map/map.js.map +1 -1
  22. package/cjs/series/sankey/tooltip-helper.js +1 -1
  23. package/cjs/series/sankey/tooltip-helper.js.map +1 -1
  24. package/cjs/series/scatter/scatter.js +9 -3
  25. package/cjs/series/scatter/scatter.js.map +1 -1
  26. package/esm/component/interface/theme.d.ts +2 -2
  27. package/esm/component/interface/theme.js.map +1 -1
  28. package/esm/component/tooltip/tooltip-transformer.js +11 -8
  29. package/esm/component/tooltip/tooltip-transformer.js.map +1 -1
  30. package/esm/core/index.d.ts +1 -1
  31. package/esm/core/index.js +2 -2
  32. package/esm/core/index.js.map +1 -1
  33. package/esm/core/instance-manager.js +1 -1
  34. package/esm/core/vchart.js +4 -3
  35. package/esm/core/vchart.js.map +1 -1
  36. package/esm/data/initialize.js +1 -1
  37. package/esm/data/register.js +1 -1
  38. package/esm/series/bar/bar.js +14 -8
  39. package/esm/series/bar/bar.js.map +1 -1
  40. package/esm/series/map/map.js +18 -6
  41. package/esm/series/map/map.js.map +1 -1
  42. package/esm/series/sankey/tooltip-helper.js +2 -2
  43. package/esm/series/sankey/tooltip-helper.js.map +1 -1
  44. package/esm/series/scatter/scatter.js +10 -4
  45. package/esm/series/scatter/scatter.js.map +1 -1
  46. package/package.json +4 -4
@@ -11,7 +11,7 @@ import type { IMarkLineTheme } from '../marker/mark-line/interface';
11
11
  import type { IMarkPointTheme } from '../marker/mark-point/interface';
12
12
  import type { IPlayerTheme } from '../player/interface';
13
13
  import type { ITitleTheme } from '../title/interface';
14
- import type { ITooltipTheme } from '../tooltip/interface';
14
+ import type { ITooltipSpec, ITooltipTheme } from '../tooltip/interface';
15
15
  import type { ComponentTypeEnum } from './type';
16
16
  import type { ITotalLabelTheme } from '../label/interface';
17
17
  import type { IPoptipTheme } from '../poptip/interface';
@@ -37,7 +37,7 @@ export interface IComponentTheme {
37
37
  [ComponentTypeEnum.markPoint]?: IMarkPointTheme;
38
38
  [ComponentTypeEnum.polarMarkPoint]?: IMarkPointTheme;
39
39
  [ComponentTypeEnum.geoMarkPoint]?: IMarkPointTheme;
40
- [ComponentTypeEnum.tooltip]?: ITooltipTheme<string | IColorKey>;
40
+ [ComponentTypeEnum.tooltip]?: ITooltipTheme<string | IColorKey> & Partial<Pick<ITooltipSpec, 'visible' | 'activeType' | 'mark' | 'dimension' | 'group' | 'trigger' | 'triggerOff' | 'showDelay' | 'hideTimer' | 'lockAfterClick' | 'renderMode' | 'confine' | 'className' | 'parentElement' | 'enterable' | 'throttleInterval'>>;
41
41
  [ComponentTypeEnum.crosshair]?: ICrosshairTheme;
42
42
  [ComponentTypeEnum.dataZoom]?: IDataZoomTheme;
43
43
  [ComponentTypeEnum.scrollBar]?: IScrollBarTheme;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/interface/theme.ts"],"names":[],"mappings":"","file":"theme.js","sourcesContent":["import type { IAxisCommonTheme } from '../axis/interface';\nimport type { IBrushTheme } from '../brush/interface';\nimport type { ICrosshairTheme } from '../crosshair/interface';\nimport type { IDataZoomTheme } from '../data-zoom/data-zoom/interface';\nimport type { IScrollBarTheme } from '../data-zoom/scroll-bar/interface';\nimport type { IIndicatorTheme } from '../indicator/interface';\nimport type { IDiscreteLegendTheme } from '../legend/discrete/interface';\nimport type { IColorLegendTheme, ISizeLegendTheme } from '../legend/continuous/interface';\nimport type { IMarkAreaTheme } from '../marker/mark-area/interface';\nimport type { IMarkLineTheme } from '../marker/mark-line/interface';\nimport type { IMarkPointTheme } from '../marker/mark-point/interface';\nimport type { IPlayerTheme } from '../player/interface';\nimport type { ITitleTheme } from '../title/interface';\nimport type { ITooltipTheme } from '../tooltip/interface';\nimport type { ComponentTypeEnum } from './type';\nimport type { ITotalLabelTheme } from '../label/interface';\nimport type { IPoptipTheme } from '../poptip/interface';\nimport type { IColorKey } from '../../theme/color-scheme/interface';\nimport type { Direction, IOrientType } from '../../typings';\nimport type { ICartesianAxisCommonTheme } from '../axis/cartesian/interface/theme';\nimport type { IPolarAxisCommonTheme } from '../axis/polar/interface/theme';\n\nexport interface IComponentTheme {\n /**\n * 通用坐标轴配置\n */\n axis?: IAxisCommonTheme;\n /**\n * 离散轴的通用配置\n */\n axisBand?: IAxisCommonTheme;\n /**\n * 连续轴的通用配置\n */\n axisLinear?: IAxisCommonTheme;\n /**\n * 笛卡尔坐标系下 x 轴的配置\n */\n axisX?: ICartesianAxisCommonTheme;\n /**\n * 笛卡尔坐标系下 y 轴配置\n */\n axisY?: ICartesianAxisCommonTheme;\n /**\n * 极坐标系下半径轴配置\n */\n axisRadius?: IPolarAxisCommonTheme;\n /**\n * 极坐标系下角度轴配置\n */\n axisAngle?: IPolarAxisCommonTheme;\n /**\n * 离散图例配置\n */\n [ComponentTypeEnum.discreteLegend]?: IDiscreteLegendTheme;\n /**\n * 连续颜色图例配置\n */\n [ComponentTypeEnum.colorLegend]?: IColorLegendTheme;\n /**\n * 连续尺寸图例配置\n */\n [ComponentTypeEnum.sizeLegend]?: ISizeLegendTheme;\n /**\n * markLine 标记配置\n */\n [ComponentTypeEnum.markLine]?: IMarkLineTheme;\n [ComponentTypeEnum.polarMarkLine]?: IMarkLineTheme;\n /**\n * markArea 标记配置\n */\n [ComponentTypeEnum.markArea]?: IMarkAreaTheme;\n [ComponentTypeEnum.polarMarkArea]?: IMarkAreaTheme;\n /**\n * markPoint 标记配置\n */\n [ComponentTypeEnum.markPoint]?: IMarkPointTheme;\n [ComponentTypeEnum.polarMarkPoint]?: IMarkPointTheme;\n [ComponentTypeEnum.geoMarkPoint]?: IMarkPointTheme;\n /**\n * tooltip 组件配置\n */\n [ComponentTypeEnum.tooltip]?: ITooltipTheme<string | IColorKey>;\n /**\n * crosshair 配置\n */\n [ComponentTypeEnum.crosshair]?: ICrosshairTheme;\n /**\n * dataZoom 配置\n */\n [ComponentTypeEnum.dataZoom]?: IDataZoomTheme;\n /**\n * scrollbar 滚动条配置\n */\n [ComponentTypeEnum.scrollBar]?: IScrollBarTheme;\n /**\n * 指标卡组件配置\n */\n [ComponentTypeEnum.indicator]?: IIndicatorTheme;\n /**\n * 播放器配置\n */\n [ComponentTypeEnum.player]?: IPlayerTheme;\n /**\n * 框选配置\n */\n [ComponentTypeEnum.brush]?: IBrushTheme;\n /**\n * 图表标题配置\n */\n [ComponentTypeEnum.title]?: ITitleTheme;\n /**\n * 省略文本配置\n */\n [ComponentTypeEnum.poptip]?: IPoptipTheme;\n /**\n * 堆叠总计标签配置\n * @since 1.3.0\n */\n [ComponentTypeEnum.totalLabel]?: ITotalLabelTheme;\n [key: string]: any;\n}\n\n/** 区分方向的组件主题类型 */\nexport type ComponentThemeWithDirection<\n T extends {\n orient?: IOrientType;\n }\n> = T /* 通用主题,留作兼容 */ & {\n orient?: IOrientType;\n /** 横向主题 */\n [Direction.horizontal]?: Omit<T, 'orient'>;\n /** 纵向主题 */\n [Direction.vertical]?: Omit<T, 'orient'>;\n};\n"]}
1
+ {"version":3,"sources":["../src/component/interface/theme.ts"],"names":[],"mappings":"","file":"theme.js","sourcesContent":["import type { IAxisCommonTheme } from '../axis/interface';\nimport type { IBrushTheme } from '../brush/interface';\nimport type { ICrosshairTheme } from '../crosshair/interface';\nimport type { IDataZoomTheme } from '../data-zoom/data-zoom/interface';\nimport type { IScrollBarTheme } from '../data-zoom/scroll-bar/interface';\nimport type { IIndicatorTheme } from '../indicator/interface';\nimport type { IDiscreteLegendTheme } from '../legend/discrete/interface';\nimport type { IColorLegendTheme, ISizeLegendTheme } from '../legend/continuous/interface';\nimport type { IMarkAreaTheme } from '../marker/mark-area/interface';\nimport type { IMarkLineTheme } from '../marker/mark-line/interface';\nimport type { IMarkPointTheme } from '../marker/mark-point/interface';\nimport type { IPlayerTheme } from '../player/interface';\nimport type { ITitleTheme } from '../title/interface';\nimport type { ITooltipSpec, ITooltipTheme } from '../tooltip/interface';\nimport type { ComponentTypeEnum } from './type';\nimport type { ITotalLabelTheme } from '../label/interface';\nimport type { IPoptipTheme } from '../poptip/interface';\nimport type { IColorKey } from '../../theme/color-scheme/interface';\nimport type { Direction, IOrientType } from '../../typings';\nimport type { ICartesianAxisCommonTheme } from '../axis/cartesian/interface/theme';\nimport type { IPolarAxisCommonTheme } from '../axis/polar/interface/theme';\n\nexport interface IComponentTheme {\n /**\n * 通用坐标轴配置\n */\n axis?: IAxisCommonTheme;\n /**\n * 离散轴的通用配置\n */\n axisBand?: IAxisCommonTheme;\n /**\n * 连续轴的通用配置\n */\n axisLinear?: IAxisCommonTheme;\n /**\n * 笛卡尔坐标系下 x 轴的配置\n */\n axisX?: ICartesianAxisCommonTheme;\n /**\n * 笛卡尔坐标系下 y 轴配置\n */\n axisY?: ICartesianAxisCommonTheme;\n /**\n * 极坐标系下半径轴配置\n */\n axisRadius?: IPolarAxisCommonTheme;\n /**\n * 极坐标系下角度轴配置\n */\n axisAngle?: IPolarAxisCommonTheme;\n /**\n * 离散图例配置\n */\n [ComponentTypeEnum.discreteLegend]?: IDiscreteLegendTheme;\n /**\n * 连续颜色图例配置\n */\n [ComponentTypeEnum.colorLegend]?: IColorLegendTheme;\n /**\n * 连续尺寸图例配置\n */\n [ComponentTypeEnum.sizeLegend]?: ISizeLegendTheme;\n /**\n * markLine 标记配置\n */\n [ComponentTypeEnum.markLine]?: IMarkLineTheme;\n [ComponentTypeEnum.polarMarkLine]?: IMarkLineTheme;\n /**\n * markArea 标记配置\n */\n [ComponentTypeEnum.markArea]?: IMarkAreaTheme;\n [ComponentTypeEnum.polarMarkArea]?: IMarkAreaTheme;\n /**\n * markPoint 标记配置\n */\n [ComponentTypeEnum.markPoint]?: IMarkPointTheme;\n [ComponentTypeEnum.polarMarkPoint]?: IMarkPointTheme;\n [ComponentTypeEnum.geoMarkPoint]?: IMarkPointTheme;\n /**\n * tooltip 组件配置\n */\n [ComponentTypeEnum.tooltip]?: ITooltipTheme<string | IColorKey> &\n Partial<\n Pick<\n ITooltipSpec,\n | 'visible'\n | 'activeType'\n | 'mark'\n | 'dimension'\n | 'group'\n | 'trigger'\n | 'triggerOff'\n | 'showDelay'\n | 'hideTimer'\n | 'lockAfterClick'\n | 'renderMode'\n | 'confine'\n | 'className'\n | 'parentElement'\n | 'enterable'\n | 'throttleInterval'\n >\n >;\n /**\n * crosshair 配置\n */\n [ComponentTypeEnum.crosshair]?: ICrosshairTheme;\n /**\n * dataZoom 配置\n */\n [ComponentTypeEnum.dataZoom]?: IDataZoomTheme;\n /**\n * scrollbar 滚动条配置\n */\n [ComponentTypeEnum.scrollBar]?: IScrollBarTheme;\n /**\n * 指标卡组件配置\n */\n [ComponentTypeEnum.indicator]?: IIndicatorTheme;\n /**\n * 播放器配置\n */\n [ComponentTypeEnum.player]?: IPlayerTheme;\n /**\n * 框选配置\n */\n [ComponentTypeEnum.brush]?: IBrushTheme;\n /**\n * 图表标题配置\n */\n [ComponentTypeEnum.title]?: ITitleTheme;\n /**\n * 省略文本配置\n */\n [ComponentTypeEnum.poptip]?: IPoptipTheme;\n /**\n * 堆叠总计标签配置\n * @since 1.3.0\n */\n [ComponentTypeEnum.totalLabel]?: ITotalLabelTheme;\n [key: string]: any;\n}\n\n/** 区分方向的组件主题类型 */\nexport type ComponentThemeWithDirection<\n T extends {\n orient?: IOrientType;\n }\n> = T /* 通用主题,留作兼容 */ & {\n orient?: IOrientType;\n /** 横向主题 */\n [Direction.horizontal]?: Omit<T, 'orient'>;\n /** 纵向主题 */\n [Direction.vertical]?: Omit<T, 'orient'>;\n};\n"]}
@@ -4,22 +4,24 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.TooltipSpecTransformer = void 0;
6
6
 
7
- const vrender_core_1 = require("@visactor/vrender-core"), util_1 = require("../../util"), base_1 = require("../base"), constant_1 = require("./constant"), common_1 = require("./utils/common"), vutils_extension_1 = require("@visactor/vutils-extension");
7
+ const vrender_core_1 = require("@visactor/vrender-core"), util_1 = require("../../util"), base_1 = require("../base"), constant_1 = require("./constant"), common_1 = require("./utils/common"), vutils_extension_1 = require("@visactor/vutils-extension"), TOOLTIP_STYLE_THEME_KEYS = [ "panel", "shape", "titleLabel", "keyLabel", "valueLabel", "spaceRow", "maxContentHeight", "align" ];
8
8
 
9
9
  class TooltipSpecTransformer extends base_1.BaseComponentSpecTransformer {
10
10
  _shouldMergeThemeToSpec() {
11
11
  return !1;
12
12
  }
13
13
  _initTheme(spec, chartSpec) {
14
- var _a, _b, _c;
15
- const {spec: newSpec, theme: theme} = super._initTheme(spec, chartSpec);
16
- return newSpec.style = (0, vutils_extension_1.mergeSpec)({}, this._theme, newSpec.style),
17
- newSpec.offset = (0, vutils_extension_1.mergeSpec)({}, theme.offset, spec.offset),
18
- newSpec.transitionDuration = null !== (_a = spec.transitionDuration) && void 0 !== _a ? _a : theme.transitionDuration,
19
- newSpec.trigger = null !== (_b = spec.trigger) && void 0 !== _b ? _b : theme.trigger,
20
- newSpec.triggerOff = null !== (_c = spec.triggerOff) && void 0 !== _c ? _c : theme.triggerOff,
14
+ const {spec: newSpec, theme: theme} = super._initTheme(spec, chartSpec), themeStyle = (0,
15
+ vutils_extension_1.mergeSpec)({}, ...TOOLTIP_STYLE_THEME_KEYS.map((key => void 0 !== (null == theme ? void 0 : theme[key]) ? {
16
+ [key]: theme[key]
17
+ } : void 0)), null == theme ? void 0 : theme.style), themeSpec = (0, vutils_extension_1.mergeSpec)({}, theme);
18
+ TOOLTIP_STYLE_THEME_KEYS.forEach((key => {
19
+ delete themeSpec[key];
20
+ })), delete themeSpec.style;
21
+ const mergedSpec = (0, vutils_extension_1.mergeSpec)({}, themeSpec, newSpec);
22
+ return mergedSpec.style = (0, vutils_extension_1.mergeSpec)({}, themeStyle, mergedSpec.style),
21
23
  {
22
- spec: newSpec,
24
+ spec: mergedSpec,
23
25
  theme: theme
24
26
  };
25
27
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/tooltip/tooltip-transformer.ts"],"names":[],"mappings":";;;AAAA,yDAAiD;AAEjD,qCAA8F;AAC9F,kCAAuD;AACvD,yCAAmD;AACnD,2CAA4D;AAC5D,iEAAuD;AAEvD,MAAa,sBAAuB,SAAQ,mCAAiC;IACjE,uBAAuB;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IAES,UAAU,CAAC,IAAS,EAAE,SAAc;;QAC5C,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QAGnE,OAAO,CAAC,KAAK,GAAG,IAAA,4BAAS,EAAC,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QAC1D,OAAO,CAAC,MAAM,GAAG,IAAA,4BAAS,EAAC,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1D,OAAO,CAAC,kBAAkB,GAAG,MAAA,IAAI,CAAC,kBAAkB,mCAAI,KAAK,CAAC,kBAAkB,CAAC;Q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,IAAI,IAAA,eAAQ,EAAC,IAAI,CAAC,aAAa,CAAC,EAAE;gBAChC,IAAI,CAAC,aAAa,GAAG,sBAAO,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aACjE;SACF;aAAM,IAAI,IAAA,oBAAa,EAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC3C,IAAI,CAAC,aAAa,GAAG,kBAAW,aAAX,kBAAW,uBAAX,kBAAW,CAAE,IAAI,CAAC;SACxC;IACH,CAAC;CACF;AA3CD,wDA2CC","file":"tooltip-transformer.js","sourcesContent":["import { vglobal } from '@visactor/vrender-core';\nimport type { IChartSpecInfo } from '../../chart/interface';\nimport { domDocument, isMiniAppLikeMode, isString, isTrueBrowser, isValid } from '../../util';\nimport { BaseComponentSpecTransformer } from '../base';\nimport { TOOLTIP_EL_CLASS_NAME } from './constant';\nimport { getTooltipActualActiveType } from './utils/common';\nimport { mergeSpec } from '@visactor/vutils-extension';\n\nexport class TooltipSpecTransformer extends BaseComponentSpecTransformer<any> {\n protected _shouldMergeThemeToSpec() {\n return false;\n }\n\n protected _initTheme(spec: any, chartSpec: any): { spec: any; theme: any } {\n const { spec: newSpec, theme } = super._initTheme(spec, chartSpec);\n\n // 合并样式和配置\n newSpec.style = mergeSpec({}, this._theme, newSpec.style);\n newSpec.offset = mergeSpec({}, theme.offset, spec.offset);\n newSpec.transitionDuration = spec.transitionDuration ?? theme.transitionDuration;\n\n // 合并交互相关配置\n newSpec.trigger = spec.trigger ?? theme.trigger;\n newSpec.triggerOff = spec.triggerOff ?? theme.triggerOff;\n\n return { spec: newSpec, theme };\n }\n\n protected _transformSpecAfterMergingTheme(spec: any, chartSpec: any, chartSpecInfo?: IChartSpecInfo) {\n super._transformSpecAfterMergingTheme(spec, chartSpec, chartSpecInfo);\n\n spec.visible = spec.visible ?? true;\n spec.activeType = getTooltipActualActiveType(spec);\n spec.renderMode =\n spec.renderMode ??\n // 小程序或非浏览器环境下,默认使用canvas渲染\n (isMiniAppLikeMode(this._option.mode) || !isTrueBrowser(this._option.mode) ? 'canvas' : 'html');\n spec.trigger = spec.trigger ?? 'hover';\n spec.className = spec.className ?? TOOLTIP_EL_CLASS_NAME;\n spec.enterable = spec.enterable ?? false;\n spec.transitionDuration = spec.transitionDuration ?? 150;\n spec.confine = spec.confine ?? spec.renderMode === 'canvas';\n\n if (isValid(spec.parentElement)) {\n if (isString(spec.parentElement)) {\n spec.parentElement = vglobal.getElementById(spec.parentElement);\n }\n } else if (isTrueBrowser(this._option.mode)) {\n spec.parentElement = domDocument?.body;\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/component/tooltip/tooltip-transformer.ts"],"names":[],"mappings":";;;AAAA,yDAAiD;AAEjD,qCAA8F;AAC9F,kCAAuD;AACvD,yCAAmD;AACnD,2CAA4D;AAC5D,iEAAuD;AAEvD,MAAM,wBAAwB,GAAG;IAC/B,OAAO;IACP,OAAO;IACP,YAAY;IACZ,UAAU;IACV,YAAY;IACZ,UAAU;IACV,kBAAkB;IAClB,OAAO;CACC,CAAC;AAEX,MAAa,sBAAuB,SAAQ,mCAAiC;IACjE,uBAAuB;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IAES,UAAU,CAAC,IAAS,EAAE,SAAc;QAC5C,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACnE,MAAM,UAAU,GAAG,IAAA,4BAAS,EAC1B,EAAE,EACF,GAAG,wBAAwB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,GAAG,CAAC,MAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EACxG,KAAK,aAAL,KAAK,uBAA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,CAAC,SAAS,mCAAI,KAAK,CAAC;QACzC,IAAI,CAAC,kBAAkB,GAAG,MAAA,IAAI,CAAC,kBAAkB,mCAAI,GAAG,CAAC;QACzD,IAAI,CAAC,OAAO,GAAG,MAAA,IAAI,CAAC,OAAO,mCAAI,IAAI,CAAC,UAAU,KAAK,QAAQ,CAAC;QAE5D,IAAI,IAAA,cAAO,EAAC,IAAI,CAAC,aAAa,CAAC,EAAE;YAC/B,IAAI,IAAA,eAAQ,EAAC,IAAI,CAAC,aAAa,CAAC,EAAE;gBAChC,IAAI,CAAC,aAAa,GAAG,sBAAO,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aACjE;SACF;aAAM,IAAI,IAAA,oBAAa,EAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC3C,IAAI,CAAC,aAAa,GAAG,kBAAW,aAAX,kBAAW,uBAAX,kBAAW,CAAE,IAAI,CAAC;SACxC;IACH,CAAC;CACF;AAlDD,wDAkDC","file":"tooltip-transformer.js","sourcesContent":["import { vglobal } from '@visactor/vrender-core';\nimport type { IChartSpecInfo } from '../../chart/interface';\nimport { domDocument, isMiniAppLikeMode, isString, isTrueBrowser, isValid } from '../../util';\nimport { BaseComponentSpecTransformer } from '../base';\nimport { TOOLTIP_EL_CLASS_NAME } from './constant';\nimport { getTooltipActualActiveType } from './utils/common';\nimport { mergeSpec } from '@visactor/vutils-extension';\n\nconst TOOLTIP_STYLE_THEME_KEYS = [\n 'panel',\n 'shape',\n 'titleLabel',\n 'keyLabel',\n 'valueLabel',\n 'spaceRow',\n 'maxContentHeight',\n 'align'\n] as const;\n\nexport class TooltipSpecTransformer extends BaseComponentSpecTransformer<any> {\n protected _shouldMergeThemeToSpec() {\n return false;\n }\n\n protected _initTheme(spec: any, chartSpec: any): { spec: any; theme: any } {\n const { spec: newSpec, theme } = super._initTheme(spec, chartSpec);\n const themeStyle = mergeSpec(\n {},\n ...TOOLTIP_STYLE_THEME_KEYS.map(key => (theme?.[key] !== undefined ? { [key]: theme[key] } : undefined)),\n theme?.style\n );\n const themeSpec = mergeSpec({}, theme);\n\n TOOLTIP_STYLE_THEME_KEYS.forEach(key => {\n delete themeSpec[key];\n });\n delete themeSpec.style;\n\n const mergedSpec = mergeSpec({}, themeSpec, newSpec);\n\n // 合并样式配置\n mergedSpec.style = mergeSpec({}, themeStyle, mergedSpec.style);\n\n return { spec: mergedSpec, theme };\n }\n\n protected _transformSpecAfterMergingTheme(spec: any, chartSpec: any, chartSpecInfo?: IChartSpecInfo) {\n super._transformSpecAfterMergingTheme(spec, chartSpec, chartSpecInfo);\n\n spec.visible = spec.visible ?? true;\n spec.activeType = getTooltipActualActiveType(spec);\n spec.renderMode =\n spec.renderMode ??\n // 小程序或非浏览器环境下,默认使用canvas渲染\n (isMiniAppLikeMode(this._option.mode) || !isTrueBrowser(this._option.mode) ? 'canvas' : 'html');\n spec.trigger = spec.trigger ?? 'hover';\n spec.className = spec.className ?? TOOLTIP_EL_CLASS_NAME;\n spec.enterable = spec.enterable ?? false;\n spec.transitionDuration = spec.transitionDuration ?? 150;\n spec.confine = spec.confine ?? spec.renderMode === 'canvas';\n\n if (isValid(spec.parentElement)) {\n if (isString(spec.parentElement)) {\n spec.parentElement = vglobal.getElementById(spec.parentElement);\n }\n } else if (isTrueBrowser(this._option.mode)) {\n spec.parentElement = domDocument?.body;\n }\n }\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { VChart } from './vchart';
2
2
  import { Factory } from './factory';
3
3
  export { VChart, Factory };
4
- export declare const version = "2.0.21";
4
+ export declare const version = "2.0.22";
5
5
  export type { IVChart } from './interface';
6
6
  export type { IStateSpec, StateValueType } from '../compile/mark';
7
7
  export type { IRegion } from '../region/interface';
package/cjs/core/index.js CHANGED
@@ -35,7 +35,7 @@ Object.defineProperty(exports, "Factory", {
35
35
  get: function() {
36
36
  return factory_1.Factory;
37
37
  }
38
- }), exports.version = "2.0.21", __exportStar(require("../event/interface"), exports),
38
+ }), exports.version = "2.0.22", __exportStar(require("../event/interface"), exports),
39
39
  __exportStar(require("../theme/interface"), exports), __exportStar(require("../model/interface"), exports),
40
40
  __exportStar(require("./interface"), exports), __exportStar(require("../typings"), exports),
41
41
  __exportStar(require("../constant/base"), exports), __exportStar(require("../constant/data"), exports),
@@ -199,4 +199,4 @@ Object.defineProperty(exports, "measureText", {
199
199
  return text_1.measureText;
200
200
  }
201
201
  });
202
- //# sourceMappingURL=index.js.map
202
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,qCAAkC;AAGzB,uFAHA,eAAM,OAGA;AAFf,uCAAoC;AAEnB,wFAFR,iBAAO,OAEQ;AAGX,QAAA,OAAO,GAAG,QAAQ,CAAC;AAOhC,qDAAmC;AACnC,qDAAmC;AACnC,qDAAmC;AAEnC,8CAA4B;AAC5B,6CAA2B;AAI3B,mDAAiC;AACjC,mDAAiC;AACjC,qDAAmC;AACnC,mDAAuD;AAA9C,2GAAA,cAAc,OAAA;AACvB,iDAAoD;AAA3C,4GAAA,cAAc,OAAA;AACvB,uDAA6D;AAApD,6GAAA,gBAAgB,OAAA;AACzB,2CAA+C;AAAtC,mGAAA,UAAU,OAAA;AAKnB,wDAAsC;AACtC,oDAAkC;AAGlC,qDAAmC;AAGnC,iDAA+B;AAG/B,uDAUgC;AAT9B,uGAAA,OAAO,OAAA;AACP,2GAAA,WAAW,OAAA;AACX,8GAAA,cAAc,OAAA;AACd,0GAAA,UAAU,OAAA;AACV,yGAAA,SAAS,OAAA;AACT,0GAAA,UAAU,OAAA;AACV,0GAAA,UAAU,OAAA;AACV,0GAAA,UAAU,OAAA;AACV,4GAAA,YAAY,OAAA;AAEd,6DAAsE;AAA7D,+GAAA,YAAY,OAAA;AAAE,8GAAA,WAAW,OAAA;AAGlC,gDAA8B;AAC9B,uCAAmD;AAA1C,2GAAA,kBAAkB,OAAA;AAC3B,0CAAgD;AAAvC,mGAAA,WAAW,OAAA;AACpB,6CAAmG;AAA1F,yHAAA,6BAA6B,OAAA;AAAE,4HAAA,gCAAgC,OAAA;AACxE,oDAAmD;AAA1C,gGAAA,MAAM,OAAA;AACf,uCAAqC;AAA5B,6FAAA,IAAI,OAAA;AACb,qCAA2C;AAAlC,mGAAA,WAAW,OAAA","file":"index.js","sourcesContent":["/**\n * @description The core module of VChart, containing the necessary interfaces for using VChart.\n */\n\nimport { VChart } from './vchart';\nimport { Factory } from './factory';\n\nexport { VChart, Factory };\n\n// export the version\nexport const version = \"2.0.21\";\n\n// export necessary types\nexport type { IVChart } from './interface';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\nexport type { IRegion } from '../region/interface';\n\nexport * from '../event/interface';\nexport * from '../theme/interface';\nexport * from '../model/interface';\n\nexport * from './interface';\nexport * from '../typings';\nexport type { IMarkGraphic, IGraphicContext } from '../mark/interface/';\n\n// some constants\nexport * from '../constant/base';\nexport * from '../constant/data';\nexport * from '../constant/layout';\nexport { AttributeLevel } from '../constant/attribute';\nexport { TransformLevel } from '../data/initialize';\nexport { STATE_VALUE_ENUM } from '../compile/mark/interface';\nexport { ChartEvent } from '../constant/event';\n\n/**\n * spec\n */\nexport * from '../typings/spec/index';\nexport * from '../typings/visual';\n\n// tooltip\nexport * from '../typings/tooltip';\n\n// theme\nexport * from '../theme/index';\n\n// vrender\nexport {\n vglobal,\n createGroup,\n createRichText,\n createText,\n createArc,\n createArea,\n createRect,\n createLine,\n createSymbol\n} from '@visactor/vrender-core';\nexport { ManualTicker, StreamLight } from '@visactor/vrender-animate';\n\n// utils\nexport * from '../util/space';\nexport { transformToGraphic } from '../util/style';\nexport { getSpecInfo } from '../component/util';\nexport { registerDataSetInstanceParser, registerDataSetInstanceTransform } from '../data/register';\nexport { lookup } from '../data/transforms/lookup';\nexport { warn } from '../util/debug';\nexport { measureText } from '../util/text';\n"]}
1
+ {"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,qCAAkC;AAGzB,uFAHA,eAAM,OAGA;AAFf,uCAAoC;AAEnB,wFAFR,iBAAO,OAEQ;AAGX,QAAA,OAAO,GAAG,QAAQ,CAAC;AAOhC,qDAAmC;AACnC,qDAAmC;AACnC,qDAAmC;AAEnC,8CAA4B;AAC5B,6CAA2B;AAI3B,mDAAiC;AACjC,mDAAiC;AACjC,qDAAmC;AACnC,mDAAuD;AAA9C,2GAAA,cAAc,OAAA;AACvB,iDAAoD;AAA3C,4GAAA,cAAc,OAAA;AACvB,uDAA6D;AAApD,6GAAA,gBAAgB,OAAA;AACzB,2CAA+C;AAAtC,mGAAA,UAAU,OAAA;AAKnB,wDAAsC;AACtC,oDAAkC;AAGlC,qDAAmC;AAGnC,iDAA+B;AAG/B,uDAUgC;AAT9B,uGAAA,OAAO,OAAA;AACP,2GAAA,WAAW,OAAA;AACX,8GAAA,cAAc,OAAA;AACd,0GAAA,UAAU,OAAA;AACV,yGAAA,SAAS,OAAA;AACT,0GAAA,UAAU,OAAA;AACV,0GAAA,UAAU,OAAA;AACV,0GAAA,UAAU,OAAA;AACV,4GAAA,YAAY,OAAA;AAEd,6DAAsE;AAA7D,+GAAA,YAAY,OAAA;AAAE,8GAAA,WAAW,OAAA;AAGlC,gDAA8B;AAC9B,uCAAmD;AAA1C,2GAAA,kBAAkB,OAAA;AAC3B,0CAAgD;AAAvC,mGAAA,WAAW,OAAA;AACpB,6CAAmG;AAA1F,yHAAA,6BAA6B,OAAA;AAAE,4HAAA,gCAAgC,OAAA;AACxE,oDAAmD;AAA1C,gGAAA,MAAM,OAAA;AACf,uCAAqC;AAA5B,6FAAA,IAAI,OAAA;AACb,qCAA2C;AAAlC,mGAAA,WAAW,OAAA","file":"index.js","sourcesContent":["/**\n * @description The core module of VChart, containing the necessary interfaces for using VChart.\n */\n\nimport { VChart } from './vchart';\nimport { Factory } from './factory';\n\nexport { VChart, Factory };\n\n// export the version\nexport const version = \"2.0.22\";\n\n// export necessary types\nexport type { IVChart } from './interface';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\nexport type { IRegion } from '../region/interface';\n\nexport * from '../event/interface';\nexport * from '../theme/interface';\nexport * from '../model/interface';\n\nexport * from './interface';\nexport * from '../typings';\nexport type { IMarkGraphic, IGraphicContext } from '../mark/interface/';\n\n// some constants\nexport * from '../constant/base';\nexport * from '../constant/data';\nexport * from '../constant/layout';\nexport { AttributeLevel } from '../constant/attribute';\nexport { TransformLevel } from '../data/initialize';\nexport { STATE_VALUE_ENUM } from '../compile/mark/interface';\nexport { ChartEvent } from '../constant/event';\n\n/**\n * spec\n */\nexport * from '../typings/spec/index';\nexport * from '../typings/visual';\n\n// tooltip\nexport * from '../typings/tooltip';\n\n// theme\nexport * from '../theme/index';\n\n// vrender\nexport {\n vglobal,\n createGroup,\n createRichText,\n createText,\n createArc,\n createArea,\n createRect,\n createLine,\n createSymbol\n} from '@visactor/vrender-core';\nexport { ManualTicker, StreamLight } from '@visactor/vrender-animate';\n\n// utils\nexport * from '../util/space';\nexport { transformToGraphic } from '../util/style';\nexport { getSpecInfo } from '../component/util';\nexport { registerDataSetInstanceParser, registerDataSetInstanceTransform } from '../data/register';\nexport { lookup } from '../data/transforms/lookup';\nexport { warn } from '../util/debug';\nexport { measureText } from '../util/text';\n"]}
@@ -28,4 +28,4 @@ class InstanceManager {
28
28
  }
29
29
 
30
30
  exports.InstanceManager = InstanceManager, InstanceManager.instances = new Map;
31
- //# sourceMappingURL=instance-manager.js.map
31
+ //# sourceMappingURL=instance-manager.js.map
@@ -307,7 +307,7 @@ class VChart {
307
307
  if (updateResult.reMake && (this._releaseData(), this._initDataSet(), null === (_a = this._chart) || void 0 === _a || _a.release(),
308
308
  this._chart = null), updateResult.reTransformSpec && (this._chartSpecTransformer = null),
309
309
  updateResult.changeTheme ? (this._setCurrentTheme(), this._setFontFamilyTheme(this.getTheme("fontFamily"))) : updateResult.changeBackground && (null === (_b = this._compiler) || void 0 === _b || _b.setBackground(this._getBackground())),
310
- updateResult.reMake ? (null === (_c = this._compiler) || void 0 === _c || _c.releaseGrammar(),
310
+ updateResult.reMake ? (null === (_c = this._compiler) || void 0 === _c || _c.releaseGrammar(!0),
311
311
  this._userEvents.forEach((e => {
312
312
  var _a;
313
313
  return null === (_a = this._event) || void 0 === _a ? void 0 : _a.on(e.eType, e.query, e.handler);
@@ -737,8 +737,9 @@ class VChart {
737
737
  this._option.layout = layout, null === (_a = this._chart) || void 0 === _a || _a.setLayout(layout);
738
738
  }
739
739
  reLayout() {
740
- var _a;
741
- this._chart.resetLayoutItemTag(), null === (_a = this._chart) || void 0 === _a || _a.setLayoutTag(!0);
740
+ var _a, _b, _c;
741
+ null === (_a = this._chart) || void 0 === _a || _a.resetLayoutItemTag(), null === (_b = this._chart) || void 0 === _b || _b.setLayoutTag(!0, null, !1),
742
+ null === (_c = this._compiler) || void 0 === _c || _c.render();
742
743
  }
743
744
  getCompiler() {
744
745
  return this._compiler;