@visactor/vchart 2.0.4-alpha.5 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +1490 -83
  3. package/build/index.js +1490 -83
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/chart/range-area/range-area-transformer.js +2 -1
  7. package/cjs/chart/range-area/range-area-transformer.js.map +1 -1
  8. package/cjs/compile/compiler.js +4 -3
  9. package/cjs/compile/compiler.js.map +1 -1
  10. package/cjs/component/data-zoom/data-filter-base-component.d.ts +2 -0
  11. package/cjs/component/data-zoom/data-filter-base-component.js +15 -5
  12. package/cjs/component/data-zoom/data-filter-base-component.js.map +1 -1
  13. package/cjs/component/data-zoom/interface.d.ts +1 -0
  14. package/cjs/component/data-zoom/interface.js.map +1 -1
  15. package/cjs/component/marker/mark-point/cartesian-mark-point.js +2 -2
  16. package/cjs/component/marker/mark-point/cartesian-mark-point.js.map +1 -1
  17. package/cjs/constant/attribute.js +1 -2
  18. package/cjs/constant/label.js +2 -1
  19. package/cjs/constant/waterfall.js +1 -2
  20. package/cjs/constant/word-cloud.js +1 -1
  21. package/cjs/core/expression-function.js +2 -1
  22. package/cjs/core/factory.d.ts +4 -0
  23. package/cjs/core/factory.js +8 -2
  24. package/cjs/core/factory.js.map +1 -1
  25. package/cjs/core/index.d.ts +1 -1
  26. package/cjs/core/index.js +1 -1
  27. package/cjs/core/index.js.map +1 -1
  28. package/cjs/core/interface.d.ts +2 -0
  29. package/cjs/core/interface.js.map +1 -1
  30. package/cjs/core/vchart.d.ts +1 -0
  31. package/cjs/core/vchart.js +5 -2
  32. package/cjs/core/vchart.js.map +1 -1
  33. package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.d.ts +1 -1
  34. package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.js +17 -17
  35. package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.js.map +1 -1
  36. package/cjs/plugin/vchart/index.d.ts +2 -0
  37. package/cjs/plugin/vchart/index.js +21 -0
  38. package/cjs/plugin/vchart/index.js.map +1 -0
  39. package/cjs/plugin/vchart/interface.d.ts +16 -0
  40. package/cjs/plugin/vchart/interface.js +6 -0
  41. package/cjs/plugin/vchart/interface.js.map +1 -0
  42. package/cjs/plugin/vchart/plugin-service.d.ts +9 -0
  43. package/cjs/plugin/vchart/plugin-service.js +24 -0
  44. package/cjs/plugin/vchart/plugin-service.js.map +1 -0
  45. package/cjs/plugin/vchart/register.d.ts +2 -0
  46. package/cjs/plugin/vchart/register.js +12 -0
  47. package/cjs/plugin/vchart/register.js.map +1 -0
  48. package/cjs/plugin/vchart/rotate/index.d.ts +1 -0
  49. package/cjs/plugin/vchart/rotate/index.js +21 -0
  50. package/cjs/plugin/vchart/rotate/index.js.map +1 -0
  51. package/cjs/plugin/vchart/rotate/rotate.d.ts +18 -0
  52. package/cjs/plugin/vchart/rotate/rotate.js +67 -0
  53. package/cjs/plugin/vchart/rotate/rotate.js.map +1 -0
  54. package/cjs/series/word-cloud/base.js +4 -0
  55. package/cjs/series/word-cloud/base.js.map +1 -1
  56. package/cjs/typings/spec/common.d.ts +1 -0
  57. package/cjs/typings/spec/common.js.map +1 -1
  58. package/cjs/util/style.js +3 -2
  59. package/cjs/util/style.js.map +1 -1
  60. package/esm/chart/range-area/range-area-transformer.js +2 -1
  61. package/esm/chart/range-area/range-area-transformer.js.map +1 -1
  62. package/esm/compile/compiler.js +4 -3
  63. package/esm/compile/compiler.js.map +1 -1
  64. package/esm/component/data-zoom/data-filter-base-component.d.ts +2 -0
  65. package/esm/component/data-zoom/data-filter-base-component.js +16 -6
  66. package/esm/component/data-zoom/data-filter-base-component.js.map +1 -1
  67. package/esm/component/data-zoom/interface.d.ts +1 -0
  68. package/esm/component/data-zoom/interface.js.map +1 -1
  69. package/esm/component/marker/mark-point/cartesian-mark-point.js +2 -2
  70. package/esm/component/marker/mark-point/cartesian-mark-point.js.map +1 -1
  71. package/esm/constant/attribute.js +1 -2
  72. package/esm/constant/label.js +2 -1
  73. package/esm/constant/waterfall.js +1 -2
  74. package/esm/constant/word-cloud.js +1 -1
  75. package/esm/core/expression-function.js +2 -1
  76. package/esm/core/factory.d.ts +4 -0
  77. package/esm/core/factory.js +8 -1
  78. package/esm/core/factory.js.map +1 -1
  79. package/esm/core/index.d.ts +1 -1
  80. package/esm/core/index.js +1 -1
  81. package/esm/core/index.js.map +1 -1
  82. package/esm/core/interface.d.ts +2 -0
  83. package/esm/core/interface.js.map +1 -1
  84. package/esm/core/vchart.d.ts +1 -0
  85. package/esm/core/vchart.js +6 -1
  86. package/esm/core/vchart.js.map +1 -1
  87. package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.d.ts +1 -1
  88. package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.js +17 -17
  89. package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.js.map +1 -1
  90. package/esm/plugin/vchart/index.d.ts +2 -0
  91. package/esm/plugin/vchart/index.js +4 -0
  92. package/esm/plugin/vchart/index.js.map +1 -0
  93. package/esm/plugin/vchart/interface.d.ts +16 -0
  94. package/esm/plugin/vchart/interface.js +2 -0
  95. package/esm/plugin/vchart/interface.js.map +1 -0
  96. package/esm/plugin/vchart/plugin-service.d.ts +9 -0
  97. package/esm/plugin/vchart/plugin-service.js +16 -0
  98. package/esm/plugin/vchart/plugin-service.js.map +1 -0
  99. package/esm/plugin/vchart/register.d.ts +2 -0
  100. package/esm/plugin/vchart/register.js +6 -0
  101. package/esm/plugin/vchart/register.js.map +1 -0
  102. package/esm/plugin/vchart/rotate/index.d.ts +1 -0
  103. package/esm/plugin/vchart/rotate/index.js +2 -0
  104. package/esm/plugin/vchart/rotate/index.js.map +1 -0
  105. package/esm/plugin/vchart/rotate/rotate.d.ts +18 -0
  106. package/esm/plugin/vchart/rotate/rotate.js +62 -0
  107. package/esm/plugin/vchart/rotate/rotate.js.map +1 -0
  108. package/esm/series/word-cloud/base.js +4 -0
  109. package/esm/series/word-cloud/base.js.map +1 -1
  110. package/esm/typings/spec/common.d.ts +1 -0
  111. package/esm/typings/spec/common.js.map +1 -1
  112. package/esm/util/style.js +3 -2
  113. package/esm/util/style.js.map +1 -1
  114. package/package.json +8 -8
@@ -87,28 +87,26 @@ export class DomTooltipHandler extends BaseTooltipHandler {
87
87
  this._rootDom = null), this._container = null;
88
88
  }
89
89
  _updateTooltip(visible, params) {
90
- var _a, _b, _c;
90
+ var _a, _b;
91
91
  if (visible && this._rootDom) {
92
92
  const {tooltipSpec: tooltipSpec, activeTooltipSpec: activeTooltipSpec} = params;
93
93
  params.changePositionOnly || (this._tooltipActual = activeTooltipSpec);
94
- const currentVisible = this.getVisibility(), el = this._rootDom;
94
+ const el = this._rootDom;
95
95
  if (el) {
96
96
  const {x: x = 0, y: y = 0} = null !== (_a = activeTooltipSpec.position) && void 0 !== _a ? _a : {};
97
- if (tooltipSpec.updateElement) {
98
- this._updatePosition(null !== (_b = this._cacheCustomTooltipPosition) && void 0 !== _b ? _b : {
99
- x: x,
100
- y: y
101
- }), tooltipSpec.updateElement(el, activeTooltipSpec, params);
102
- const position = this._getActualTooltipPosition(activeTooltipSpec, params, {
103
- width: el.offsetWidth,
104
- height: el.offsetHeight
105
- });
106
- this._updatePosition(position), this._cacheCustomTooltipPosition = position;
107
- } else this._rootDom.style.transitionDuration = currentVisible ? null !== (_c = this._domStyle.panel.transitionDuration) && void 0 !== _c ? _c : "initial" : "0ms",
108
- this._updatePosition({
97
+ let position = {
109
98
  x: x,
110
99
  y: y
111
- });
100
+ };
101
+ const currentVisible = this.getVisibility();
102
+ tooltipSpec.updateElement && (this._updatePosition(null !== (_b = this._cacheCustomTooltipPosition) && void 0 !== _b ? _b : {
103
+ x: x,
104
+ y: y
105
+ }), tooltipSpec.updateElement(el, activeTooltipSpec, params), position = this._getActualTooltipPosition(activeTooltipSpec, params, {
106
+ width: el.offsetWidth,
107
+ height: el.offsetHeight
108
+ }), this._cacheCustomTooltipPosition = position), !currentVisible && visible && (this._rootDom.style.transition = "none",
109
+ this._updatePosition(position, !1), this._rootDom.getBoundingClientRect()), this._updatePosition(position);
112
110
  }
113
111
  this.setVisibility(visible);
114
112
  } else this.setVisibility(visible), this._cacheCustomTooltipPosition = void 0;
@@ -210,8 +208,10 @@ export class DomTooltipHandler extends BaseTooltipHandler {
210
208
  super.reInit(), this._initStyle(), this._rootDom && setStyleToDom(this._rootDom, this._domStyle.panel),
211
209
  this.getVisibility() && (this._updateDomStringByCol(this._tooltipActual), this._updateDomStyle("height", !1));
212
210
  }
213
- _updatePosition({x: x, y: y}) {
214
- this._rootDom && (this._rootDom.style.transform = `translate3d(${x}px, ${y}px, 0)`);
211
+ _updatePosition({x: x, y: y}, resetTransition = !0) {
212
+ this._rootDom && (this._rootDom.style.transform = `translate3d(${x}px, ${y}px, 0)`,
213
+ resetTransition && "" !== this._rootDom.style.transition && (this._rootDom.style.transition = "",
214
+ Object.assign(this._rootDom.style, this._domStyle.panel)));
215
215
  }
216
216
  }
217
217
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin/components/tooltip-handler/dom-tooltip-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EACL,+BAA+B,EAC/B,uBAAuB,EACvB,cAAc,EACd,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAc,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,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AAC,EAAE,CAAC,EAAE,CAAC,EAA0B;QACxD,IAAI,IAAI,CAAC,QAAQ,EAAE;YAEjB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC;SAClE;IACH,CAAC;;AA9Ye,sBAAI,GAAG,kBAAkB,CAAC,GAAG,CAAC;AAiZhD,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC5C,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;AAC7C,CAAC,CAAC","file":"dom-tooltip-handler.js","sourcesContent":["import type { ITooltipActual, ITooltipPositionActual } from '../../../typings/tooltip';\nimport { BaseTooltipHandler } from './base';\nimport { getDomStyle, getTextStyle, setStyleToDom } from './utils/style';\nimport {\n TOOLTIP_CONTAINER_EL_CLASS_NAME,\n DEFAULT_TOOLTIP_Z_INDEX,\n TOOLTIP_PREFIX,\n TOOLTIP_CONTENT_BOX_CLASS_NAME,\n TOOLTIP_TITLE_CLASS_NAME\n} from './constants';\nimport { type Maybe, isValid } from '@visactor/vutils';\nimport type { IContainerSize } from '@visactor/vrender-components';\nimport { domDocument } from '../../../util/env';\nimport type { ITooltipSpec, TooltipHandlerParams } from '../../../component/tooltip';\nimport type { IComponentPluginService } from '../interface';\nimport { registerComponentPlugin } from '../register';\nimport type { ILayoutPoint } from '../../../typings';\nimport { TooltipHandlerType } from '../../../component/tooltip/constant';\nimport { getSvgHtml } from './utils/svg';\nimport { formatContent } from './utils/common';\nimport { token } from '../../../theme/token';\nimport { calcLayoutNumber } from '../../../util/space';\n/**\n * The tooltip handler class.\n */\nexport class DomTooltipHandler extends BaseTooltipHandler {\n static readonly type = TooltipHandlerType.dom;\n readonly type = TooltipHandlerType.dom;\n\n protected _tooltipContainer = domDocument?.body;\n protected _domStyle: {\n panelPadding?: number[];\n panel: Partial<CSSStyleDeclaration>;\n row: Partial<CSSStyleDeclaration>;\n title: Partial<CSSStyleDeclaration>;\n shape: Partial<CSSStyleDeclaration>;\n key: Partial<CSSStyleDeclaration>;\n value: Partial<CSSStyleDeclaration>;\n };\n protected _rootDom?: HTMLElement;\n protected _tooltipActual?: ITooltipActual;\n protected declare _container: Maybe<HTMLDivElement>;\n\n /** 自定义 tooltip 的位置缓存 */\n protected _cacheCustomTooltipPosition: ILayoutPoint;\n\n getVisibility() {\n return this._rootDom ? this._rootDom.style.visibility === 'visible' : false;\n }\n\n setVisibility(_value: boolean) {\n // 这里做个节流\n if (_value !== this.getVisibility() && this._rootDom) {\n this._rootDom.style.visibility = _value ? 'visible' : 'hidden';\n }\n }\n\n getRootDom() {\n return this._rootDom;\n }\n\n constructor() {\n super(DomTooltipHandler.type);\n }\n\n onAdd(service: IComponentPluginService<any>): void {\n super.onAdd(service);\n this._initStyle();\n this.initEl();\n }\n\n initEl() {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n const parentElement = tooltipSpec.parentElement as HTMLElement | HTMLCanvasElement;\n if (domDocument && parentElement && parentElement.children && parentElement.children.length) {\n for (let i = 0; i < parentElement.children.length; i++) {\n if (parentElement.children[i].classList.contains(TOOLTIP_CONTAINER_EL_CLASS_NAME)) {\n this._container = parentElement.children[i] as HTMLDivElement;\n break;\n }\n }\n if (!this._container) {\n this._container = domDocument.createElement('div');\n this._container.style.position = 'relative';\n this._container.style.zIndex = DEFAULT_TOOLTIP_Z_INDEX;\n this._container.classList.add(TOOLTIP_CONTAINER_EL_CLASS_NAME);\n parentElement.appendChild(this._container);\n }\n }\n }\n\n initRootDom() {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n const tooltipElement = document.createElement('div');\n const themeFontFamily = this._chartOption?.getTheme('fontFamily');\n\n setStyleToDom(tooltipElement, {\n left: '0',\n top: '0',\n pointerEvents: 'none',\n padding: '12px',\n position: 'absolute',\n zIndex: DEFAULT_TOOLTIP_Z_INDEX,\n fontFamily: (themeFontFamily ?? token.fontFamily) as string,\n fontSize: '11px',\n borderRadius: '3px',\n borderStyle: 'solid',\n lineHeight: 'initial',\n background: '#fff',\n boxShadow: '2px 2px 4px rgba(0, 0, 0, 0.1)',\n maxWidth: '100wh',\n maxHeight: '100vh',\n visibility: 'hidden',\n ...this._domStyle.panel\n } as CSSStyleDeclaration);\n tooltipElement.classList.add(tooltipSpec.className);\n tooltipElement.setAttribute('vchart-tooltip-id', `${this.id}`);\n this._container.appendChild(tooltipElement);\n this._rootDom = tooltipElement;\n }\n\n // 计算 tooltip 内容区域的宽高,并缓存结果\n protected _getTooltipBoxSize(actualTooltip: ITooltipActual, changePositionOnly: boolean): IContainerSize | undefined {\n if (!this._rootDom) {\n this.initRootDom();\n }\n if (!changePositionOnly) {\n this._updateDomStringByCol(actualTooltip);\n }\n\n this._updateDomStyle('height', changePositionOnly);\n\n const rect = this._rootDom?.getBoundingClientRect();\n\n return {\n width: rect?.width,\n height: rect?.height\n };\n }\n\n protected _removeTooltip() {\n if (this._rootDom && this._rootDom.parentNode) {\n this._rootDom.parentNode.removeChild(this._rootDom);\n this._rootDom = null;\n }\n this._container = null;\n }\n\n protected _updateTooltip(visible: boolean, params: TooltipHandlerParams) {\n if (!visible || !this._rootDom) {\n this.setVisibility(visible);\n this._cacheCustomTooltipPosition = undefined;\n } else {\n const { tooltipSpec, activeTooltipSpec } = params;\n\n if (!params.changePositionOnly) {\n this._tooltipActual = activeTooltipSpec;\n }\n const currentVisible = this.getVisibility();\n\n // 位置\n const el = this._rootDom;\n if (el) {\n const { x = 0, y = 0 } = activeTooltipSpec.position ?? {};\n if (tooltipSpec.updateElement) {\n // 此处先设定一次位置,防止页面暂时出现滚动条(优先设置上次的位置)\n this._updatePosition(this._cacheCustomTooltipPosition ?? { x, y });\n // 更新 tooltip dom\n tooltipSpec.updateElement(el, activeTooltipSpec, params);\n // 重新计算 tooltip 位置\n const position = this._getActualTooltipPosition(activeTooltipSpec, params, {\n width: el.offsetWidth,\n height: el.offsetHeight\n });\n // 更新位置\n this._updatePosition(position);\n // 更新缓存\n this._cacheCustomTooltipPosition = position;\n } else {\n if (!currentVisible) {\n // 当从隐藏切换到显示的时候,需要先设置一次 transition 为 0ms,防止出现从一个非常远的初始位置进行动画\n this._rootDom.style.transitionDuration = '0ms';\n } else {\n this._rootDom.style.transitionDuration = this._domStyle.panel.transitionDuration ?? 'initial';\n }\n this._updatePosition({ x, y });\n }\n }\n this.setVisibility(visible);\n }\n }\n\n protected _initStyle() {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n\n this._domStyle = getDomStyle(tooltipSpec);\n }\n\n protected _updateDomStringByCol(actualTooltip?: ITooltipActual) {\n const { title = {}, content } = actualTooltip;\n const hasContent = content && content.length;\n const rowStyle = this._domStyle.row;\n const chilren = [...(this._rootDom.children as any)] as HTMLElement[];\n let titleDom = chilren.find(child => child.className.includes(TOOLTIP_TITLE_CLASS_NAME));\n let contentDom = chilren.find(child => child.className.includes(TOOLTIP_CONTENT_BOX_CLASS_NAME));\n\n if (!titleDom && title.visible !== false) {\n titleDom = document.createElement('h2');\n const span = document.createElement('span');\n titleDom.appendChild(span);\n\n titleDom.classList.add(TOOLTIP_TITLE_CLASS_NAME);\n\n // 将 titleDom 插入到 this._rootDom 中作为第一个节点\n if (this._rootDom.firstChild) {\n this._rootDom.insertBefore(titleDom, this._rootDom.firstChild);\n } else {\n this._rootDom.appendChild(titleDom);\n }\n }\n\n if (titleDom && title.visible !== false) {\n setStyleToDom(titleDom, {\n ...this._domStyle.title,\n ...(hasContent ? rowStyle : { marginBottom: '0px' }),\n marginTop: '0px'\n });\n (titleDom.firstChild as HTMLElement).innerHTML = `${title.value ?? ''}`;\n } else if (titleDom && title.visible === false) {\n titleDom.parentNode.removeChild(titleDom);\n }\n\n const columns = ['shape', 'key', 'value'];\n\n if (!contentDom && hasContent) {\n contentDom = document.createElement('div');\n\n columns.forEach(col => {\n const colDiv = document.createElement('div');\n\n colDiv.classList.add(`${TOOLTIP_PREFIX}-column`);\n colDiv.classList.add(`${TOOLTIP_PREFIX}-${col}-column`);\n colDiv.setAttribute('data-col', col);\n contentDom.appendChild(colDiv);\n });\n\n contentDom.classList.add(TOOLTIP_CONTENT_BOX_CLASS_NAME);\n this._rootDom.appendChild(contentDom);\n }\n\n if (contentDom && hasContent) {\n const columnDivs = [...(contentDom.children as any)] as HTMLElement[];\n setStyleToDom(contentDom, { whiteSpace: 'nowrap' });\n\n columnDivs.forEach((colDiv, index) => {\n const colName = colDiv.getAttribute('data-col');\n\n if (colName && columns.includes(colName)) {\n const hideColumn = colName === 'shape' && content.every(c => !c.hasShape || !c.shapeType);\n\n setStyleToDom(colDiv, {\n ...(this._domStyle as any)[colName],\n display: hideColumn ? 'none' : 'inline-block',\n verticalAlign: 'top'\n });\n const rows = [...(colDiv.children as any)] as HTMLElement[];\n\n // 删除多余的行\n rows.slice(content.length).forEach(extraRow => {\n extraRow.parentNode.removeChild(extraRow);\n });\n\n content.forEach((entry, index) => {\n let row = rows[index];\n\n if (!row) {\n row = document.createElement('div');\n row.classList.add(`${TOOLTIP_PREFIX}-${colName}`);\n colDiv.appendChild(row);\n }\n const styleByRow = {\n ...rowStyle\n };\n\n if (index === content.length - 1) {\n styleByRow.marginBottom = '0px';\n }\n\n styleByRow.display = entry.visible === false ? 'none' : 'block';\n // 每次更新,需要更新单元格的高度,防止同步高度的时候没有更新\n styleByRow.height = 'initial';\n\n if (colName === 'key') {\n row.innerHTML = formatContent(entry.key);\n if (entry.keyStyle) {\n getTextStyle(entry.keyStyle, styleByRow);\n }\n } else if (colName === 'value') {\n row.innerHTML = formatContent(entry.value);\n if (entry.valueStyle) {\n getTextStyle(entry.valueStyle, styleByRow);\n }\n } else if (colName === 'shape') {\n row.innerHTML = getSvgHtml(entry, `${this.id}_${index}`);\n }\n\n setStyleToDom(row, styleByRow);\n });\n }\n });\n } else if (contentDom && !hasContent) {\n contentDom.parentNode.removeChild(contentDom);\n }\n }\n protected _updateDomStyle(sizeKey: 'width' | 'height' = 'width', refreshSize: boolean) {\n const rootDom = this._rootDom;\n const contentDom = [...(rootDom.children as any)].find(child =>\n child.className.includes(TOOLTIP_CONTENT_BOX_CLASS_NAME)\n );\n const titleDom = [...(rootDom.children as any)].find(child => child.className.includes(TOOLTIP_TITLE_CLASS_NAME));\n\n if (contentDom) {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n const contentStyle: Partial<CSSStyleDeclaration> = {};\n const titleLabel = tooltipSpec.style?.titleLabel;\n const autoFixTitleWidth = titleLabel && titleLabel.autoWidth && titleLabel.multiLine !== false;\n\n if (autoFixTitleWidth && titleDom) {\n const maxWidth = [...(contentDom.children as any)].reduce((res, col) => {\n return sizeKey === 'height'\n ? res + col.getBoundingClientRect().width\n : Math.max(res, col.getBoundingClientRect().width);\n }, 0);\n\n if (maxWidth > 0) {\n titleDom.style.maxWidth = `${maxWidth}px`;\n // 需要再计算一次,因为之前可能因为没有设置maxWidth, content的dom被撑宽了\n titleDom.style.maxWidth = `${Math.ceil(contentDom.getBoundingClientRect().width)}px`;\n }\n }\n\n if (isValid(tooltipSpec?.style?.maxContentHeight)) {\n const titleHeight =\n titleDom && titleDom.className.includes(TOOLTIP_TITLE_CLASS_NAME)\n ? titleDom.getBoundingClientRect().height + (tooltipSpec.style.spaceRow ?? 0)\n : 0;\n const viewRect = (this._chartOption as any).getChartViewRect();\n const maxHeight = calcLayoutNumber(\n tooltipSpec.style.maxContentHeight,\n Math.min(viewRect.height, document.body.clientHeight) -\n titleHeight -\n (this._domStyle.panelPadding ? this._domStyle.panelPadding[0] + this._domStyle.panelPadding[1] : 0)\n );\n\n if (maxHeight > 0) {\n contentStyle.maxHeight = `${maxHeight}px`;\n contentStyle.overflowY = 'auto';\n // todo 让内容宽度往外阔一点,给滚动条留出位置\n contentStyle.width = `calc(100% + ${\n this._domStyle.panelPadding ? this._domStyle.panelPadding[1] + 'px' : '10px'\n })`;\n\n setStyleToDom(contentDom as HTMLElement, contentStyle);\n }\n }\n\n const rows = contentDom.children;\n const widthByCol: number[] = [];\n if (rows) {\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i];\n const cols = row.children ?? ([] as HTMLElement[]);\n\n for (let j = 0; j < cols.length; j++) {\n if (refreshSize) {\n // 每次更新,需要更新单元格的高度,防止同步高度的时候没有更新\n cols[j].style[sizeKey] = 'initial';\n }\n\n const width = cols[j].getBoundingClientRect()[sizeKey];\n if (widthByCol[j] === undefined || widthByCol[j] < width) {\n widthByCol[j] = width;\n }\n }\n }\n\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i];\n const cols = row.children ?? ([] as HTMLElement[]);\n\n for (let j = 0; j < cols.length; j++) {\n (cols[j] as HTMLElement).style[sizeKey] = `${widthByCol[j]}px`;\n }\n }\n }\n }\n }\n\n protected _getParentElement(spec: ITooltipSpec): HTMLElement {\n return this._container ?? super._getParentElement(spec);\n }\n\n isTooltipShown() {\n return this.getVisibility();\n }\n\n reInit() {\n super.reInit();\n this._initStyle();\n if (this._rootDom) {\n setStyleToDom(this._rootDom, this._domStyle.panel);\n }\n\n if (this.getVisibility()) {\n this._updateDomStringByCol(this._tooltipActual);\n this._updateDomStyle('height', false);\n }\n }\n\n protected _updatePosition({ x, y }: ITooltipPositionActual) {\n if (this._rootDom) {\n // translate3d 性能较好:https://stackoverflow.com/questions/22111256/translate3d-vs-translate-performance\n this._rootDom.style.transform = `translate3d(${x}px, ${y}px, 0)`;\n }\n }\n}\n\nexport const registerDomTooltipHandler = () => {\n registerComponentPlugin(DomTooltipHandler);\n};\n"]}
1
+ {"version":3,"sources":["../src/plugin/components/tooltip-handler/dom-tooltip-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EACL,+BAA+B,EAC/B,uBAAuB,EACvB,cAAc,EACd,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAc,OAAO,EAAE,MAAM,kBAAkB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IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAChD,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;SACvC;IACH,CAAC;IAES,eAAe,CAAC,EAAE,CAAC,EAAE,CAAC,EAA0B,EAAE,eAAe,GAAG,IAAI;QAChF,IAAI,IAAI,CAAC,QAAQ,EAAE;YAEjB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC;YACjE,IAAI,eAAe,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,KAAK,EAAE,EAAE;gBAC5D,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,GAAG,EAAE,CAAC;gBACpC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;aAC1D;SACF;IACH,CAAC;;AA/Ye,sBAAI,GAAG,kBAAkB,CAAC,GAAG,CAAC;AAkZhD,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC5C,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;AAC7C,CAAC,CAAC","file":"dom-tooltip-handler.js","sourcesContent":["import type { ITooltipActual, ITooltipPositionActual } from '../../../typings/tooltip';\nimport { BaseTooltipHandler } from './base';\nimport { getDomStyle, getTextStyle, setStyleToDom } from './utils/style';\nimport {\n TOOLTIP_CONTAINER_EL_CLASS_NAME,\n DEFAULT_TOOLTIP_Z_INDEX,\n TOOLTIP_PREFIX,\n TOOLTIP_CONTENT_BOX_CLASS_NAME,\n TOOLTIP_TITLE_CLASS_NAME\n} from './constants';\nimport { type Maybe, isValid } from '@visactor/vutils';\nimport type { IContainerSize } from '@visactor/vrender-components';\nimport { domDocument } from '../../../util/env';\nimport type { ITooltipSpec, TooltipHandlerParams } from '../../../component/tooltip';\nimport type { IComponentPluginService } from '../interface';\nimport { registerComponentPlugin } from '../register';\nimport type { ILayoutPoint } from '../../../typings';\nimport { TooltipHandlerType } from '../../../component/tooltip/constant';\nimport { getSvgHtml } from './utils/svg';\nimport { formatContent } from './utils/common';\nimport { token } from '../../../theme/token';\nimport { calcLayoutNumber } from '../../../util/space';\n/**\n * The tooltip handler class.\n */\nexport class DomTooltipHandler extends BaseTooltipHandler {\n static readonly type = TooltipHandlerType.dom;\n readonly type = TooltipHandlerType.dom;\n\n protected _tooltipContainer = domDocument?.body;\n protected _domStyle: {\n panelPadding?: number[];\n panel: Partial<CSSStyleDeclaration>;\n row: Partial<CSSStyleDeclaration>;\n title: Partial<CSSStyleDeclaration>;\n shape: Partial<CSSStyleDeclaration>;\n key: Partial<CSSStyleDeclaration>;\n value: Partial<CSSStyleDeclaration>;\n };\n protected _rootDom?: HTMLElement;\n protected _tooltipActual?: ITooltipActual;\n protected declare _container: Maybe<HTMLDivElement>;\n\n /** 自定义 tooltip 的位置缓存 */\n protected _cacheCustomTooltipPosition: ILayoutPoint;\n\n getVisibility() {\n return this._rootDom ? this._rootDom.style.visibility === 'visible' : false;\n }\n\n setVisibility(_value: boolean) {\n // 这里做个节流\n if (_value !== this.getVisibility() && this._rootDom) {\n this._rootDom.style.visibility = _value ? 'visible' : 'hidden';\n }\n }\n\n getRootDom() {\n return this._rootDom;\n }\n\n constructor() {\n super(DomTooltipHandler.type);\n }\n\n onAdd(service: IComponentPluginService<any>): void {\n super.onAdd(service);\n this._initStyle();\n this.initEl();\n }\n\n initEl() {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n const parentElement = tooltipSpec.parentElement as HTMLElement | HTMLCanvasElement;\n if (domDocument && parentElement && parentElement.children && parentElement.children.length) {\n for (let i = 0; i < parentElement.children.length; i++) {\n if (parentElement.children[i].classList.contains(TOOLTIP_CONTAINER_EL_CLASS_NAME)) {\n this._container = parentElement.children[i] as HTMLDivElement;\n break;\n }\n }\n if (!this._container) {\n this._container = domDocument.createElement('div');\n this._container.style.position = 'relative';\n this._container.style.zIndex = DEFAULT_TOOLTIP_Z_INDEX;\n this._container.classList.add(TOOLTIP_CONTAINER_EL_CLASS_NAME);\n parentElement.appendChild(this._container);\n }\n }\n }\n\n initRootDom() {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n const tooltipElement = document.createElement('div');\n const themeFontFamily = this._chartOption?.getTheme('fontFamily');\n setStyleToDom(tooltipElement, {\n left: '0',\n top: '0',\n pointerEvents: 'none',\n padding: '12px',\n position: 'absolute',\n zIndex: DEFAULT_TOOLTIP_Z_INDEX,\n fontFamily: (themeFontFamily ?? token.fontFamily) as string,\n fontSize: '11px',\n borderRadius: '3px',\n borderStyle: 'solid',\n lineHeight: 'initial',\n background: '#fff',\n boxShadow: '2px 2px 4px rgba(0, 0, 0, 0.1)',\n maxWidth: '100wh',\n maxHeight: '100vh',\n visibility: 'hidden',\n ...this._domStyle.panel\n } as CSSStyleDeclaration);\n tooltipElement.classList.add(tooltipSpec.className);\n tooltipElement.setAttribute('vchart-tooltip-id', `${this.id}`);\n this._container.appendChild(tooltipElement);\n this._rootDom = tooltipElement;\n }\n\n // 计算 tooltip 内容区域的宽高,并缓存结果\n protected _getTooltipBoxSize(actualTooltip: ITooltipActual, changePositionOnly: boolean): IContainerSize | undefined {\n if (!this._rootDom) {\n this.initRootDom();\n }\n if (!changePositionOnly) {\n this._updateDomStringByCol(actualTooltip);\n }\n\n this._updateDomStyle('height', changePositionOnly);\n\n const rect = this._rootDom?.getBoundingClientRect();\n\n return {\n width: rect?.width,\n height: rect?.height\n };\n }\n\n protected _removeTooltip() {\n if (this._rootDom && this._rootDom.parentNode) {\n this._rootDom.parentNode.removeChild(this._rootDom);\n this._rootDom = null;\n }\n this._container = null;\n }\n\n protected _updateTooltip(visible: boolean, params: TooltipHandlerParams) {\n if (!visible || !this._rootDom) {\n this.setVisibility(visible);\n this._cacheCustomTooltipPosition = undefined;\n } else {\n const { tooltipSpec, activeTooltipSpec } = params;\n\n if (!params.changePositionOnly) {\n this._tooltipActual = activeTooltipSpec;\n }\n // 位置\n const el = this._rootDom;\n if (el) {\n const { x = 0, y = 0 } = activeTooltipSpec.position ?? {};\n let position = { x, y };\n const currentVisible = this.getVisibility();\n if (tooltipSpec.updateElement) {\n // 此处先设定一次位置,防止页面暂时出现滚动条(优先设置上次的位置)\n this._updatePosition(this._cacheCustomTooltipPosition ?? { x, y });\n // 更新 tooltip dom\n tooltipSpec.updateElement(el, activeTooltipSpec, params);\n // 重新计算 tooltip 位置\n position = this._getActualTooltipPosition(activeTooltipSpec, params, {\n width: el.offsetWidth,\n height: el.offsetHeight\n });\n // 更新缓存\n this._cacheCustomTooltipPosition = position;\n }\n // 首次从false展示需要先设置一次位置,防止出现从一个非常远的初始位置进行动画\n if (!currentVisible && visible) {\n this._rootDom.style.transition = 'none';\n this._updatePosition(position, false);\n this._rootDom.getBoundingClientRect();\n }\n // 更新位置\n this._updatePosition(position);\n }\n this.setVisibility(visible);\n }\n }\n\n protected _initStyle() {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n\n this._domStyle = getDomStyle(tooltipSpec);\n }\n\n protected _updateDomStringByCol(actualTooltip?: ITooltipActual) {\n const { title = {}, content } = actualTooltip;\n const hasContent = content && content.length;\n const rowStyle = this._domStyle.row;\n const chilren = [...(this._rootDom.children as any)] as HTMLElement[];\n let titleDom = chilren.find(child => child.className.includes(TOOLTIP_TITLE_CLASS_NAME));\n let contentDom = chilren.find(child => child.className.includes(TOOLTIP_CONTENT_BOX_CLASS_NAME));\n\n if (!titleDom && title.visible !== false) {\n titleDom = document.createElement('h2');\n const span = document.createElement('span');\n titleDom.appendChild(span);\n\n titleDom.classList.add(TOOLTIP_TITLE_CLASS_NAME);\n\n // 将 titleDom 插入到 this._rootDom 中作为第一个节点\n if (this._rootDom.firstChild) {\n this._rootDom.insertBefore(titleDom, this._rootDom.firstChild);\n } else {\n this._rootDom.appendChild(titleDom);\n }\n }\n\n if (titleDom && title.visible !== false) {\n setStyleToDom(titleDom, {\n ...this._domStyle.title,\n ...(hasContent ? rowStyle : { marginBottom: '0px' }),\n marginTop: '0px'\n });\n (titleDom.firstChild as HTMLElement).innerHTML = `${title.value ?? ''}`;\n } else if (titleDom && title.visible === false) {\n titleDom.parentNode.removeChild(titleDom);\n }\n\n const columns = ['shape', 'key', 'value'];\n\n if (!contentDom && hasContent) {\n contentDom = document.createElement('div');\n\n columns.forEach(col => {\n const colDiv = document.createElement('div');\n\n colDiv.classList.add(`${TOOLTIP_PREFIX}-column`);\n colDiv.classList.add(`${TOOLTIP_PREFIX}-${col}-column`);\n colDiv.setAttribute('data-col', col);\n contentDom.appendChild(colDiv);\n });\n\n contentDom.classList.add(TOOLTIP_CONTENT_BOX_CLASS_NAME);\n this._rootDom.appendChild(contentDom);\n }\n\n if (contentDom && hasContent) {\n const columnDivs = [...(contentDom.children as any)] as HTMLElement[];\n setStyleToDom(contentDom, { whiteSpace: 'nowrap' });\n\n columnDivs.forEach((colDiv, index) => {\n const colName = colDiv.getAttribute('data-col');\n\n if (colName && columns.includes(colName)) {\n const hideColumn = colName === 'shape' && content.every(c => !c.hasShape || !c.shapeType);\n\n setStyleToDom(colDiv, {\n ...(this._domStyle as any)[colName],\n display: hideColumn ? 'none' : 'inline-block',\n verticalAlign: 'top'\n });\n const rows = [...(colDiv.children as any)] as HTMLElement[];\n\n // 删除多余的行\n rows.slice(content.length).forEach(extraRow => {\n extraRow.parentNode.removeChild(extraRow);\n });\n\n content.forEach((entry, index) => {\n let row = rows[index];\n\n if (!row) {\n row = document.createElement('div');\n row.classList.add(`${TOOLTIP_PREFIX}-${colName}`);\n colDiv.appendChild(row);\n }\n const styleByRow = {\n ...rowStyle\n };\n\n if (index === content.length - 1) {\n styleByRow.marginBottom = '0px';\n }\n\n styleByRow.display = entry.visible === false ? 'none' : 'block';\n // 每次更新,需要更新单元格的高度,防止同步高度的时候没有更新\n styleByRow.height = 'initial';\n\n if (colName === 'key') {\n row.innerHTML = formatContent(entry.key);\n if (entry.keyStyle) {\n getTextStyle(entry.keyStyle, styleByRow);\n }\n } else if (colName === 'value') {\n row.innerHTML = formatContent(entry.value);\n if (entry.valueStyle) {\n getTextStyle(entry.valueStyle, styleByRow);\n }\n } else if (colName === 'shape') {\n row.innerHTML = getSvgHtml(entry, `${this.id}_${index}`);\n }\n\n setStyleToDom(row, styleByRow);\n });\n }\n });\n } else if (contentDom && !hasContent) {\n contentDom.parentNode.removeChild(contentDom);\n }\n }\n protected _updateDomStyle(sizeKey: 'width' | 'height' = 'width', refreshSize: boolean) {\n const rootDom = this._rootDom;\n const contentDom = [...(rootDom.children as any)].find(child =>\n child.className.includes(TOOLTIP_CONTENT_BOX_CLASS_NAME)\n );\n const titleDom = [...(rootDom.children as any)].find(child => child.className.includes(TOOLTIP_TITLE_CLASS_NAME));\n\n if (contentDom) {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n const contentStyle: Partial<CSSStyleDeclaration> = {};\n const titleLabel = tooltipSpec.style?.titleLabel;\n const autoFixTitleWidth = titleLabel && titleLabel.autoWidth && titleLabel.multiLine !== false;\n\n if (autoFixTitleWidth && titleDom) {\n const maxWidth = [...(contentDom.children as any)].reduce((res, col) => {\n return sizeKey === 'height'\n ? res + col.getBoundingClientRect().width\n : Math.max(res, col.getBoundingClientRect().width);\n }, 0);\n\n if (maxWidth > 0) {\n titleDom.style.maxWidth = `${maxWidth}px`;\n // 需要再计算一次,因为之前可能因为没有设置maxWidth, content的dom被撑宽了\n titleDom.style.maxWidth = `${Math.ceil(contentDom.getBoundingClientRect().width)}px`;\n }\n }\n\n if (isValid(tooltipSpec?.style?.maxContentHeight)) {\n const titleHeight =\n titleDom && titleDom.className.includes(TOOLTIP_TITLE_CLASS_NAME)\n ? titleDom.getBoundingClientRect().height + (tooltipSpec.style.spaceRow ?? 0)\n : 0;\n const viewRect = (this._chartOption as any).getChartViewRect();\n const maxHeight = calcLayoutNumber(\n tooltipSpec.style.maxContentHeight,\n Math.min(viewRect.height, document.body.clientHeight) -\n titleHeight -\n (this._domStyle.panelPadding ? this._domStyle.panelPadding[0] + this._domStyle.panelPadding[1] : 0)\n );\n\n if (maxHeight > 0) {\n contentStyle.maxHeight = `${maxHeight}px`;\n contentStyle.overflowY = 'auto';\n // todo 让内容宽度往外阔一点,给滚动条留出位置\n contentStyle.width = `calc(100% + ${\n this._domStyle.panelPadding ? this._domStyle.panelPadding[1] + 'px' : '10px'\n })`;\n\n setStyleToDom(contentDom as HTMLElement, contentStyle);\n }\n }\n\n const rows = contentDom.children;\n const widthByCol: number[] = [];\n if (rows) {\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i];\n const cols = row.children ?? ([] as HTMLElement[]);\n\n for (let j = 0; j < cols.length; j++) {\n if (refreshSize) {\n // 每次更新,需要更新单元格的高度,防止同步高度的时候没有更新\n cols[j].style[sizeKey] = 'initial';\n }\n\n const width = cols[j].getBoundingClientRect()[sizeKey];\n if (widthByCol[j] === undefined || widthByCol[j] < width) {\n widthByCol[j] = width;\n }\n }\n }\n\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i];\n const cols = row.children ?? ([] as HTMLElement[]);\n\n for (let j = 0; j < cols.length; j++) {\n (cols[j] as HTMLElement).style[sizeKey] = `${widthByCol[j]}px`;\n }\n }\n }\n }\n }\n\n protected _getParentElement(spec: ITooltipSpec): HTMLElement {\n return this._container ?? super._getParentElement(spec);\n }\n\n isTooltipShown() {\n return this.getVisibility();\n }\n\n reInit() {\n super.reInit();\n this._initStyle();\n if (this._rootDom) {\n setStyleToDom(this._rootDom, this._domStyle.panel);\n }\n\n if (this.getVisibility()) {\n this._updateDomStringByCol(this._tooltipActual);\n this._updateDomStyle('height', false);\n }\n }\n\n protected _updatePosition({ x, y }: ITooltipPositionActual, resetTransition = true) {\n if (this._rootDom) {\n // translate3d 性能较好:https://stackoverflow.com/questions/22111256/translate3d-vs-translate-performance\n this._rootDom.style.transform = `translate3d(${x}px, ${y}px, 0)`;\n if (resetTransition && this._rootDom.style.transition !== '') {\n this._rootDom.style.transition = '';\n Object.assign(this._rootDom.style, this._domStyle.panel);\n }\n }\n }\n}\n\nexport const registerDomTooltipHandler = () => {\n registerComponentPlugin(DomTooltipHandler);\n};\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './register';
2
+ export * from './interface';
@@ -0,0 +1,4 @@
1
+ export * from "./register";
2
+
3
+ export * from "./interface";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugin/vchart/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC","file":"index.js","sourcesContent":["export * from './register';\nexport * from './interface';\n"]}
@@ -0,0 +1,16 @@
1
+ import type { IVChart } from '../../core/interface';
2
+ import type { IBasePlugin, IBasePluginService, MaybePromise } from '../base/interface';
3
+ export interface IVChartPlugin<T extends IVChartPluginService = any> extends IBasePlugin<T> {
4
+ specKey?: string;
5
+ onInit?: (service: T) => MaybePromise<void>;
6
+ }
7
+ export interface IVChartPluginConstructor {
8
+ readonly pluginType: 'vchart';
9
+ readonly specKey?: string;
10
+ readonly type: string;
11
+ new (): IVChartPlugin;
12
+ }
13
+ export interface IVChartPluginService<T extends IVChartPlugin = any> extends IBasePluginService<T> {
14
+ globalInstance: IVChart;
15
+ onInit?: () => MaybePromise<void>;
16
+ }
@@ -0,0 +1,2 @@
1
+ export { };
2
+ //# sourceMappingURL=interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugin/vchart/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { IVChart } from '../../core/interface';\nimport type { IBasePlugin, IBasePluginService, MaybePromise } from '../base/interface';\n\nexport interface IVChartPlugin<T extends IVChartPluginService = any> extends IBasePlugin<T> {\n specKey?: string;\n onInit?: (service: T) => MaybePromise<void>;\n}\n\nexport interface IVChartPluginConstructor {\n readonly pluginType: 'vchart';\n readonly specKey?: string;\n readonly type: string;\n new (): IVChartPlugin;\n}\n\nexport interface IVChartPluginService<T extends IVChartPlugin = any> extends IBasePluginService<T> {\n globalInstance: IVChart;\n onInit?: () => MaybePromise<void>;\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type { IVChartPlugin, IVChartPluginService } from './interface';
2
+ import type { IVChart } from '../../core';
3
+ import { BasePluginService } from '../base/base-plugin-service';
4
+ export declare class VChartPluginService<T extends IVChartPlugin = IVChartPlugin> extends BasePluginService<T> implements IVChartPluginService<T> {
5
+ globalInstance: IVChart;
6
+ constructor(globalInstance: IVChart);
7
+ onInit(): void;
8
+ releaseAll(): void;
9
+ }
@@ -0,0 +1,16 @@
1
+ import { BasePluginService } from "../base/base-plugin-service";
2
+
3
+ export class VChartPluginService extends BasePluginService {
4
+ constructor(globalInstance) {
5
+ super(), this.globalInstance = globalInstance;
6
+ }
7
+ onInit() {
8
+ this._plugins.forEach((plugin => {
9
+ plugin.onInit && plugin.onInit(this);
10
+ }));
11
+ }
12
+ releaseAll() {
13
+ super.releaseAll(), this.globalInstance = null;
14
+ }
15
+ }
16
+ //# sourceMappingURL=plugin-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugin/vchart/plugin-service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,OAAO,mBACX,SAAQ,iBAAoB;IAK5B,YAAY,cAAuB;QACjC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YAC7B,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,UAAU;QACR,KAAK,CAAC,UAAU,EAAE,CAAC;QACnB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC7B,CAAC;CACF","file":"plugin-service.js","sourcesContent":["import type { IVChartPlugin, IVChartPluginService } from './interface';\nimport type { IVChart } from '../../core';\nimport { BasePluginService } from '../base/base-plugin-service';\n\nexport class VChartPluginService<T extends IVChartPlugin = IVChartPlugin>\n extends BasePluginService<T>\n implements IVChartPluginService<T>\n{\n globalInstance: IVChart;\n\n constructor(globalInstance: IVChart) {\n super();\n this.globalInstance = globalInstance;\n }\n\n onInit() {\n this._plugins.forEach(plugin => {\n plugin.onInit && plugin.onInit(this);\n });\n }\n\n releaseAll(): void {\n super.releaseAll();\n this.globalInstance = null;\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import type { IVChartPluginConstructor } from './interface';
2
+ export declare const registerVChartPlugin: (plugin: IVChartPluginConstructor) => void;
@@ -0,0 +1,6 @@
1
+ import { Factory } from "../../core/factory";
2
+
3
+ export const registerVChartPlugin = plugin => {
4
+ Factory.registerVChartPlugin(plugin.type, plugin);
5
+ };
6
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugin/vchart/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAgC,EAAE,EAAE;IACvE,OAAO,CAAC,oBAAoB,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC,CAAC","file":"register.js","sourcesContent":["import { Factory } from '../../core/factory';\nimport type { IVChartPluginConstructor } from './interface';\n\nexport const registerVChartPlugin = (plugin: IVChartPluginConstructor) => {\n Factory.registerVChartPlugin(plugin.type, plugin);\n};\n"]}
@@ -0,0 +1 @@
1
+ export * from './rotate';
@@ -0,0 +1,2 @@
1
+ export * from "./rotate";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugin/vchart/rotate/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC","file":"index.js","sourcesContent":["export * from './rotate';\n"]}
@@ -0,0 +1,18 @@
1
+ import { BasePlugin } from '../../base/base-plugin';
2
+ import type { IVChartPlugin, IVChartPluginService } from '../interface';
3
+ export declare class RotatePlugin extends BasePlugin implements IVChartPlugin {
4
+ static readonly pluginType: 'vchart';
5
+ static readonly specKey = "rotate";
6
+ static readonly type: string;
7
+ readonly type: string;
8
+ private rotateDegree;
9
+ private matrix;
10
+ private vglobal_mapToCanvasPoint;
11
+ private _vchart;
12
+ constructor();
13
+ onInit(service: IVChartPluginService): void;
14
+ rotate90WithTransform: (rotateDom: HTMLElement) => void;
15
+ cancelTransform: (rotateDom: HTMLElement) => void;
16
+ release(): void;
17
+ }
18
+ export declare const registerRotatePlugin: () => void;
@@ -0,0 +1,62 @@
1
+ import { BasePlugin } from "../../base/base-plugin";
2
+
3
+ import { registerVChartPlugin } from "../register";
4
+
5
+ import { matrixAllocate, transformPointForCanvas, mapToCanvasPointForCanvas, registerGlobalEventTransformer, registerWindowEventTransformer, vglobal } from "@visactor/vrender-core";
6
+
7
+ export class RotatePlugin extends BasePlugin {
8
+ constructor() {
9
+ super(RotatePlugin.type), this.type = "rotatePlugin", this.rotate90WithTransform = rotateDom => {
10
+ this.rotateDegree = 90;
11
+ const rotateCenter = rotateDom.clientWidth < rotateDom.clientHeight ? Math.max(rotateDom.clientWidth, rotateDom.clientHeight) / 2 : Math.min(rotateDom.clientWidth, rotateDom.clientHeight) / 2, domRect = this._vchart.getContainer().getBoundingClientRect(), x1 = domRect.left, y1 = domRect.top, x2 = domRect.right, y2 = domRect.bottom;
12
+ rotateDom.style.transform = "rotate(90deg)", rotateDom.style.transformOrigin = `${rotateCenter}px ${rotateCenter}px`;
13
+ const getRect = () => ({
14
+ x1: x1,
15
+ y1: y1,
16
+ x2: x2,
17
+ y2: y2
18
+ }), getMatrix = () => {
19
+ const viewPortWidth = ("undefined" != typeof window ? {
20
+ width: window.innerWidth || document.documentElement.clientWidth,
21
+ height: window.innerHeight || document.documentElement.clientHeight
22
+ } : vglobal && "getViewportSize" in vglobal && vglobal.getViewportSize ? vglobal.getViewportSize() : rotateDom.getBoundingClientRect()).width, domRect = this._vchart.getContainer().getBoundingClientRect(), x1 = domRect.top, y1 = viewPortWidth - domRect.right, matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);
23
+ matrix.translate(x1, y1);
24
+ const centerX = rotateCenter - x1, centerY = rotateCenter - y1;
25
+ return matrix.translate(centerX, centerY), matrix.rotate(Math.PI / 2), matrix.translate(-centerX, -centerY),
26
+ this.matrix = matrix, matrix;
27
+ };
28
+ registerGlobalEventTransformer(vglobal, this._vchart.getContainer(), getMatrix, getRect, transformPointForCanvas),
29
+ registerWindowEventTransformer(this._vchart.getStage().window, this._vchart.getContainer(), getMatrix, getRect, transformPointForCanvas),
30
+ this.vglobal_mapToCanvasPoint = vglobal.mapToCanvasPoint, vglobal.mapToCanvasPoint = mapToCanvasPointForCanvas;
31
+ }, this.cancelTransform = rotateDom => {
32
+ this.rotateDegree = 0, rotateDom.style.transform = "none", rotateDom.style.transformOrigin = "none";
33
+ const domRect = this._vchart.getContainer().getBoundingClientRect(), x1 = domRect.left, y1 = domRect.top, x2 = domRect.right, y2 = domRect.bottom, getRect = () => ({
34
+ x1: x1,
35
+ y1: y1,
36
+ x2: x2,
37
+ y2: y2
38
+ }), getMatrix = () => {
39
+ const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);
40
+ return matrix.translate(x1, y1), matrix;
41
+ };
42
+ registerGlobalEventTransformer(vglobal, this._vchart.getContainer(), getMatrix, getRect, transformPointForCanvas),
43
+ registerWindowEventTransformer(this._vchart.getStage().window, this._vchart.getContainer(), getMatrix, getRect, transformPointForCanvas),
44
+ vglobal.mapToCanvasPoint = this.vglobal_mapToCanvasPoint;
45
+ };
46
+ }
47
+ onInit(service) {
48
+ const {globalInstance: vchart} = service;
49
+ vchart && (this._vchart = vchart, vchart.rotate90WithTransform = this.rotate90WithTransform,
50
+ vchart.cancelTransform = this.cancelTransform);
51
+ }
52
+ release() {
53
+ this._vchart = null, this.vglobal_mapToCanvasPoint = null, this.matrix = null, super.release();
54
+ }
55
+ }
56
+
57
+ RotatePlugin.pluginType = "vchart", RotatePlugin.specKey = "rotate", RotatePlugin.type = "rotatePlugin";
58
+
59
+ export const registerRotatePlugin = () => {
60
+ registerVChartPlugin(RotatePlugin);
61
+ };
62
+ //# sourceMappingURL=rotate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugin/vchart/rotate/rotate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,yBAAyB,EACzB,8BAA8B,EAC9B,8BAA8B,EAC9B,OAAO,EACR,MAAM,wBAAwB,CAAC;AAEhC,MAAM,OAAO,YAAa,SAAQ,UAAU;IAa1C;QACE,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QARlB,SAAI,GAAW,cAAc,CAAC;QAsBvC,0BAAqB,GAAG,CAAC,SAAsB,EAAE,EAAE;YACjD,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;YACvB,MAAM,YAAY,GAChB,SAAS,CAAC,WAAW,GAAG,SAAS,CAAC,YAAY;gBAC5C,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC;gBAC7D,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;YAClE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,qBAAqB,EAAE,CAAC;YACpE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YACxB,MAAM,EAAE,GAAG,OAAO,CAAC,GAA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AC;QACpB,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;;AAzIe,uBAAU,GAAa,QAAQ,CAAC;AAEhC,oBAAO,GAAG,QAAQ,CAAC;AAEnB,iBAAI,GAAW,cAAc,CAAC;AAwIhD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,oBAAoB,CAAC,YAAY,CAAC,CAAC;AACrC,CAAC,CAAC","file":"rotate.js","sourcesContent":["import type { IAABBBounds, Matrix } from '@visactor/vutils';\nimport { BasePlugin } from '../../base/base-plugin';\nimport type { IVChartPlugin, IVChartPluginService } from '../interface';\nimport { registerVChartPlugin } from '../register';\nimport type { IVChart } from '../../../core/interface';\nimport {\n matrixAllocate,\n transformPointForCanvas,\n mapToCanvasPointForCanvas,\n registerGlobalEventTransformer,\n registerWindowEventTransformer,\n vglobal\n} from '@visactor/vrender-core';\n\nexport class RotatePlugin extends BasePlugin implements IVChartPlugin {\n static readonly pluginType: 'vchart' = 'vchart';\n\n static readonly specKey = 'rotate';\n\n static readonly type: string = 'rotatePlugin';\n readonly type: string = 'rotatePlugin';\n\n private rotateDegree: number;\n private matrix: Matrix;\n private vglobal_mapToCanvasPoint: any; // 保存vrender中vglobal的mapToCanvasPoint原方法\n private _vchart: IVChart;\n\n constructor() {\n super(RotatePlugin.type);\n }\n\n onInit(service: IVChartPluginService) {\n const { globalInstance: vchart } = service;\n if (!vchart) {\n return;\n }\n this._vchart = vchart;\n //将函数rotate90WithTransform绑定到table实例上,一般情况下插件不需要将api绑定到table实例上,可以直接自身实现某个api功能\n vchart.rotate90WithTransform = this.rotate90WithTransform;\n vchart.cancelTransform = this.cancelTransform;\n }\n\n rotate90WithTransform = (rotateDom: HTMLElement) => {\n this.rotateDegree = 90;\n const rotateCenter =\n rotateDom.clientWidth < rotateDom.clientHeight\n ? Math.max(rotateDom.clientWidth, rotateDom.clientHeight) / 2\n : Math.min(rotateDom.clientWidth, rotateDom.clientHeight) / 2;\n const domRect = this._vchart.getContainer().getBoundingClientRect();\n const x1 = domRect.left;\n const y1 = domRect.top;\n const x2 = domRect.right;\n const y2 = domRect.bottom;\n\n rotateDom.style.transform = 'rotate(90deg)';\n rotateDom.style.transformOrigin = `${rotateCenter}px ${rotateCenter}px`;\n const getRect = () => {\n return {\n x1,\n y1,\n x2,\n y2\n } as IAABBBounds;\n };\n // 获取视口尺寸的通用方法\n const getViewportDimensions = () => {\n // 浏览器环境\n if (typeof window !== 'undefined') {\n return {\n width: window.innerWidth || document.documentElement.clientWidth,\n height: window.innerHeight || document.documentElement.clientHeight\n };\n }\n // 如果有 vglobal 上的方法可以使用\n if (vglobal && 'getViewportSize' in vglobal && vglobal.getViewportSize) {\n // @ts-ignore\n return vglobal.getViewportSize();\n }\n // 默认使用容器的尺寸\n return rotateDom.getBoundingClientRect();\n };\n\n const getMatrix = () => {\n const viewPortWidth = getViewportDimensions().width; //获取整个视口的尺寸\n const domRect = this._vchart.getContainer().getBoundingClientRect(); //TODO 这个地方应该获取窗口的宽高 最好能从vglobal上直接获取\n const x1 = domRect.top;\n const y1 = viewPortWidth - domRect.right;\n\n const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);\n matrix.translate(x1, y1);\n const centerX = rotateCenter - x1;\n const centerY = rotateCenter - y1;\n matrix.translate(centerX, centerY);\n matrix.rotate(Math.PI / 2);\n matrix.translate(-centerX, -centerY);\n this.matrix = matrix;\n return matrix;\n };\n registerGlobalEventTransformer(vglobal, this._vchart.getContainer(), getMatrix, getRect, transformPointForCanvas);\n registerWindowEventTransformer(\n this._vchart.getStage().window,\n this._vchart.getContainer(),\n getMatrix,\n getRect,\n transformPointForCanvas\n );\n this.vglobal_mapToCanvasPoint = vglobal.mapToCanvasPoint;\n vglobal.mapToCanvasPoint = mapToCanvasPointForCanvas;\n //transformPointForCanvas和mapToCanvasPointForCanvas时相对应的\n //具体逻辑在 VRender/packages/vrender-core/src/common/event-transformer.ts中\n // 可以自定义这两个函数 来修改事件属性,transformPointForCanvas中将坐标转换后存放了_canvasX _canvasY,mapToCanvasPointForCanvas中加以利用\n // 在VTable的touch文件中,利用到了_canvasX _canvasY 所以如果自定义上面两个函数也需提供_canvasX _canvasY\n };\n cancelTransform = (rotateDom: HTMLElement) => {\n this.rotateDegree = 0;\n rotateDom.style.transform = 'none';\n rotateDom.style.transformOrigin = 'none';\n const domRect = this._vchart.getContainer().getBoundingClientRect();\n const x1 = domRect.left;\n const y1 = domRect.top;\n const x2 = domRect.right;\n const y2 = domRect.bottom;\n\n const getRect = () => {\n return {\n x1,\n y1,\n x2,\n y2\n } as IAABBBounds;\n };\n const getMatrix = () => {\n const matrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0);\n matrix.translate(x1, y1);\n return matrix;\n };\n registerGlobalEventTransformer(vglobal, this._vchart.getContainer(), getMatrix, getRect, transformPointForCanvas);\n registerWindowEventTransformer(\n this._vchart.getStage().window,\n this._vchart.getContainer(),\n getMatrix,\n getRect,\n transformPointForCanvas\n );\n vglobal.mapToCanvasPoint = this.vglobal_mapToCanvasPoint;\n };\n\n release() {\n this._vchart = null;\n this.vglobal_mapToCanvasPoint = null;\n this.matrix = null;\n super.release();\n }\n}\n\nexport const registerRotatePlugin = () => {\n registerVChartPlugin(RotatePlugin);\n};\n"]}
@@ -173,6 +173,10 @@ export class BaseWordCloudSeries extends BaseSeries {
173
173
  fontFamily: this._option.getTheme("fontFamily")
174
174
  }, this._maskShape) : this._maskShape,
175
175
  onUpdateMaskCanvas: this.handleMaskCanvasUpdate,
176
+ onLayoutFinished: () => {
177
+ var _a, _b;
178
+ return null === (_b = null === (_a = this._option.globalInstance.getChart().getOption().performanceHook) || void 0 === _a ? void 0 : _a.afterWordcloudShapeDraw) || void 0 === _b ? void 0 : _b.call(_a, this._option.globalInstance);
179
+ },
176
180
  dataIndexKey: DEFAULT_DATA_KEY,
177
181
  text: wordSpec.formatMethod ? datum => wordSpec.formatMethod(datum) : {
178
182
  field: this._textField
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/series/word-cloud/base.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACtG,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,EACX,MAAM,UAAU,CAAC;AASlB,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIrD,MAAM,OAAO,mBAAmF,SAAQ,UAAa;IAArH;;QAoBY,mBAAc,GAA+B,CA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,MAAW,EAAE,MAAY;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,cAAc;QAEZ,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,mBAAmB;QAEjB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,kBAAkB;QAEhB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,WAAW;QACT,KAAK,CAAC,WAAW,EAAE,CAAC;QACpB,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1B,CAAC;IAED,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,IAAI,IAAI,CAAC,qBAAqB,EAAE;YAC9B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;SACnC;QAED,IAAI,IAAI,CAAC,qBAAqB,EAAE;YAC9B,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC;SACnC;IACH,CAAC;;AAvde,wBAAI,GAAkB,mBAAmB,CAAC;AAC1C,gCAAY,GAA0C,EAAE,SAAS,EAAE,CAAC","file":"base.js","sourcesContent":["/* eslint-disable no-duplicate-imports */\nimport type { IPadding } from '@visactor/vutils';\nimport { isNil, isObject, isValidNumber } from '@visactor/vutils';\nimport { isValid } from '@visactor/vutils';\nimport { DEFAULT_DATA_INDEX, DEFAULT_DATA_KEY, DEFAULT_DATA_SERIES_FIELD } from '../../constant/data';\nimport { AttributeLevel } from '../../constant/attribute';\nimport type { SeriesMarkMap } from '../interface';\nimport { SeriesMarkNameEnum } from '../interface/type';\nimport { isTrueBrowser } from '../../util/env';\nimport {\n DEFAULT_DRAW_OUT_OF_BOUND,\n DEFAULT_FONTSIZE_RANGE,\n DEFAULT_FONT_PADDING,\n DEFAULT_FONT_WEIGHT_RANGE,\n DEFAULT_MASK_SHAPE,\n DEFAULT_MIN_FONT_SIZE,\n DEFAULT_RANDOM,\n DEFAULT_ROTATE_ANGLES,\n DEFAULT_ZOOM_TO_FIT,\n SHAPE_TYPE\n} from './config';\nimport type {\n IWordCloudSeriesSpec,\n IWordCloudSeriesTheme,\n WordCloudConfigType,\n WordCloudShapeConfigType,\n WordCloudShapeType\n} from './interface';\nimport type { Datum, IMarkSpec, IPoint, ITextMarkSpec } from '../../typings';\nimport { animationConfig, userAnimationConfig } from '../../animation/utils';\nimport { WORD_CLOUD_TEXT } from '../../constant/word-cloud';\nimport { BaseSeries } from '../base/base-series';\nimport { ColorOrdinalScale } from '../../scale/color-ordinal-scale';\nimport { wordCloudSeriesMark } from './constant';\nimport type { IStateAnimateSpec } from '../../animation/spec';\nimport { Factory } from '../../core/factory';\nimport type { IMark, IRectMark, ITextMark } from '../../mark/interface';\nimport { LinearScale } from '@visactor/vscale';\nimport type { GeometricMaskShape, TextShapeMask } from '@visactor/vlayouts';\nimport type { ITransformSpec } from '../../compile/interface';\nimport { vglobal, getTextBounds, createImage } from '@visactor/vrender-core';\nimport { wordCloud } from '../../theme/builtin/common/series/word-cloud';\nimport { LayoutZIndex } from '../../constant/layout';\n\nexport type IBaseWordCloudSeriesSpec = Omit<IWordCloudSeriesSpec, 'type'> & { type: string };\n\nexport class BaseWordCloudSeries<T extends IBaseWordCloudSeriesSpec = IBaseWordCloudSeriesSpec> extends BaseSeries<T> {\n static readonly mark: SeriesMarkMap = wordCloudSeriesMark;\n static readonly builtInTheme: Record<string, IWordCloudSeriesTheme> = { wordCloud };\n\n protected _nameField: string;\n protected _valueField?: string;\n setValueField(field: string) {\n if (isValid(field)) {\n this._valueField = field;\n }\n }\n\n protected _colorMode: 'linear' | 'ordinal';\n protected _colorList: string[];\n protected _rotateAngles?: number[];\n protected _fontWeightRange?: [number, number];\n protected _textField?: string;\n protected _maskCanvas?: HTMLCanvasElement;\n protected _maskMark?: IRectMark;\n\n protected _fontSizeRange?: [number, number] | 'auto' = [DEFAULT_MIN_FONT_SIZE, DEFAULT_MIN_FONT_SIZE];\n setFontSizeRange(fontSizeRange: [number, number] | 'auto') {\n if (isValid(fontSizeRange)) {\n this._fontSizeRange = fontSizeRange;\n } else {\n this._fontSizeRange = DEFAULT_FONTSIZE_RANGE;\n }\n }\n\n protected _maskShape?: string | WordCloudShapeType | TextShapeMask | GeometricMaskShape;\n protected _isWordCloudShape: boolean = false;\n\n protected _wordCloudConfig?: WordCloudConfigType;\n protected _wordCloudShapeConfig?: WordCloudShapeConfigType;\n\n protected _padding?: IPadding;\n protected _defaultFontFamily: string;\n\n protected _keyWordColorCallback: (datum: Datum) => string;\n protected _fillingColorCallback: (datum: Datum) => string;\n protected _dataChange: boolean = true;\n\n protected handleMaskCanvasUpdate = (canvas: HTMLCanvasElement, imageUrl?: string) => {\n this._maskCanvas = canvas;\n };\n /**\n * @override\n */\n setAttrFromSpec() {\n super.setAttrFromSpec();\n // series布局相关\n this._padding = this._option.getChart().padding;\n\n // 普通词云 & 形状词云 共有spec相关\n this._nameField = this._spec.nameField;\n this._colorMode = this._spec.colorMode ?? 'ordinal';\n this._colorList = this._spec.colorList;\n this.setValueField(this._spec.valueField);\n this._fontWeightRange = this._spec.fontWeightRange ?? DEFAULT_FONT_WEIGHT_RANGE;\n this._rotateAngles = this._spec.rotateAngles ?? DEFAULT_ROTATE_ANGLES;\n this.setFontSizeRange(this._spec.fontSizeRange);\n this._maskShape = this._spec.maskShape ?? DEFAULT_MASK_SHAPE;\n this._textField = this._spec.word?.formatMethod ? WORD_CLOUD_TEXT : this._nameField;\n const wordCloudConfig = this._spec.wordCloudConfig;\n // 普通词云spec相关\n this._wordCloudConfig = {\n drawOutOfBound: DEFAULT_DRAW_OUT_OF_BOUND,\n layoutMode: 'default',\n zoomToFit: DEFAULT_ZOOM_TO_FIT,\n ...this._spec.wordCloudConfig\n };\n\n if ((!wordCloudConfig || isNil(wordCloudConfig.layoutMode)) && !isTrueBrowser(this._option.mode)) {\n this._wordCloudConfig.layoutMode = 'fast';\n }\n\n // 形状词云spec相关\n this._wordCloudShapeConfig = {\n fillingSeriesField: this.getSeriesField(),\n fillingRotateAngles: DEFAULT_ROTATE_ANGLES,\n layoutMode: 'default',\n ...this._spec.wordCloudShapeConfig\n };\n\n this._isWordCloudShape =\n !SHAPE_TYPE.includes(this._maskShape as string) &&\n !['fast', 'grid', 'cloud'].includes(this._wordCloudConfig.layoutMode);\n this._defaultFontFamily = this._option.getTheme('fontFamily') as string;\n }\n\n /**\n * @override\n */\n protected initData(): void {\n super.initData();\n // data改变时, 需要重新编译, 重新布局\n this.getViewData()?.target?.addListener('change', () => {\n this._dataChange = true;\n this.compile();\n });\n }\n\n protected _wordMark: ITextMark;\n\n initMark(): void {\n this._wordMark = this._createMark(\n BaseWordCloudSeries.mark.word,\n {\n key: DEFAULT_DATA_KEY,\n groupKey: this._seriesField,\n isSeriesMark: true\n },\n {\n morphElementKey: this._seriesField\n }\n ) as ITextMark;\n if (this._spec.wordMask?.visible) {\n this._maskMark = this._createMark(BaseWordCloudSeries.mark.wordMask, { dataView: false }) as IRectMark;\n\n this._maskMark.setMarkConfig({\n zIndex: LayoutZIndex.Mark - 1\n });\n }\n }\n\n initMarkStyle() {\n this.initMarkStyleOfWord(this._wordMark, this._spec.word, this._spec.colorHexField, this._seriesField);\n\n if (this._maskMark) {\n this.setMarkStyle(\n this._maskMark,\n {\n width: () => {\n return this._region.getLayoutRect().width;\n },\n height: () => {\n return this._region.getLayoutRect().height;\n },\n background: () => {\n return this._maskCanvas;\n }\n },\n 'normal',\n AttributeLevel.Series\n );\n }\n }\n\n initMarkStyleOfWord(\n wordMark: ITextMark,\n wordSpec?: IMarkSpec<ITextMarkSpec>,\n colorHexField?: string,\n seriesField?: string,\n isFillingWord?: boolean\n ): void {\n if (!wordMark) {\n return;\n }\n this.setMarkStyle(\n wordMark,\n {\n text: (wordSpec as any)?.formatMethod\n ? (datum: Datum) => {\n return (wordSpec as any).formatMethod(datum);\n }\n : (datum: Datum) => datum[this._textField],\n x: (datum: Datum) => datum.x,\n y: (datum: Datum) => datum.y,\n fontSize: (datum: Datum) => datum.fontSize,\n fontStyle: (datum: Datum) => datum.fontStyle,\n\n angle: (datum: Datum) => datum.angle,\n visible: (datum: Datum) => datum.visible\n },\n 'normal',\n AttributeLevel.Series\n );\n this.setMarkStyle(\n wordMark,\n {\n fill: wordSpec?.style?.fill ?? this.getWordColor,\n // style和field相关的配置都已经传给vgrammar, 所以这里直接拿结果就可以\n fontWeight: (datum: Datum) => datum.fontWeight,\n fontFamily: (datum: Datum) => datum.fontFamily\n },\n 'normal',\n AttributeLevel.User_Mark\n );\n }\n\n protected initTooltip() {\n super.initTooltip();\n\n this._wordMark && this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark);\n }\n\n initAnimation() {\n [this._wordMark].forEach(mark => {\n if (mark) {\n const appearPreset = (this._spec?.animationAppear as IStateAnimateSpec<any>)?.preset;\n const params = {\n animationConfig: () => mark.getAnimationConfig()?.appear?.[0]\n };\n mark.setAnimationConfig(\n animationConfig(\n Factory.getAnimationInKey('wordCloud')(params, appearPreset),\n userAnimationConfig(SeriesMarkNameEnum.word, this._spec, this._markAttributeContext)\n )\n );\n }\n });\n }\n\n protected getWordOrdinalColorScale(field: string, isFillingWord: boolean) {\n const colorList = isFillingWord ? this._wordCloudShapeConfig.fillingColorList : this._colorList;\n const colorDomain = field ? this.getViewData()?.latestData.map((datum: Datum) => datum[field]) : [];\n const colorRange = colorList ?? this._option.globalScale.getScale('color')?.range() ?? this._getDataScheme();\n return new ColorOrdinalScale().domain(colorDomain).range?.(colorRange);\n }\n\n protected initColorCallback(field: string, isFillingWord: boolean) {\n if (this._colorMode === 'ordinal') {\n const scale = this.getWordOrdinalColorScale(field, isFillingWord);\n return (datum: Datum) => {\n return scale.scale(datum[field ?? DEFAULT_DATA_SERIES_FIELD]);\n };\n }\n\n const colorList =\n (isFillingWord ? this._colorList : this._wordCloudShapeConfig.fillingColorList) ??\n this._option.globalScale.getScale('color').range();\n\n if (colorList.length === 1) {\n return (datum: Datum) => colorList[0];\n }\n\n if (this._valueField) {\n const stats = this.getRawDataStatisticsByField(this._valueField, true);\n if (stats.min === stats.max) {\n return colorList[0];\n }\n const scale = new LinearScale().domain([stats.min, stats.max]).range(colorList);\n\n return (datum: Datum) => {\n return scale.scale(datum[this._valueField]);\n };\n }\n\n const scale = new LinearScale().domain([0, this.getViewData()?.latestData?.length ?? 1]).range(colorList);\n\n return (datum: Datum) => {\n return scale.scale(datum[DEFAULT_DATA_INDEX]);\n };\n }\n\n getWordColor = (datum: Datum) => {\n if (datum.isFillingWord) {\n if (!this._fillingColorCallback || this._dataChange) {\n // 如果updateData数据变更了, 颜色映射也需要重新计算\n this._fillingColorCallback = this._wordCloudShapeConfig.fillingColorHexField\n ? (datum: Datum) => datum[this._wordCloudShapeConfig.fillingColorHexField]\n : this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField, true);\n }\n\n return this._fillingColorCallback(datum);\n }\n\n if (!this._keyWordColorCallback || this._dataChange) {\n // 如果updateData数据变更了, 颜色映射也需要重新计算\n this._keyWordColorCallback = this._spec.colorHexField\n ? datum => datum[this._spec.colorHexField]\n : this.initColorCallback(this._seriesField, false);\n }\n\n return this._keyWordColorCallback(datum);\n };\n\n private _calculateFontWeight = (datum: Datum) => {\n const stats = this.getRawDataStatisticsByField(this._valueField, true);\n\n if (stats.min === stats.max) {\n return this._fontWeightRange[0];\n }\n\n return (\n this._fontWeightRange[0] +\n ((this._fontWeightRange[this._fontWeightRange.length - 1] - this._fontWeightRange[0]) *\n (datum[this._valueField] - stats.min)) /\n (stats.max - stats.min)\n );\n };\n\n compile(): void {\n super.compile();\n const { width, height } = this._region.getLayoutRect();\n // 非正常尺寸下不进行布局\n if (!isValidNumber(width) || !isValidNumber(height) || !(height > 0 && width > 0)) {\n return;\n }\n\n const wordCloudTransforms: ITransformSpec[] = [];\n\n // 词云 transform\n if (!this._isWordCloudShape) {\n wordCloudTransforms.push({\n type: 'wordcloud',\n ...this._wordCloudTransformOption()\n });\n }\n // 形状词云 transform\n else {\n wordCloudTransforms.push({\n type: 'wordcloudShape',\n // 形状词云中必须要传入dataIndexKey, 否则填充词无法绘制\n ...this._wordCloudShapeTransformOption()\n });\n }\n\n // 挂到mark的transform上\n this._wordMark.setTransform(wordCloudTransforms);\n }\n\n protected _getCommonTransformOptions(): any {\n const { width, height } = this._region.getLayoutRect();\n const wordSpec = this._spec.word ?? {};\n const wordStyleSpec = wordSpec.style ?? {};\n\n return {\n size: [width, height],\n shape:\n isObject(this._maskShape) &&\n (this._maskShape as TextShapeMask).type === 'text' &&\n isNil((this._maskShape as TextShapeMask).fontFamily)\n ? {\n fontFamily: this._option.getTheme('fontFamily'),\n ...this._maskShape\n }\n : this._maskShape,\n onUpdateMaskCanvas: this.handleMaskCanvasUpdate,\n dataIndexKey: DEFAULT_DATA_KEY,\n text: wordSpec.formatMethod\n ? (datum: Datum) => {\n return wordSpec.formatMethod(datum);\n }\n : { field: this._textField },\n fontSize: this._valueField ? { field: this._valueField } : this._fontSizeRange[0],\n fontSizeRange: this._fontSizeRange === 'auto' ? null : this._fontSizeRange,\n\n padding: this._spec.word?.padding ?? DEFAULT_FONT_PADDING,\n fontFamily: isValid(this._spec.fontFamilyField)\n ? { field: this._spec.fontFamilyField }\n : wordStyleSpec.fontFamily ?? this._defaultFontFamily,\n // 为了保持和旧版逻辑一致,优先级如下: spec field > mark style > default (根据valueField映射)\n fontWeight: isValid(this._spec.fontWeightField)\n ? { field: this._spec.fontWeightField }\n : isValid(wordStyleSpec.fontWeight)\n ? wordStyleSpec.fontWeight\n : isValid(this._valueField)\n ? this._calculateFontWeight\n : 'normal',\n fontStyle: isValid(this._spec.fontStyleField) ? { field: this._spec.fontStyleField } : wordStyleSpec.fontStyle,\n createCanvas: vglobal.createCanvas.bind(vglobal),\n getTextBounds\n };\n }\n\n protected _wordCloudTransformOption(): Object {\n const wordCloudConfig = this._wordCloudConfig ?? {};\n\n return {\n ...wordCloudConfig,\n ...this._getCommonTransformOptions(),\n // TIP: 非浏览器环境下,使用 fast 布局,否则会出现兼容问题\n layoutType: this._wordCloudConfig.layoutMode,\n\n rotate: this._rotateAngles,\n\n randomVisible: this._spec.random ?? DEFAULT_RANDOM,\n clip: this._wordCloudConfig.drawOutOfBound === 'clip',\n shrink: this._wordCloudConfig.zoomToFit.shrink,\n enlarge: this._wordCloudConfig.zoomToFit.enlarge,\n minFontSize: this._wordCloudConfig.zoomToFit.fontSizeLimitMin,\n progressiveTime: this._wordCloudConfig.progressiveTime,\n progressiveStep: this._wordCloudConfig.progressiveStep,\n repeatFill: this._wordCloudConfig.zoomToFit.repeat\n };\n }\n\n protected _wordCloudShapeTransformOption(): Object {\n const fillingWordStyleSpec = this._spec.fillingWord?.style ?? {};\n const wordCloudShapeConfig = this._wordCloudShapeConfig ?? {};\n\n return {\n ...wordCloudShapeConfig,\n ...this._getCommonTransformOptions(),\n createImage,\n\n rotateList: this._rotateAngles,\n fillingRotateList: wordCloudShapeConfig.fillingRotateAngles,\n\n fillingFontFamily: isValid(wordCloudShapeConfig.fillingFontFamilyField)\n ? { field: wordCloudShapeConfig.fillingFontFamilyField }\n : fillingWordStyleSpec.fontFamily ?? this._defaultFontFamily,\n fillingPadding: this._spec.fillingWord?.padding ?? DEFAULT_FONT_PADDING,\n fillingFontStyle: isValid(wordCloudShapeConfig.fillingFontStyleField)\n ? { field: wordCloudShapeConfig.fillingFontStyleField }\n : fillingWordStyleSpec.fontStyle,\n // 如果配置了字段映射,优先按照映射进行展示\n fillingFontWeight: isValid(wordCloudShapeConfig.fillingFontWeightField)\n ? {\n field: wordCloudShapeConfig.fillingFontWeightField\n }\n : fillingWordStyleSpec.fontWeight // 填充词fontWeight默认不跟随valueField\n };\n }\n\n getStatisticFields() {\n const fields: { key: string; operations: Array<'max' | 'min' | 'values'> }[] = [];\n fields.push({ key: this._nameField, operations: ['values'] });\n fields.push({ key: this._valueField, operations: ['max', 'min'] });\n return fields;\n }\n dataToPosition(data: Datum): IPoint {\n return null;\n }\n dataToPositionX(data: any): number {\n return null;\n }\n dataToPositionY(data: any): number {\n return null;\n }\n dataToPositionZ(data: any): number {\n return null;\n }\n valueToPosition(value1: any, value2?: any): IPoint {\n return null;\n }\n\n getGroupFields(): string[] {\n // do nothing\n return [];\n }\n\n getStackGroupFields(): string[] {\n // do nothing\n return [];\n }\n\n getStackValueField(): string {\n // do nothing\n return '';\n }\n\n onLayoutEnd(): void {\n super.onLayoutEnd();\n this.compile();\n this._dataChange = false;\n }\n\n getActiveMarks(): IMark[] {\n return [this._wordMark];\n }\n\n reInit() {\n super.reInit();\n if (this._keyWordColorCallback) {\n this._keyWordColorCallback = null;\n }\n\n if (this._fillingColorCallback) {\n this._fillingColorCallback = null;\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/series/word-cloud/base.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACtG,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,EACX,MAAM,UAAU,CAAC;AASlB,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,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;AA5de,wBAAI,GAAkB,mBAAmB,CAAC;AAC1C,gCAAY,GAA0C,EAAE,SAAS,EAAE,CAAC","file":"base.js","sourcesContent":["/* eslint-disable no-duplicate-imports */\nimport type { IPadding } from '@visactor/vutils';\nimport { isNil, isObject, isValidNumber } from '@visactor/vutils';\nimport { isValid } from '@visactor/vutils';\nimport { DEFAULT_DATA_INDEX, DEFAULT_DATA_KEY, DEFAULT_DATA_SERIES_FIELD } from '../../constant/data';\nimport { AttributeLevel } from '../../constant/attribute';\nimport type { SeriesMarkMap } from '../interface';\nimport { SeriesMarkNameEnum } from '../interface/type';\nimport { isTrueBrowser } from '../../util/env';\nimport {\n DEFAULT_DRAW_OUT_OF_BOUND,\n DEFAULT_FONTSIZE_RANGE,\n DEFAULT_FONT_PADDING,\n DEFAULT_FONT_WEIGHT_RANGE,\n DEFAULT_MASK_SHAPE,\n DEFAULT_MIN_FONT_SIZE,\n DEFAULT_RANDOM,\n DEFAULT_ROTATE_ANGLES,\n DEFAULT_ZOOM_TO_FIT,\n SHAPE_TYPE\n} from './config';\nimport type {\n IWordCloudSeriesSpec,\n IWordCloudSeriesTheme,\n WordCloudConfigType,\n WordCloudShapeConfigType,\n WordCloudShapeType\n} from './interface';\nimport type { Datum, IMarkSpec, IPoint, ITextMarkSpec } from '../../typings';\nimport { animationConfig, userAnimationConfig } from '../../animation/utils';\nimport { WORD_CLOUD_TEXT } from '../../constant/word-cloud';\nimport { BaseSeries } from '../base/base-series';\nimport { ColorOrdinalScale } from '../../scale/color-ordinal-scale';\nimport { wordCloudSeriesMark } from './constant';\nimport type { IStateAnimateSpec } from '../../animation/spec';\nimport { Factory } from '../../core/factory';\nimport type { IMark, IRectMark, ITextMark } from '../../mark/interface';\nimport { LinearScale } from '@visactor/vscale';\nimport type { GeometricMaskShape, TextShapeMask } from '@visactor/vlayouts';\nimport type { ITransformSpec } from '../../compile/interface';\nimport { vglobal, getTextBounds, createImage } from '@visactor/vrender-core';\nimport { wordCloud } from '../../theme/builtin/common/series/word-cloud';\nimport { LayoutZIndex } from '../../constant/layout';\n\nexport type IBaseWordCloudSeriesSpec = Omit<IWordCloudSeriesSpec, 'type'> & { type: string };\n\nexport class BaseWordCloudSeries<T extends IBaseWordCloudSeriesSpec = IBaseWordCloudSeriesSpec> extends BaseSeries<T> {\n static readonly mark: SeriesMarkMap = wordCloudSeriesMark;\n static readonly builtInTheme: Record<string, IWordCloudSeriesTheme> = { wordCloud };\n\n protected _nameField: string;\n protected _valueField?: string;\n setValueField(field: string) {\n if (isValid(field)) {\n this._valueField = field;\n }\n }\n\n protected _colorMode: 'linear' | 'ordinal';\n protected _colorList: string[];\n protected _rotateAngles?: number[];\n protected _fontWeightRange?: [number, number];\n protected _textField?: string;\n protected _maskCanvas?: HTMLCanvasElement;\n protected _maskMark?: IRectMark;\n\n protected _fontSizeRange?: [number, number] | 'auto' = [DEFAULT_MIN_FONT_SIZE, DEFAULT_MIN_FONT_SIZE];\n setFontSizeRange(fontSizeRange: [number, number] | 'auto') {\n if (isValid(fontSizeRange)) {\n this._fontSizeRange = fontSizeRange;\n } else {\n this._fontSizeRange = DEFAULT_FONTSIZE_RANGE;\n }\n }\n\n protected _maskShape?: string | WordCloudShapeType | TextShapeMask | GeometricMaskShape;\n protected _isWordCloudShape: boolean = false;\n\n protected _wordCloudConfig?: WordCloudConfigType;\n protected _wordCloudShapeConfig?: WordCloudShapeConfigType;\n\n protected _padding?: IPadding;\n protected _defaultFontFamily: string;\n\n protected _keyWordColorCallback: (datum: Datum) => string;\n protected _fillingColorCallback: (datum: Datum) => string;\n protected _dataChange: boolean = true;\n\n protected handleMaskCanvasUpdate = (canvas: HTMLCanvasElement, imageUrl?: string) => {\n this._maskCanvas = canvas;\n };\n /**\n * @override\n */\n setAttrFromSpec() {\n super.setAttrFromSpec();\n // series布局相关\n this._padding = this._option.getChart().padding;\n\n // 普通词云 & 形状词云 共有spec相关\n this._nameField = this._spec.nameField;\n this._colorMode = this._spec.colorMode ?? 'ordinal';\n this._colorList = this._spec.colorList;\n this.setValueField(this._spec.valueField);\n this._fontWeightRange = this._spec.fontWeightRange ?? DEFAULT_FONT_WEIGHT_RANGE;\n this._rotateAngles = this._spec.rotateAngles ?? DEFAULT_ROTATE_ANGLES;\n this.setFontSizeRange(this._spec.fontSizeRange);\n this._maskShape = this._spec.maskShape ?? DEFAULT_MASK_SHAPE;\n this._textField = this._spec.word?.formatMethod ? WORD_CLOUD_TEXT : this._nameField;\n const wordCloudConfig = this._spec.wordCloudConfig;\n // 普通词云spec相关\n this._wordCloudConfig = {\n drawOutOfBound: DEFAULT_DRAW_OUT_OF_BOUND,\n layoutMode: 'default',\n zoomToFit: DEFAULT_ZOOM_TO_FIT,\n ...this._spec.wordCloudConfig\n };\n\n if ((!wordCloudConfig || isNil(wordCloudConfig.layoutMode)) && !isTrueBrowser(this._option.mode)) {\n this._wordCloudConfig.layoutMode = 'fast';\n }\n\n // 形状词云spec相关\n this._wordCloudShapeConfig = {\n fillingSeriesField: this.getSeriesField(),\n fillingRotateAngles: DEFAULT_ROTATE_ANGLES,\n layoutMode: 'default',\n ...this._spec.wordCloudShapeConfig\n };\n\n this._isWordCloudShape =\n !SHAPE_TYPE.includes(this._maskShape as string) &&\n !['fast', 'grid', 'cloud'].includes(this._wordCloudConfig.layoutMode);\n this._defaultFontFamily = this._option.getTheme('fontFamily') as string;\n }\n\n /**\n * @override\n */\n protected initData(): void {\n super.initData();\n // data改变时, 需要重新编译, 重新布局\n this.getViewData()?.target?.addListener('change', () => {\n this._dataChange = true;\n this.compile();\n });\n }\n\n protected _wordMark: ITextMark;\n\n initMark(): void {\n this._wordMark = this._createMark(\n BaseWordCloudSeries.mark.word,\n {\n key: DEFAULT_DATA_KEY,\n groupKey: this._seriesField,\n isSeriesMark: true\n },\n {\n morphElementKey: this._seriesField\n }\n ) as ITextMark;\n if (this._spec.wordMask?.visible) {\n this._maskMark = this._createMark(BaseWordCloudSeries.mark.wordMask, { dataView: false }) as IRectMark;\n\n this._maskMark.setMarkConfig({\n zIndex: LayoutZIndex.Mark - 1\n });\n }\n }\n\n initMarkStyle() {\n this.initMarkStyleOfWord(this._wordMark, this._spec.word, this._spec.colorHexField, this._seriesField);\n\n if (this._maskMark) {\n this.setMarkStyle(\n this._maskMark,\n {\n width: () => {\n return this._region.getLayoutRect().width;\n },\n height: () => {\n return this._region.getLayoutRect().height;\n },\n background: () => {\n return this._maskCanvas;\n }\n },\n 'normal',\n AttributeLevel.Series\n );\n }\n }\n\n initMarkStyleOfWord(\n wordMark: ITextMark,\n wordSpec?: IMarkSpec<ITextMarkSpec>,\n colorHexField?: string,\n seriesField?: string,\n isFillingWord?: boolean\n ): void {\n if (!wordMark) {\n return;\n }\n this.setMarkStyle(\n wordMark,\n {\n text: (wordSpec as any)?.formatMethod\n ? (datum: Datum) => {\n return (wordSpec as any).formatMethod(datum);\n }\n : (datum: Datum) => datum[this._textField],\n x: (datum: Datum) => datum.x,\n y: (datum: Datum) => datum.y,\n fontSize: (datum: Datum) => datum.fontSize,\n fontStyle: (datum: Datum) => datum.fontStyle,\n\n angle: (datum: Datum) => datum.angle,\n visible: (datum: Datum) => datum.visible\n },\n 'normal',\n AttributeLevel.Series\n );\n this.setMarkStyle(\n wordMark,\n {\n fill: wordSpec?.style?.fill ?? this.getWordColor,\n // style和field相关的配置都已经传给vgrammar, 所以这里直接拿结果就可以\n fontWeight: (datum: Datum) => datum.fontWeight,\n fontFamily: (datum: Datum) => datum.fontFamily\n },\n 'normal',\n AttributeLevel.User_Mark\n );\n }\n\n protected initTooltip() {\n super.initTooltip();\n\n this._wordMark && this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark);\n }\n\n initAnimation() {\n [this._wordMark].forEach(mark => {\n if (mark) {\n const appearPreset = (this._spec?.animationAppear as IStateAnimateSpec<any>)?.preset;\n const params = {\n animationConfig: () => mark.getAnimationConfig()?.appear?.[0]\n };\n mark.setAnimationConfig(\n animationConfig(\n Factory.getAnimationInKey('wordCloud')(params, appearPreset),\n userAnimationConfig(SeriesMarkNameEnum.word, this._spec, this._markAttributeContext)\n )\n );\n }\n });\n }\n\n protected getWordOrdinalColorScale(field: string, isFillingWord: boolean) {\n const colorList = isFillingWord ? this._wordCloudShapeConfig.fillingColorList : this._colorList;\n const colorDomain = field ? this.getViewData()?.latestData.map((datum: Datum) => datum[field]) : [];\n const colorRange = colorList ?? this._option.globalScale.getScale('color')?.range() ?? this._getDataScheme();\n return new ColorOrdinalScale().domain(colorDomain).range?.(colorRange);\n }\n\n protected initColorCallback(field: string, isFillingWord: boolean) {\n if (this._colorMode === 'ordinal') {\n const scale = this.getWordOrdinalColorScale(field, isFillingWord);\n return (datum: Datum) => {\n return scale.scale(datum[field ?? DEFAULT_DATA_SERIES_FIELD]);\n };\n }\n\n const colorList =\n (isFillingWord ? this._colorList : this._wordCloudShapeConfig.fillingColorList) ??\n this._option.globalScale.getScale('color').range();\n\n if (colorList.length === 1) {\n return (datum: Datum) => colorList[0];\n }\n\n if (this._valueField) {\n const stats = this.getRawDataStatisticsByField(this._valueField, true);\n if (stats.min === stats.max) {\n return colorList[0];\n }\n const scale = new LinearScale().domain([stats.min, stats.max]).range(colorList);\n\n return (datum: Datum) => {\n return scale.scale(datum[this._valueField]);\n };\n }\n\n const scale = new LinearScale().domain([0, this.getViewData()?.latestData?.length ?? 1]).range(colorList);\n\n return (datum: Datum) => {\n return scale.scale(datum[DEFAULT_DATA_INDEX]);\n };\n }\n\n getWordColor = (datum: Datum) => {\n if (datum.isFillingWord) {\n if (!this._fillingColorCallback || this._dataChange) {\n // 如果updateData数据变更了, 颜色映射也需要重新计算\n this._fillingColorCallback = this._wordCloudShapeConfig.fillingColorHexField\n ? (datum: Datum) => datum[this._wordCloudShapeConfig.fillingColorHexField]\n : this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField, true);\n }\n\n return this._fillingColorCallback(datum);\n }\n\n if (!this._keyWordColorCallback || this._dataChange) {\n // 如果updateData数据变更了, 颜色映射也需要重新计算\n this._keyWordColorCallback = this._spec.colorHexField\n ? datum => datum[this._spec.colorHexField]\n : this.initColorCallback(this._seriesField, false);\n }\n\n return this._keyWordColorCallback(datum);\n };\n\n private _calculateFontWeight = (datum: Datum) => {\n const stats = this.getRawDataStatisticsByField(this._valueField, true);\n\n if (stats.min === stats.max) {\n return this._fontWeightRange[0];\n }\n\n return (\n this._fontWeightRange[0] +\n ((this._fontWeightRange[this._fontWeightRange.length - 1] - this._fontWeightRange[0]) *\n (datum[this._valueField] - stats.min)) /\n (stats.max - stats.min)\n );\n };\n\n compile(): void {\n super.compile();\n const { width, height } = this._region.getLayoutRect();\n // 非正常尺寸下不进行布局\n if (!isValidNumber(width) || !isValidNumber(height) || !(height > 0 && width > 0)) {\n return;\n }\n\n const wordCloudTransforms: ITransformSpec[] = [];\n\n // 词云 transform\n if (!this._isWordCloudShape) {\n wordCloudTransforms.push({\n type: 'wordcloud',\n ...this._wordCloudTransformOption()\n });\n }\n // 形状词云 transform\n else {\n wordCloudTransforms.push({\n type: 'wordcloudShape',\n // 形状词云中必须要传入dataIndexKey, 否则填充词无法绘制\n ...this._wordCloudShapeTransformOption()\n });\n }\n\n // 挂到mark的transform上\n this._wordMark.setTransform(wordCloudTransforms);\n }\n\n protected _getCommonTransformOptions(): any {\n const { width, height } = this._region.getLayoutRect();\n const wordSpec = this._spec.word ?? {};\n const wordStyleSpec = wordSpec.style ?? {};\n\n return {\n size: [width, height],\n shape:\n isObject(this._maskShape) &&\n (this._maskShape as TextShapeMask).type === 'text' &&\n isNil((this._maskShape as TextShapeMask).fontFamily)\n ? {\n fontFamily: this._option.getTheme('fontFamily'),\n ...this._maskShape\n }\n : this._maskShape,\n onUpdateMaskCanvas: this.handleMaskCanvasUpdate,\n onLayoutFinished: () =>\n this._option.globalInstance\n .getChart()\n .getOption()\n .performanceHook?.afterWordcloudShapeDraw?.(this._option.globalInstance),\n dataIndexKey: DEFAULT_DATA_KEY,\n text: wordSpec.formatMethod\n ? (datum: Datum) => {\n return wordSpec.formatMethod(datum);\n }\n : { field: this._textField },\n fontSize: this._valueField ? { field: this._valueField } : this._fontSizeRange[0],\n fontSizeRange: this._fontSizeRange === 'auto' ? null : this._fontSizeRange,\n\n padding: this._spec.word?.padding ?? DEFAULT_FONT_PADDING,\n fontFamily: isValid(this._spec.fontFamilyField)\n ? { field: this._spec.fontFamilyField }\n : wordStyleSpec.fontFamily ?? this._defaultFontFamily,\n // 为了保持和旧版逻辑一致,优先级如下: spec field > mark style > default (根据valueField映射)\n fontWeight: isValid(this._spec.fontWeightField)\n ? { field: this._spec.fontWeightField }\n : isValid(wordStyleSpec.fontWeight)\n ? wordStyleSpec.fontWeight\n : isValid(this._valueField)\n ? this._calculateFontWeight\n : 'normal',\n fontStyle: isValid(this._spec.fontStyleField) ? { field: this._spec.fontStyleField } : wordStyleSpec.fontStyle,\n createCanvas: vglobal.createCanvas.bind(vglobal),\n getTextBounds\n };\n }\n\n protected _wordCloudTransformOption(): Object {\n const wordCloudConfig = this._wordCloudConfig ?? {};\n\n return {\n ...wordCloudConfig,\n ...this._getCommonTransformOptions(),\n // TIP: 非浏览器环境下,使用 fast 布局,否则会出现兼容问题\n layoutType: this._wordCloudConfig.layoutMode,\n\n rotate: this._rotateAngles,\n\n randomVisible: this._spec.random ?? DEFAULT_RANDOM,\n clip: this._wordCloudConfig.drawOutOfBound === 'clip',\n shrink: this._wordCloudConfig.zoomToFit.shrink,\n enlarge: this._wordCloudConfig.zoomToFit.enlarge,\n minFontSize: this._wordCloudConfig.zoomToFit.fontSizeLimitMin,\n progressiveTime: this._wordCloudConfig.progressiveTime,\n progressiveStep: this._wordCloudConfig.progressiveStep,\n repeatFill: this._wordCloudConfig.zoomToFit.repeat\n };\n }\n\n protected _wordCloudShapeTransformOption(): Object {\n const fillingWordStyleSpec = this._spec.fillingWord?.style ?? {};\n const wordCloudShapeConfig = this._wordCloudShapeConfig ?? {};\n\n return {\n ...wordCloudShapeConfig,\n ...this._getCommonTransformOptions(),\n createImage,\n\n rotateList: this._rotateAngles,\n fillingRotateList: wordCloudShapeConfig.fillingRotateAngles,\n\n fillingFontFamily: isValid(wordCloudShapeConfig.fillingFontFamilyField)\n ? { field: wordCloudShapeConfig.fillingFontFamilyField }\n : fillingWordStyleSpec.fontFamily ?? this._defaultFontFamily,\n fillingPadding: this._spec.fillingWord?.padding ?? DEFAULT_FONT_PADDING,\n fillingFontStyle: isValid(wordCloudShapeConfig.fillingFontStyleField)\n ? { field: wordCloudShapeConfig.fillingFontStyleField }\n : fillingWordStyleSpec.fontStyle,\n // 如果配置了字段映射,优先按照映射进行展示\n fillingFontWeight: isValid(wordCloudShapeConfig.fillingFontWeightField)\n ? {\n field: wordCloudShapeConfig.fillingFontWeightField\n }\n : fillingWordStyleSpec.fontWeight // 填充词fontWeight默认不跟随valueField\n };\n }\n\n getStatisticFields() {\n const fields: { key: string; operations: Array<'max' | 'min' | 'values'> }[] = [];\n fields.push({ key: this._nameField, operations: ['values'] });\n fields.push({ key: this._valueField, operations: ['max', 'min'] });\n return fields;\n }\n dataToPosition(data: Datum): IPoint {\n return null;\n }\n dataToPositionX(data: any): number {\n return null;\n }\n dataToPositionY(data: any): number {\n return null;\n }\n dataToPositionZ(data: any): number {\n return null;\n }\n valueToPosition(value1: any, value2?: any): IPoint {\n return null;\n }\n\n getGroupFields(): string[] {\n // do nothing\n return [];\n }\n\n getStackGroupFields(): string[] {\n // do nothing\n return [];\n }\n\n getStackValueField(): string {\n // do nothing\n return '';\n }\n\n onLayoutEnd(): void {\n super.onLayoutEnd();\n this.compile();\n this._dataChange = false;\n }\n\n getActiveMarks(): IMark[] {\n return [this._wordMark];\n }\n\n reInit() {\n super.reInit();\n if (this._keyWordColorCallback) {\n this._keyWordColorCallback = null;\n }\n\n if (this._fillingColorCallback) {\n this._fillingColorCallback = null;\n }\n }\n}\n"]}
@@ -255,6 +255,7 @@ export interface IPerformanceHook {
255
255
  beforeDoRender?: (vchart?: IVChart) => void;
256
256
  beforeVRenderDraw?: (vchart?: IVChart) => void;
257
257
  afterVRenderDraw?: (vchart?: IVChart) => void;
258
+ afterWordcloudShapeDraw?: (vchart?: IVChart) => void;
258
259
  }
259
260
  export type IBuildinMarkSpec = {
260
261
  group: IGroupMarkSpec;