@visactor/vchart 1.11.7 → 1.11.8
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.
- package/build/es5/index.js +1 -1
- package/build/index.js +45 -20
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/stack.js +1 -2
- package/cjs/component/tooltip/tooltip.js +2 -3
- package/cjs/component/tooltip/tooltip.js.map +1 -1
- package/cjs/component/util.js +2 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/esm/chart/stack.js +1 -2
- package/esm/component/tooltip/tooltip.js +2 -3
- package/esm/component/tooltip/tooltip.js.map +1 -1
- package/esm/component/util.js +2 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/package.json +15 -15
package/cjs/chart/stack.js
CHANGED
|
@@ -56,13 +56,12 @@ class Tooltip extends base_component_1.BaseComponent {
|
|
|
56
56
|
ignore: mouseEventData.ignore[activeType]
|
|
57
57
|
})) return !1;
|
|
58
58
|
let success;
|
|
59
|
-
if (useCache) success = !processor.showTooltip(this._cacheInfo, params, !0); else {
|
|
59
|
+
if (this._timer && clearTimeout(this._timer), useCache) success = !processor.showTooltip(this._cacheInfo, params, !0); else {
|
|
60
60
|
const tooltipInfo = mouseEventData.tooltipInfo[activeType], isSameAsCache = this._isSameAsCache(tooltipInfo, params, activeType);
|
|
61
61
|
success = !processor.showTooltip(tooltipInfo, params, isSameAsCache), success && (this._cacheInfo = tooltipInfo,
|
|
62
62
|
this._cacheParams = params, this._cacheActiveType = activeType);
|
|
63
63
|
}
|
|
64
|
-
success && (this._isTooltipShown = !0, isClick && this._spec.lockAfterClick && !this._clickLock ? this._clickLock = !0 : Number.isFinite(this._spec.hideTimer) && (this._timer
|
|
65
|
-
this._timer = setTimeout((() => {
|
|
64
|
+
success && (this._isTooltipShown = !0, isClick && this._spec.lockAfterClick && !this._clickLock ? this._clickLock = !0 : Number.isFinite(this._spec.hideTimer) && (this._timer = setTimeout((() => {
|
|
66
65
|
this._handleChartMouseOut();
|
|
67
66
|
}), this._spec.hideTimer)));
|
|
68
67
|
const vchart = null === (_a = this._option) || void 0 === _a ? void 0 : _a.globalInstance;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/component/tooltip/tooltip.ts"],"names":[],"mappings":";;;AAAA,4CAAsD;AAGtD,2DAAuD;AAIvD,wCAAoF;AASpF,uDAAmD;AACnD,2CAA4C;AAC5C,qEAA+E;AAC/E,6CAA+D;AAG/D,2CAAqG;AACrG,2CAA+D;AAG/D,6CAAoF;AACpF,8CAA2C;AAE3C,gDAA6C;AAE7C,+DAA+D;AAC/D,qCAAmC;AACnC,yCAAgD;AAOhD,MAAa,OAAQ,SAAQ,8BAAkB;IAA/C;;QACY,iBAAY,GAAW,CAAC,CAAC;QAGnC,SAAI,GAAG,wBAAiB,CAAC,OAAO,CAAC;QACjC,SAAI,GAAW,wBAAiB,CAAC,OAAO,CAAC;QAChC,2BAAsB,GAAG,4CAAsB,CAAC;QAGzD,YAAO,GAAG,SAAS,CAAC;QAEpB,eAAU,GAAW,MAAM,CAAC;QAmCpB,gBAAW,GAAY,KAAK,CAAC;QAM7B,eAAU,GAAqB,EAAE,CAAC;QAEhC,oBAAe,GAAY,KAAK,CAAC;QAEjC,eAAU,GAAY,KAAK,CAAC;QAoH5B,gBAAW,GAAG,CAAC,KAAgB,EAAE,KAAiB,EAAE,QAA4B,EAAE,EAAE;YAC5F,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;YACtC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;gBACnB,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,QAAQ;aAClB,CAAC,CAAC;QACL,CAAC,CAAC;QAEQ,wBAAmB,GAAG,CAAC,oBAA8B,E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gBACtF,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC;IACtC,CAAC;;AApiBH,0BAqiBC;AAniBQ,YAAI,GAAG,wBAAiB,CAAC,OAAO,CAAC;AACxB,8BAAsB,GAAG,4CAAsB,CAAC;AAKzD,eAAO,GAAG,SAAS,CAAC;AA+hBtB,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,iBAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B","file":"tooltip.js","sourcesContent":["import { ComponentTypeEnum } from '../interface/type';\nimport type { IModelLayoutOption, IModelRenderOption, IModelSpecInfo } from '../../model/interface';\nimport type { IRegion } from '../../region/interface';\nimport { BaseComponent } from '../base/base-component';\nimport type { BaseEventParams, EventCallback, EventQuery, EventType } from '../../event/interface';\nimport type { ITooltipHandler, TooltipActiveType } from '../../typings/tooltip';\nimport type { Datum, IPoint, IShowTooltipOption } from '../../typings';\nimport { isMobileLikeMode, isTrueBrowser, isMiniAppLikeMode } from '../../util/env';\nimport type {\n ITooltip,\n ITooltipActiveTypeAsKeys,\n ITooltipSpec,\n TooltipHandlerParams,\n TotalMouseEventData\n} from './interface';\nimport { TooltipResult } from './interface/common';\nimport { showTooltip } from './utils/show-tooltip';\nimport { isEmptyPos } from './utils/common';\nimport { isSameDimensionInfo } from '../../event/events/dimension/util/common';\nimport { ChartEvent, Event_Source_Type } from '../../constant';\nimport type { BaseTooltipProcessor, DimensionTooltipInfo, MarkTooltipInfo, TooltipInfo } from './processor';\n// eslint-disable-next-line no-duplicate-imports\nimport { GroupTooltipProcessor, DimensionTooltipProcessor, MarkTooltipProcessor } from './processor';\nimport { isDimensionInfo, isMarkInfo } from './processor/util';\nimport type { Maybe } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { hasParentElement, isArray, isValid, isNil, array } from '@visactor/vutils';\nimport { VChart } from '../../core/vchart';\nimport type { TooltipEventParams } from './interface/event';\nimport { Factory } from '../../core/factory';\nimport type { IGraphic } from '@visactor/vrender-core';\nimport { TooltipSpecTransformer } from './tooltip-transformer';\nimport { error } from '../../util';\nimport { TooltipHandlerType } from './constant';\n\ntype EventHandlerList = {\n eventType: EventType;\n handler: any;\n}[];\n\nexport class Tooltip extends BaseComponent<any> implements ITooltip {\n protected layoutZIndex: number = 1;\n static type = ComponentTypeEnum.tooltip;\n static readonly transformerConstructor = TooltipSpecTransformer;\n type = ComponentTypeEnum.tooltip;\n name: string = ComponentTypeEnum.tooltip;\n readonly transformerConstructor = TooltipSpecTransformer;\n\n static specKey = 'tooltip';\n specKey = 'tooltip';\n\n layoutType: 'none' = 'none';\n private _timer?: number;\n protected declare _spec: ITooltipSpec;\n\n static getSpecInfo(chartSpec: any): Maybe<IModelSpecInfo[]> {\n const tooltipSpec = chartSpec[this.specKey];\n if (!tooltipSpec) {\n return null;\n }\n if (!isArray(tooltipSpec)) {\n return [\n {\n spec: tooltipSpec,\n specPath: [this.specKey],\n specInfoPath: ['component', this.specKey, 0],\n type: ComponentTypeEnum.tooltip\n }\n ];\n }\n const specInfos: IModelSpecInfo[] = [];\n tooltipSpec.forEach((s: any, i: number) => {\n specInfos.push({\n spec: s,\n specPath: [this.specKey, i],\n specInfoPath: ['component', this.specKey, i],\n type: ComponentTypeEnum.tooltip\n });\n });\n return specInfos;\n }\n\n tooltipHandler?: ITooltipHandler;\n\n processor: ITooltipActiveTypeAsKeys<MarkTooltipProcessor, DimensionTooltipProcessor, GroupTooltipProcessor>;\n\n private _alwaysShow: boolean = false;\n\n private _cacheInfo: TooltipInfo | undefined;\n private _cacheParams: BaseEventParams | undefined;\n private _cacheActiveType: TooltipActiveType | undefined;\n\n private _eventList: EventHandlerList = [];\n\n protected _isTooltipShown: boolean = false;\n\n protected _clickLock: boolean = false;\n\n /** 当前是否正在显示 tooltip */\n isTooltipShown() {\n return this._isTooltipShown;\n }\n\n changeRegions(regions: IRegion[]) {\n /* do nothing */\n }\n protected _getNeedClearVRenderComponents(): IGraphic[] {\n return [];\n }\n protected _registerEvent() {\n /* do nothing */\n }\n protected _releaseEvent() {\n /* do nothing */\n }\n onLayout(ctx: IModelLayoutOption) {\n /* do nothing */\n }\n onLayoutEnd(ctx: IModelLayoutOption) {\n /* do nothing */\n }\n onRender(ctx: IModelRenderOption) {\n /* do nothing */\n }\n\n created() {\n super.created();\n this._regions = this._option.getAllRegions();\n // event\n this._initEvent();\n }\n\n release() {\n super.release();\n if (this._timer) {\n clearTimeout(this._timer);\n }\n\n this._eventList.forEach(({ eventType, handler }) => {\n this.event.off(eventType, handler);\n });\n this._eventList = [];\n this.tooltipHandler?.release?.();\n this._isTooltipShown = false;\n }\n\n beforeRelease() {\n // 触发事件\n this.event.emit(ChartEvent.tooltipHide, {\n tooltip: this,\n chart: this.getChart()\n } as unknown as TooltipEventParams);\n this.event.emit(ChartEvent.tooltipRelease, {\n tooltip: this,\n chart: this.getChart()\n } as unknown as TooltipEventParams);\n }\n\n protected _initHandler() {\n const renderMode = this._spec.renderMode ?? 'html';\n\n const userTooltipHandler = this._option.globalInstance.getTooltipHandlerByUser();\n if (userTooltipHandler) {\n this.tooltipHandler = userTooltipHandler;\n } else {\n // 构造内部默认 handler\n const type = renderMode === 'canvas' ? TooltipHandlerType.canvas : TooltipHandlerType.dom;\n const handlerConstructor = Factory.getComponentPluginInType(type);\n if (!handlerConstructor) {\n error('Can not find tooltip handler: ' + type);\n }\n const handler = new handlerConstructor();\n handler.name = `${this._spec.className}-${this._option.globalInstance.id ?? 0}-${this.getSpecIndex()}`;\n this.pluginService?.load([handler]);\n\n this.tooltipHandler = handler as unknown as ITooltipHandler;\n }\n }\n\n protected _initProcessor() {\n // 初始化 tooltip 类型\n this.processor = {\n mark: new MarkTooltipProcessor(this),\n dimension: new DimensionTooltipProcessor(this),\n group: new GroupTooltipProcessor(this)\n };\n }\n\n protected _initEvent() {\n if (this._option.disableTriggerEvent) {\n return;\n }\n const trigger = array(this._spec.trigger ?? 'hover');\n // TODO: triggerOff完整支持\n // const triggerOff = this._spec.triggerOff ?? trigger;\n const mode = this._option.mode;\n\n if (trigger.includes('hover')) {\n this._mountEvent('pointermove', { source: 'chart' }, this._getMouseMoveHandler(false));\n // 移动端的点按 + 滑动触发\n if (isMobileLikeMode(mode) || isMiniAppLikeMode(mode)) {\n this._mountEvent('pointerdown', { source: 'chart' }, this._getMouseMoveHandler(false));\n this._mountEvent('pointerup', { source: 'window' }, this._getMouseOutHandler(true));\n }\n this._mountEvent('pointerout', { source: 'canvas' }, this._getMouseOutHandler(false));\n }\n if (trigger.includes('click')) {\n this._mountEvent('pointertap', { source: 'chart' }, this._getMouseMoveHandler(true));\n this._mountEvent('pointerup', { source: 'window' }, this._getMouseOutHandler(true));\n }\n }\n\n protected _mountEvent = (eType: EventType, query: EventQuery, callback: EventCallback<any>) => {\n this.event.on(eType, query, callback);\n this._eventList.push({\n eventType: eType,\n handler: callback\n });\n };\n\n protected _getMouseOutHandler = (needPointerDetection?: boolean) => (params: BaseEventParams) => {\n if (this._alwaysShow) {\n return;\n }\n\n if (!this._isTooltipShown && !this.tooltipHandler?.isTooltipShown?.()) {\n return;\n }\n\n const browserEnv = isTrueBrowser(this._option?.mode);\n const { clientX, clientY } = params.event as MouseEvent;\n\n // 当 enterable 为 true,同时鼠标移入 tooltip 时 pointerleave 事件也会触发,所以这里做一个判断\n if (browserEnv && this._isPointerOnTooltip(params)) {\n return;\n }\n\n // 判断鼠标是否在图表范围内\n if (browserEnv && needPointerDetection && this._isPointerInChart({ x: clientX, y: clientY })) {\n return;\n }\n\n this._handleChartMouseOut(params);\n };\n\n protected _handleChartMouseOut = (params?: BaseEventParams) => {\n if (this._alwaysShow) {\n return;\n }\n\n if (this._spec.triggerOff !== 'none') {\n this._hideTooltipByHandler({\n ...(params as any),\n tooltip: this\n });\n this._cacheInfo = undefined;\n this._cacheParams = undefined;\n this._cacheActiveType = undefined;\n }\n };\n\n protected _getMouseMoveHandler = (isClick: boolean) => (params: BaseEventParams) => {\n if (!this.tooltipHandler) {\n this._initHandler();\n }\n\n if (!this.processor) {\n this._initProcessor();\n }\n\n if (this._alwaysShow) {\n return;\n }\n if (this._isPointerOnTooltip(params)) {\n return;\n }\n if (!isClick && this._clickLock) {\n return;\n }\n\n /* 获取 tooltip 原始数据 */\n const mouseEventData = this._getMouseEventData(params);\n const {\n tooltipInfo: { dimension: dimensionInfo },\n ignore: { mark: ignoreMark, dimension: ignoreDimension }\n } = mouseEventData;\n\n /** tooltip 是否显示成功 */\n const success: ITooltipActiveTypeAsKeys<boolean, boolean, boolean> = {\n mark: false,\n dimension: false,\n group: false\n };\n\n /* 显示常规tooltip */\n success.group = this._showTooltipByMouseEvent('group', mouseEventData, params, isClick);\n if (!success.group) {\n success.mark = this._showTooltipByMouseEvent('mark', mouseEventData, params, isClick);\n }\n if (!success.mark && !success.group) {\n success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick);\n }\n\n /* 如果不是常规情况,进行一些特殊情况tooltip处理 */\n if (Object.values(success).every(val => !val) && !isEmptyPos(params)) {\n // 用户手动配置ignore,则继续显示缓存tooltip\n if (ignoreMark && isMarkInfo(this._cacheInfo)) {\n success.mark = this._showTooltipByMouseEvent('mark', mouseEventData, params, isClick, true);\n } else if (ignoreDimension && isDimensionInfo(this._cacheInfo)) {\n success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick, true);\n } else if (isValid(dimensionInfo)) {\n // 用户没有手动配置ignore的话,默认显示dimension tooltip\n success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick);\n }\n }\n\n /* 如果还是不应该显示tooltip,则隐藏上一次tooltip */\n if (!success.mark && !success.group && (!success.dimension || isNil(dimensionInfo))) {\n this._handleChartMouseOut(params);\n if (isClick && this._clickLock) {\n this._clickLock = false;\n }\n }\n };\n\n /**\n * 通过鼠标事件触发 tooltip,返回是否成功\n * @param activeType tooltip 类型\n * @param mouseEventData tooltip 相关数据\n * @param params 事件参数\n * @param useCache 是否直接显示缓存 tooltip\n * @returns 是否成功执行\n */\n protected _showTooltipByMouseEvent = (\n activeType: TooltipActiveType,\n mouseEventData: TotalMouseEventData,\n params: BaseEventParams,\n isClick: boolean,\n useCache?: boolean\n ): boolean => {\n const processor = this.processor[activeType];\n // 判断是否应该触发 tooltip\n if (\n !processor.shouldHandleTooltip(params, {\n tooltipInfo: mouseEventData.tooltipInfo[activeType],\n ignore: mouseEventData.ignore[activeType]\n })\n ) {\n return false;\n }\n\n let success: boolean;\n if (useCache) {\n // 直接显示缓存 tooltip\n success = !processor.showTooltip(this._cacheInfo as any, params, true);\n } else {\n const tooltipInfo = mouseEventData.tooltipInfo[activeType];\n const isSameAsCache = this._isSameAsCache(tooltipInfo, params, activeType);\n success = !processor.showTooltip(tooltipInfo as any, params, isSameAsCache);\n if (success) {\n // 成功显示 tooltip,则更新缓存\n this._cacheInfo = tooltipInfo;\n this._cacheParams = params;\n this._cacheActiveType = activeType;\n }\n }\n if (success) {\n this._isTooltipShown = true;\n if (isClick && this._spec.lockAfterClick && !this._clickLock) {\n this._clickLock = true;\n } else if (Number.isFinite(this._spec.hideTimer)) {\n if (this._timer) {\n clearTimeout(this._timer);\n }\n\n this._timer = setTimeout(() => {\n this._handleChartMouseOut();\n }, this._spec.hideTimer as number) as unknown as number;\n }\n }\n // 全局唯一 tooltip\n const vchart = this._option?.globalInstance;\n if (success && VChart.globalConfig.uniqueTooltip && vchart) {\n VChart.hideTooltip(vchart.id);\n }\n return success;\n };\n\n protected _getMouseEventData = (params: BaseEventParams): TotalMouseEventData => {\n const result: TotalMouseEventData = {\n tooltipInfo: {},\n ignore: {}\n };\n\n let activeType: TooltipActiveType = 'dimension';\n const { tooltipInfo, ignore } = this.processor[activeType].getMouseEventData(params);\n result.tooltipInfo[activeType] = tooltipInfo as any;\n result.ignore[activeType] = ignore;\n\n const dimensionInfo = tooltipInfo as DimensionTooltipInfo;\n\n for (activeType of Object.keys(this.processor) as any) {\n if (activeType !== 'dimension') {\n const { tooltipInfo, ignore } = this.processor[activeType].getMouseEventData(params, dimensionInfo);\n result.tooltipInfo[activeType] = tooltipInfo as any;\n result.ignore[activeType] = ignore;\n }\n }\n return result;\n };\n\n protected _hideTooltipByHandler = (params: TooltipHandlerParams): TooltipResult => {\n if (!this._isTooltipShown && !this.tooltipHandler?.isTooltipShown?.()) {\n // 如果当前 tooltip 未显示,则提前退出\n return TooltipResult.success;\n }\n\n // 触发事件\n this.event.emit(ChartEvent.tooltipHide, {\n ...params,\n source: Event_Source_Type.chart, // 统一 event 的来源\n tooltip: this\n });\n\n // 删除缓存\n Object.values(this.processor).forEach((processor: BaseTooltipProcessor) => {\n processor.clearCache();\n });\n\n // 隐藏 tooltip\n let hideTooltip;\n if (this._spec.handler?.hideTooltip) {\n hideTooltip = this._spec.handler.hideTooltip.bind(this._spec.handler);\n } else if (this.tooltipHandler?.hideTooltip) {\n hideTooltip = this.tooltipHandler.hideTooltip.bind(this.tooltipHandler);\n }\n if (hideTooltip) {\n const result = hideTooltip(params);\n if (!result) {\n this._isTooltipShown = false;\n }\n return result;\n }\n return TooltipResult.failed;\n };\n\n reInit(spec?: any) {\n super.reInit(spec);\n\n if (this.tooltipHandler) {\n this.tooltipHandler.reInit?.();\n } else {\n this._initHandler();\n }\n }\n\n showTooltip(datum: Datum, options: IShowTooltipOption) {\n if (!this.tooltipHandler) {\n this._initHandler();\n }\n\n if (!this.processor) {\n this._initProcessor();\n }\n\n if (!this.tooltipHandler?.showTooltip) {\n return false;\n }\n const result = showTooltip(datum, options, this);\n if (result !== 'none') {\n this._alwaysShow = !!options?.alwaysShow;\n }\n return result;\n }\n\n /** 手动隐藏 tooltip,返回是否成功 */\n hideTooltip(): boolean {\n const params: TooltipHandlerParams = {\n changePositionOnly: false,\n tooltip: this,\n item: undefined,\n datum: undefined,\n source: Event_Source_Type.chart\n } as any;\n\n this._alwaysShow = false;\n return !this._hideTooltipByHandler(params);\n }\n\n private _isSameAsCache(\n nextInfo?: TooltipInfo,\n nextParams?: BaseEventParams,\n nextActiveType?: TooltipActiveType\n ): boolean {\n if (nextActiveType !== this._cacheActiveType) {\n return false;\n }\n if (nextInfo === this._cacheInfo) {\n return true;\n }\n if (isNil(this._cacheInfo) || isNil(nextInfo)) {\n return false;\n }\n\n // 判断 tooltip 信息是否一致\n if (isDimensionInfo(nextInfo)) {\n if (isMarkInfo(this._cacheInfo)) {\n return false;\n }\n\n const prevInfo = this._cacheInfo as DimensionTooltipInfo;\n const isSameAsCacheInfo =\n prevInfo.length === nextInfo.length && nextInfo.every((info, i) => isSameDimensionInfo(info, prevInfo[i]));\n if (!isSameAsCacheInfo) {\n return false;\n }\n } else {\n if (isDimensionInfo(this._cacheInfo)) {\n return false;\n }\n\n const prevInfo = this._cacheInfo as MarkTooltipInfo;\n const isSameAsCacheInfo =\n nextInfo?.datum === prevInfo.datum && nextInfo?.mark === prevInfo.mark && nextInfo?.series === prevInfo.series;\n if (!isSameAsCacheInfo) {\n return false;\n }\n }\n\n // 判断事件触发信息是否一致\n const prevParams = this._cacheParams;\n if (isNil(prevParams) || isNil(nextParams)) {\n return false;\n }\n return (\n prevParams.mark === nextParams.mark &&\n prevParams.model === nextParams.model &&\n prevParams.datum === nextParams.datum\n );\n }\n\n private _isPointerInChart(point: IPoint): boolean {\n const globalInstance = this._option?.globalInstance;\n if (!globalInstance) {\n return false;\n }\n const chart = globalInstance.getChart();\n if (!chart) {\n return false;\n }\n const { x, y } = point;\n const canvas = globalInstance.getCanvas();\n const { x: chartX, y: chartY, width: chartWidth, height: chartHeight } = canvas.getBoundingClientRect();\n // 鼠标仍在图表范围内,则不处理\n if (x >= chartX && x <= chartX + chartWidth && y >= chartY && y <= chartY + chartHeight) {\n return true;\n }\n\n return false;\n }\n\n private _isPointerOnTooltip(params: BaseEventParams): boolean {\n // TODO:后续支持 renderMode === 'canvas' 场景\n if (this._spec.enterable && this._spec.renderMode === 'html') {\n const { event } = params;\n let newTarget: any;\n if (isValid(event.nativeEvent)) {\n // get native event object\n const nativeEvent = event.nativeEvent as any;\n newTarget = nativeEvent.relatedTarget;\n // if in shadow DOM use composedPath to access target\n // FIXME: shadow DOM 的 relatedTarget 的属性是?\n if (nativeEvent.composedPath && nativeEvent.composedPath().length > 0) {\n newTarget = nativeEvent.composedPath()[0];\n }\n } else {\n newTarget = event.relatedTarget;\n }\n const container = this.tooltipHandler?.getTooltipContainer?.();\n if (isValid(container) && isValid(newTarget) && hasParentElement(newTarget, container)) {\n return true;\n }\n }\n return false;\n }\n\n getVisible() {\n return this._spec.visible !== false;\n }\n}\n\nexport const registerTooltip = () => {\n Factory.registerComponent(Tooltip.type, Tooltip);\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/component/tooltip/tooltip.ts"],"names":[],"mappings":";;;AAAA,4CAAsD;AAGtD,2DAAuD;AAIvD,wCAAoF;AASpF,uDAAmD;AACnD,2CAA4C;AAC5C,qEAA+E;AAC/E,6CAA+D;AAG/D,2CAAqG;AACrG,2CAA+D;AAG/D,6CAAoF;AACpF,8CAA2C;AAE3C,gDAA6C;AAE7C,+DAA+D;AAC/D,qCAAmC;AACnC,yCAAgD;AAOhD,MAAa,OAAQ,SAAQ,8BAAkB;IAA/C;;QACY,iBAAY,GAAW,CAAC,CAAC;QAGnC,SAAI,GAAG,wBAAiB,CAAC,OAAO,CAAC;QACjC,SAAI,GAAW,wBAAiB,CAAC,OAAO,CAAC;QAChC,2BAAsB,GAAG,4CAAsB,CAAC;QAGzD,YAAO,GAAG,SAAS,CAAC;QAEpB,eAAU,GAAW,MAAM,CAAC;QAmCpB,gBAAW,GAAY,KAAK,CAAC;QAM7B,eAAU,GAAqB,EAAE,CAAC;QAEhC,oBAAe,GAAY,KAAK,CAAC;QAEjC,eAAU,GAAY,KAAK,CAAC;QAoH5B,gBAAW,GAAG,CAAC,KAAgB,EAAE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3C;aACF;iBAAM;gBACL,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC;aACjC;YACD,MAAM,SAAS,GAAG,MAAA,MAAA,IAAI,CAAC,cAAc,0CAAE,mBAAmB,kDAAI,CAAC;YAC/D,IAAI,IAAA,gBAAO,EAAC,SAAS,CAAC,IAAI,IAAA,gBAAO,EAAC,SAAS,CAAC,IAAI,IAAA,yBAAgB,EAAC,SAAS,EAAE,SAAS,CAAC,EAAE;gBACtF,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC;IACtC,CAAC;;AAniBH,0BAoiBC;AAliBQ,YAAI,GAAG,wBAAiB,CAAC,OAAO,CAAC;AACxB,8BAAsB,GAAG,4CAAsB,CAAC;AAKzD,eAAO,GAAG,SAAS,CAAC;AA8hBtB,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,iBAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B","file":"tooltip.js","sourcesContent":["import { ComponentTypeEnum } from '../interface/type';\nimport type { IModelLayoutOption, IModelRenderOption, IModelSpecInfo } from '../../model/interface';\nimport type { IRegion } from '../../region/interface';\nimport { BaseComponent } from '../base/base-component';\nimport type { BaseEventParams, EventCallback, EventQuery, EventType } from '../../event/interface';\nimport type { ITooltipHandler, TooltipActiveType } from '../../typings/tooltip';\nimport type { Datum, IPoint, IShowTooltipOption } from '../../typings';\nimport { isMobileLikeMode, isTrueBrowser, isMiniAppLikeMode } from '../../util/env';\nimport type {\n ITooltip,\n ITooltipActiveTypeAsKeys,\n ITooltipSpec,\n TooltipHandlerParams,\n TotalMouseEventData\n} from './interface';\nimport { TooltipResult } from './interface/common';\nimport { showTooltip } from './utils/show-tooltip';\nimport { isEmptyPos } from './utils/common';\nimport { isSameDimensionInfo } from '../../event/events/dimension/util/common';\nimport { ChartEvent, Event_Source_Type } from '../../constant';\nimport type { BaseTooltipProcessor, DimensionTooltipInfo, MarkTooltipInfo, TooltipInfo } from './processor';\n// eslint-disable-next-line no-duplicate-imports\nimport { GroupTooltipProcessor, DimensionTooltipProcessor, MarkTooltipProcessor } from './processor';\nimport { isDimensionInfo, isMarkInfo } from './processor/util';\nimport type { Maybe } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { hasParentElement, isArray, isValid, isNil, array } from '@visactor/vutils';\nimport { VChart } from '../../core/vchart';\nimport type { TooltipEventParams } from './interface/event';\nimport { Factory } from '../../core/factory';\nimport type { IGraphic } from '@visactor/vrender-core';\nimport { TooltipSpecTransformer } from './tooltip-transformer';\nimport { error } from '../../util';\nimport { TooltipHandlerType } from './constant';\n\ntype EventHandlerList = {\n eventType: EventType;\n handler: any;\n}[];\n\nexport class Tooltip extends BaseComponent<any> implements ITooltip {\n protected layoutZIndex: number = 1;\n static type = ComponentTypeEnum.tooltip;\n static readonly transformerConstructor = TooltipSpecTransformer;\n type = ComponentTypeEnum.tooltip;\n name: string = ComponentTypeEnum.tooltip;\n readonly transformerConstructor = TooltipSpecTransformer;\n\n static specKey = 'tooltip';\n specKey = 'tooltip';\n\n layoutType: 'none' = 'none';\n private _timer?: number;\n protected declare _spec: ITooltipSpec;\n\n static getSpecInfo(chartSpec: any): Maybe<IModelSpecInfo[]> {\n const tooltipSpec = chartSpec[this.specKey];\n if (!tooltipSpec) {\n return null;\n }\n if (!isArray(tooltipSpec)) {\n return [\n {\n spec: tooltipSpec,\n specPath: [this.specKey],\n specInfoPath: ['component', this.specKey, 0],\n type: ComponentTypeEnum.tooltip\n }\n ];\n }\n const specInfos: IModelSpecInfo[] = [];\n tooltipSpec.forEach((s: any, i: number) => {\n specInfos.push({\n spec: s,\n specPath: [this.specKey, i],\n specInfoPath: ['component', this.specKey, i],\n type: ComponentTypeEnum.tooltip\n });\n });\n return specInfos;\n }\n\n tooltipHandler?: ITooltipHandler;\n\n processor: ITooltipActiveTypeAsKeys<MarkTooltipProcessor, DimensionTooltipProcessor, GroupTooltipProcessor>;\n\n private _alwaysShow: boolean = false;\n\n private _cacheInfo: TooltipInfo | undefined;\n private _cacheParams: BaseEventParams | undefined;\n private _cacheActiveType: TooltipActiveType | undefined;\n\n private _eventList: EventHandlerList = [];\n\n protected _isTooltipShown: boolean = false;\n\n protected _clickLock: boolean = false;\n\n /** 当前是否正在显示 tooltip */\n isTooltipShown() {\n return this._isTooltipShown;\n }\n\n changeRegions(regions: IRegion[]) {\n /* do nothing */\n }\n protected _getNeedClearVRenderComponents(): IGraphic[] {\n return [];\n }\n protected _registerEvent() {\n /* do nothing */\n }\n protected _releaseEvent() {\n /* do nothing */\n }\n onLayout(ctx: IModelLayoutOption) {\n /* do nothing */\n }\n onLayoutEnd(ctx: IModelLayoutOption) {\n /* do nothing */\n }\n onRender(ctx: IModelRenderOption) {\n /* do nothing */\n }\n\n created() {\n super.created();\n this._regions = this._option.getAllRegions();\n // event\n this._initEvent();\n }\n\n release() {\n super.release();\n if (this._timer) {\n clearTimeout(this._timer);\n }\n\n this._eventList.forEach(({ eventType, handler }) => {\n this.event.off(eventType, handler);\n });\n this._eventList = [];\n this.tooltipHandler?.release?.();\n this._isTooltipShown = false;\n }\n\n beforeRelease() {\n // 触发事件\n this.event.emit(ChartEvent.tooltipHide, {\n tooltip: this,\n chart: this.getChart()\n } as unknown as TooltipEventParams);\n this.event.emit(ChartEvent.tooltipRelease, {\n tooltip: this,\n chart: this.getChart()\n } as unknown as TooltipEventParams);\n }\n\n protected _initHandler() {\n const renderMode = this._spec.renderMode ?? 'html';\n\n const userTooltipHandler = this._option.globalInstance.getTooltipHandlerByUser();\n if (userTooltipHandler) {\n this.tooltipHandler = userTooltipHandler;\n } else {\n // 构造内部默认 handler\n const type = renderMode === 'canvas' ? TooltipHandlerType.canvas : TooltipHandlerType.dom;\n const handlerConstructor = Factory.getComponentPluginInType(type);\n if (!handlerConstructor) {\n error('Can not find tooltip handler: ' + type);\n }\n const handler = new handlerConstructor();\n handler.name = `${this._spec.className}-${this._option.globalInstance.id ?? 0}-${this.getSpecIndex()}`;\n this.pluginService?.load([handler]);\n\n this.tooltipHandler = handler as unknown as ITooltipHandler;\n }\n }\n\n protected _initProcessor() {\n // 初始化 tooltip 类型\n this.processor = {\n mark: new MarkTooltipProcessor(this),\n dimension: new DimensionTooltipProcessor(this),\n group: new GroupTooltipProcessor(this)\n };\n }\n\n protected _initEvent() {\n if (this._option.disableTriggerEvent) {\n return;\n }\n const trigger = array(this._spec.trigger ?? 'hover');\n // TODO: triggerOff完整支持\n // const triggerOff = this._spec.triggerOff ?? trigger;\n const mode = this._option.mode;\n\n if (trigger.includes('hover')) {\n this._mountEvent('pointermove', { source: 'chart' }, this._getMouseMoveHandler(false));\n // 移动端的点按 + 滑动触发\n if (isMobileLikeMode(mode) || isMiniAppLikeMode(mode)) {\n this._mountEvent('pointerdown', { source: 'chart' }, this._getMouseMoveHandler(false));\n this._mountEvent('pointerup', { source: 'window' }, this._getMouseOutHandler(true));\n }\n this._mountEvent('pointerout', { source: 'canvas' }, this._getMouseOutHandler(false));\n }\n if (trigger.includes('click')) {\n this._mountEvent('pointertap', { source: 'chart' }, this._getMouseMoveHandler(true));\n this._mountEvent('pointerup', { source: 'window' }, this._getMouseOutHandler(true));\n }\n }\n\n protected _mountEvent = (eType: EventType, query: EventQuery, callback: EventCallback<any>) => {\n this.event.on(eType, query, callback);\n this._eventList.push({\n eventType: eType,\n handler: callback\n });\n };\n\n protected _getMouseOutHandler = (needPointerDetection?: boolean) => (params: BaseEventParams) => {\n if (this._alwaysShow) {\n return;\n }\n\n if (!this._isTooltipShown && !this.tooltipHandler?.isTooltipShown?.()) {\n return;\n }\n\n const browserEnv = isTrueBrowser(this._option?.mode);\n const { clientX, clientY } = params.event as MouseEvent;\n\n // 当 enterable 为 true,同时鼠标移入 tooltip 时 pointerleave 事件也会触发,所以这里做一个判断\n if (browserEnv && this._isPointerOnTooltip(params)) {\n return;\n }\n\n // 判断鼠标是否在图表范围内\n if (browserEnv && needPointerDetection && this._isPointerInChart({ x: clientX, y: clientY })) {\n return;\n }\n\n this._handleChartMouseOut(params);\n };\n\n protected _handleChartMouseOut = (params?: BaseEventParams) => {\n if (this._alwaysShow) {\n return;\n }\n\n if (this._spec.triggerOff !== 'none') {\n this._hideTooltipByHandler({\n ...(params as any),\n tooltip: this\n });\n this._cacheInfo = undefined;\n this._cacheParams = undefined;\n this._cacheActiveType = undefined;\n }\n };\n\n protected _getMouseMoveHandler = (isClick: boolean) => (params: BaseEventParams) => {\n if (!this.tooltipHandler) {\n this._initHandler();\n }\n\n if (!this.processor) {\n this._initProcessor();\n }\n\n if (this._alwaysShow) {\n return;\n }\n if (this._isPointerOnTooltip(params)) {\n return;\n }\n if (!isClick && this._clickLock) {\n return;\n }\n\n /* 获取 tooltip 原始数据 */\n const mouseEventData = this._getMouseEventData(params);\n const {\n tooltipInfo: { dimension: dimensionInfo },\n ignore: { mark: ignoreMark, dimension: ignoreDimension }\n } = mouseEventData;\n\n /** tooltip 是否显示成功 */\n const success: ITooltipActiveTypeAsKeys<boolean, boolean, boolean> = {\n mark: false,\n dimension: false,\n group: false\n };\n\n /* 显示常规tooltip */\n success.group = this._showTooltipByMouseEvent('group', mouseEventData, params, isClick);\n if (!success.group) {\n success.mark = this._showTooltipByMouseEvent('mark', mouseEventData, params, isClick);\n }\n if (!success.mark && !success.group) {\n success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick);\n }\n\n /* 如果不是常规情况,进行一些特殊情况tooltip处理 */\n if (Object.values(success).every(val => !val) && !isEmptyPos(params)) {\n // 用户手动配置ignore,则继续显示缓存tooltip\n if (ignoreMark && isMarkInfo(this._cacheInfo)) {\n success.mark = this._showTooltipByMouseEvent('mark', mouseEventData, params, isClick, true);\n } else if (ignoreDimension && isDimensionInfo(this._cacheInfo)) {\n success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick, true);\n } else if (isValid(dimensionInfo)) {\n // 用户没有手动配置ignore的话,默认显示dimension tooltip\n success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick);\n }\n }\n\n /* 如果还是不应该显示tooltip,则隐藏上一次tooltip */\n if (!success.mark && !success.group && (!success.dimension || isNil(dimensionInfo))) {\n this._handleChartMouseOut(params);\n if (isClick && this._clickLock) {\n this._clickLock = false;\n }\n }\n };\n\n /**\n * 通过鼠标事件触发 tooltip,返回是否成功\n * @param activeType tooltip 类型\n * @param mouseEventData tooltip 相关数据\n * @param params 事件参数\n * @param useCache 是否直接显示缓存 tooltip\n * @returns 是否成功执行\n */\n protected _showTooltipByMouseEvent = (\n activeType: TooltipActiveType,\n mouseEventData: TotalMouseEventData,\n params: BaseEventParams,\n isClick: boolean,\n useCache?: boolean\n ): boolean => {\n const processor = this.processor[activeType];\n // 判断是否应该触发 tooltip\n if (\n !processor.shouldHandleTooltip(params, {\n tooltipInfo: mouseEventData.tooltipInfo[activeType],\n ignore: mouseEventData.ignore[activeType]\n })\n ) {\n return false;\n }\n if (this._timer) {\n clearTimeout(this._timer);\n }\n\n let success: boolean;\n if (useCache) {\n // 直接显示缓存 tooltip\n success = !processor.showTooltip(this._cacheInfo as any, params, true);\n } else {\n const tooltipInfo = mouseEventData.tooltipInfo[activeType];\n const isSameAsCache = this._isSameAsCache(tooltipInfo, params, activeType);\n success = !processor.showTooltip(tooltipInfo as any, params, isSameAsCache);\n if (success) {\n // 成功显示 tooltip,则更新缓存\n this._cacheInfo = tooltipInfo;\n this._cacheParams = params;\n this._cacheActiveType = activeType;\n }\n }\n if (success) {\n this._isTooltipShown = true;\n if (isClick && this._spec.lockAfterClick && !this._clickLock) {\n this._clickLock = true;\n } else if (Number.isFinite(this._spec.hideTimer)) {\n this._timer = setTimeout(() => {\n this._handleChartMouseOut();\n }, this._spec.hideTimer as number) as unknown as number;\n }\n }\n // 全局唯一 tooltip\n const vchart = this._option?.globalInstance;\n if (success && VChart.globalConfig.uniqueTooltip && vchart) {\n VChart.hideTooltip(vchart.id);\n }\n return success;\n };\n\n protected _getMouseEventData = (params: BaseEventParams): TotalMouseEventData => {\n const result: TotalMouseEventData = {\n tooltipInfo: {},\n ignore: {}\n };\n\n let activeType: TooltipActiveType = 'dimension';\n const { tooltipInfo, ignore } = this.processor[activeType].getMouseEventData(params);\n result.tooltipInfo[activeType] = tooltipInfo as any;\n result.ignore[activeType] = ignore;\n\n const dimensionInfo = tooltipInfo as DimensionTooltipInfo;\n\n for (activeType of Object.keys(this.processor) as any) {\n if (activeType !== 'dimension') {\n const { tooltipInfo, ignore } = this.processor[activeType].getMouseEventData(params, dimensionInfo);\n result.tooltipInfo[activeType] = tooltipInfo as any;\n result.ignore[activeType] = ignore;\n }\n }\n return result;\n };\n\n protected _hideTooltipByHandler = (params: TooltipHandlerParams): TooltipResult => {\n if (!this._isTooltipShown && !this.tooltipHandler?.isTooltipShown?.()) {\n // 如果当前 tooltip 未显示,则提前退出\n return TooltipResult.success;\n }\n\n // 触发事件\n this.event.emit(ChartEvent.tooltipHide, {\n ...params,\n source: Event_Source_Type.chart, // 统一 event 的来源\n tooltip: this\n });\n\n // 删除缓存\n Object.values(this.processor).forEach((processor: BaseTooltipProcessor) => {\n processor.clearCache();\n });\n\n // 隐藏 tooltip\n let hideTooltip;\n if (this._spec.handler?.hideTooltip) {\n hideTooltip = this._spec.handler.hideTooltip.bind(this._spec.handler);\n } else if (this.tooltipHandler?.hideTooltip) {\n hideTooltip = this.tooltipHandler.hideTooltip.bind(this.tooltipHandler);\n }\n if (hideTooltip) {\n const result = hideTooltip(params);\n if (!result) {\n this._isTooltipShown = false;\n }\n return result;\n }\n return TooltipResult.failed;\n };\n\n reInit(spec?: any) {\n super.reInit(spec);\n\n if (this.tooltipHandler) {\n this.tooltipHandler.reInit?.();\n } else {\n this._initHandler();\n }\n }\n\n showTooltip(datum: Datum, options: IShowTooltipOption) {\n if (!this.tooltipHandler) {\n this._initHandler();\n }\n\n if (!this.processor) {\n this._initProcessor();\n }\n\n if (!this.tooltipHandler?.showTooltip) {\n return false;\n }\n const result = showTooltip(datum, options, this);\n if (result !== 'none') {\n this._alwaysShow = !!options?.alwaysShow;\n }\n return result;\n }\n\n /** 手动隐藏 tooltip,返回是否成功 */\n hideTooltip(): boolean {\n const params: TooltipHandlerParams = {\n changePositionOnly: false,\n tooltip: this,\n item: undefined,\n datum: undefined,\n source: Event_Source_Type.chart\n } as any;\n\n this._alwaysShow = false;\n return !this._hideTooltipByHandler(params);\n }\n\n private _isSameAsCache(\n nextInfo?: TooltipInfo,\n nextParams?: BaseEventParams,\n nextActiveType?: TooltipActiveType\n ): boolean {\n if (nextActiveType !== this._cacheActiveType) {\n return false;\n }\n if (nextInfo === this._cacheInfo) {\n return true;\n }\n if (isNil(this._cacheInfo) || isNil(nextInfo)) {\n return false;\n }\n\n // 判断 tooltip 信息是否一致\n if (isDimensionInfo(nextInfo)) {\n if (isMarkInfo(this._cacheInfo)) {\n return false;\n }\n\n const prevInfo = this._cacheInfo as DimensionTooltipInfo;\n const isSameAsCacheInfo =\n prevInfo.length === nextInfo.length && nextInfo.every((info, i) => isSameDimensionInfo(info, prevInfo[i]));\n if (!isSameAsCacheInfo) {\n return false;\n }\n } else {\n if (isDimensionInfo(this._cacheInfo)) {\n return false;\n }\n\n const prevInfo = this._cacheInfo as MarkTooltipInfo;\n const isSameAsCacheInfo =\n nextInfo?.datum === prevInfo.datum && nextInfo?.mark === prevInfo.mark && nextInfo?.series === prevInfo.series;\n if (!isSameAsCacheInfo) {\n return false;\n }\n }\n\n // 判断事件触发信息是否一致\n const prevParams = this._cacheParams;\n if (isNil(prevParams) || isNil(nextParams)) {\n return false;\n }\n return (\n prevParams.mark === nextParams.mark &&\n prevParams.model === nextParams.model &&\n prevParams.datum === nextParams.datum\n );\n }\n\n private _isPointerInChart(point: IPoint): boolean {\n const globalInstance = this._option?.globalInstance;\n if (!globalInstance) {\n return false;\n }\n const chart = globalInstance.getChart();\n if (!chart) {\n return false;\n }\n const { x, y } = point;\n const canvas = globalInstance.getCanvas();\n const { x: chartX, y: chartY, width: chartWidth, height: chartHeight } = canvas.getBoundingClientRect();\n // 鼠标仍在图表范围内,则不处理\n if (x >= chartX && x <= chartX + chartWidth && y >= chartY && y <= chartY + chartHeight) {\n return true;\n }\n\n return false;\n }\n\n private _isPointerOnTooltip(params: BaseEventParams): boolean {\n // TODO:后续支持 renderMode === 'canvas' 场景\n if (this._spec.enterable && this._spec.renderMode === 'html') {\n const { event } = params;\n let newTarget: any;\n if (isValid(event.nativeEvent)) {\n // get native event object\n const nativeEvent = event.nativeEvent as any;\n newTarget = nativeEvent.relatedTarget;\n // if in shadow DOM use composedPath to access target\n // FIXME: shadow DOM 的 relatedTarget 的属性是?\n if (nativeEvent.composedPath && nativeEvent.composedPath().length > 0) {\n newTarget = nativeEvent.composedPath()[0];\n }\n } else {\n newTarget = event.relatedTarget;\n }\n const container = this.tooltipHandler?.getTooltipContainer?.();\n if (isValid(container) && isValid(newTarget) && hasParentElement(newTarget, container)) {\n return true;\n }\n }\n return false;\n }\n\n getVisible() {\n return this._spec.visible !== false;\n }\n}\n\nexport const registerTooltip = () => {\n Factory.registerComponent(Tooltip.type, Tooltip);\n};\n"]}
|
package/cjs/component/util.js
CHANGED
|
@@ -22,4 +22,5 @@ function getFormatFunction(formatMethod, formatter, text, datum) {
|
|
|
22
22
|
} : {};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
exports.getComponentThemeFromOption = getComponentThemeFromOption, exports.getFormatFunction = getFormatFunction;
|
|
25
|
+
exports.getComponentThemeFromOption = getComponentThemeFromOption, exports.getFormatFunction = getFormatFunction;
|
|
26
|
+
//# sourceMappingURL=util.js.map
|
package/cjs/core/index.d.ts
CHANGED
|
@@ -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 = "1.11.
|
|
4
|
+
export declare const version = "1.11.8";
|
|
5
5
|
export type { IVChart } from './interface';
|
|
6
6
|
export type { IStateSpec, StateValueType } from '../compile/mark';
|
|
7
7
|
export * from '../typings/spec/common';
|
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 = "1.11.
|
|
38
|
+
}), exports.version = "1.11.8", __exportStar(require("../typings/spec/common"), exports),
|
|
39
39
|
__exportStar(require("../event/interface"), exports), __exportStar(require("../theme/interface"), exports),
|
|
40
40
|
__exportStar(require("../constant"), exports), __exportStar(require("./interface"), exports),
|
|
41
41
|
__exportStar(require("../typings/spec/index"), exports), __exportStar(require("../typings/tooltip"), exports),
|
package/cjs/core/index.js.map
CHANGED
|
@@ -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;AAMhC,yDAAuC;AACvC,qDAAmC;AACnC,qDAAmC;AACnC,8CAA4B;AAC5B,8CAA4B;AAK5B,wDAAsC;AAGtC,qDAAmC;AAGnC,iDAA+B;AAG/B,uDAAiD;AAAxC,uGAAA,OAAO,OAAA;AAGhB,4CAA0B","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 = \"1.11.
|
|
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;AAMhC,yDAAuC;AACvC,qDAAmC;AACnC,qDAAmC;AACnC,8CAA4B;AAC5B,8CAA4B;AAK5B,wDAAsC;AAGtC,qDAAmC;AAGnC,iDAA+B;AAG/B,uDAAiD;AAAxC,uGAAA,OAAO,OAAA;AAGhB,4CAA0B","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 = \"1.11.8\";\n\n// export necessary types\nexport type { IVChart } from './interface';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\n\nexport * from '../typings/spec/common';\nexport * from '../event/interface';\nexport * from '../theme/interface';\nexport * from '../constant';\nexport * from './interface';\n\n/**\n * spec\n */\nexport * from '../typings/spec/index';\n\n// tooltip\nexport * from '../typings/tooltip';\n\n// theme\nexport * from '../theme/index';\n\n// vrender\nexport { vglobal } from '@visactor/vrender-core';\n\n// plugin\nexport * from '../plugin';\n"]}
|
package/esm/chart/stack.js
CHANGED
|
@@ -75,13 +75,12 @@ export class Tooltip extends BaseComponent {
|
|
|
75
75
|
ignore: mouseEventData.ignore[activeType]
|
|
76
76
|
})) return !1;
|
|
77
77
|
let success;
|
|
78
|
-
if (useCache) success = !processor.showTooltip(this._cacheInfo, params, !0); else {
|
|
78
|
+
if (this._timer && clearTimeout(this._timer), useCache) success = !processor.showTooltip(this._cacheInfo, params, !0); else {
|
|
79
79
|
const tooltipInfo = mouseEventData.tooltipInfo[activeType], isSameAsCache = this._isSameAsCache(tooltipInfo, params, activeType);
|
|
80
80
|
success = !processor.showTooltip(tooltipInfo, params, isSameAsCache), success && (this._cacheInfo = tooltipInfo,
|
|
81
81
|
this._cacheParams = params, this._cacheActiveType = activeType);
|
|
82
82
|
}
|
|
83
|
-
success && (this._isTooltipShown = !0, isClick && this._spec.lockAfterClick && !this._clickLock ? this._clickLock = !0 : Number.isFinite(this._spec.hideTimer) && (this._timer
|
|
84
|
-
this._timer = setTimeout((() => {
|
|
83
|
+
success && (this._isTooltipShown = !0, isClick && this._spec.lockAfterClick && !this._clickLock ? this._clickLock = !0 : Number.isFinite(this._spec.hideTimer) && (this._timer = setTimeout((() => {
|
|
85
84
|
this._handleChartMouseOut();
|
|
86
85
|
}), this._spec.hideTimer)));
|
|
87
86
|
const vchart = null === (_a = this._option) || void 0 === _a ? void 0 : _a.globalInstance;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/component/tooltip/tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAIvD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AASpF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAG/D,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACrG,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG/D,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,YAA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G,MAAM,CAAC;YACzB,IAAI,SAAc,CAAC;YACnB,IAAI,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE;gBAE9B,MAAM,WAAW,GAAG,KAAK,CAAC,WAAkB,CAAC;gBAC7C,SAAS,GAAG,WAAW,CAAC,aAAa,CAAC;gBAGtC,IAAI,WAAW,CAAC,YAAY,IAAI,WAAW,CAAC,YAAY,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE;oBACrE,SAAS,GAAG,WAAW,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC;iBAC3C;aACF;iBAAM;gBACL,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC;aACjC;YACD,MAAM,SAAS,GAAG,MAAA,MAAA,IAAI,CAAC,cAAc,0CAAE,mBAAmB,kDAAI,CAAC;YAC/D,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE;gBACtF,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC;IACtC,CAAC;;AAliBM,YAAI,GAAG,iBAAiB,CAAC,OAAO,CAAC;AACxB,8BAAsB,GAAG,sBAAsB,CAAC;AAKzD,eAAO,GAAG,SAAS,CAAC;AA+hB7B,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC,CAAC","file":"tooltip.js","sourcesContent":["import { ComponentTypeEnum } from '../interface/type';\nimport type { IModelLayoutOption, IModelRenderOption, IModelSpecInfo } from '../../model/interface';\nimport type { IRegion } from '../../region/interface';\nimport { BaseComponent } from '../base/base-component';\nimport type { BaseEventParams, EventCallback, EventQuery, EventType } from '../../event/interface';\nimport type { ITooltipHandler, TooltipActiveType } from '../../typings/tooltip';\nimport type { Datum, IPoint, IShowTooltipOption } from '../../typings';\nimport { isMobileLikeMode, isTrueBrowser, isMiniAppLikeMode } from '../../util/env';\nimport type {\n ITooltip,\n ITooltipActiveTypeAsKeys,\n ITooltipSpec,\n TooltipHandlerParams,\n TotalMouseEventData\n} from './interface';\nimport { TooltipResult } from './interface/common';\nimport { showTooltip } from './utils/show-tooltip';\nimport { isEmptyPos } from './utils/common';\nimport { isSameDimensionInfo } from '../../event/events/dimension/util/common';\nimport { ChartEvent, Event_Source_Type } from '../../constant';\nimport type { BaseTooltipProcessor, DimensionTooltipInfo, MarkTooltipInfo, TooltipInfo } from './processor';\n// eslint-disable-next-line no-duplicate-imports\nimport { GroupTooltipProcessor, DimensionTooltipProcessor, MarkTooltipProcessor } from './processor';\nimport { isDimensionInfo, isMarkInfo } from './processor/util';\nimport type { Maybe } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { hasParentElement, isArray, isValid, isNil, array } from '@visactor/vutils';\nimport { VChart } from '../../core/vchart';\nimport type { TooltipEventParams } from './interface/event';\nimport { Factory } from '../../core/factory';\nimport type { IGraphic } from '@visactor/vrender-core';\nimport { TooltipSpecTransformer } from './tooltip-transformer';\nimport { error } from '../../util';\nimport { TooltipHandlerType } from './constant';\n\ntype EventHandlerList = {\n eventType: EventType;\n handler: any;\n}[];\n\nexport class Tooltip extends BaseComponent<any> implements ITooltip {\n protected layoutZIndex: number = 1;\n static type = ComponentTypeEnum.tooltip;\n static readonly transformerConstructor = TooltipSpecTransformer;\n type = ComponentTypeEnum.tooltip;\n name: string = ComponentTypeEnum.tooltip;\n readonly transformerConstructor = TooltipSpecTransformer;\n\n static specKey = 'tooltip';\n specKey = 'tooltip';\n\n layoutType: 'none' = 'none';\n private _timer?: number;\n protected declare _spec: ITooltipSpec;\n\n static getSpecInfo(chartSpec: any): Maybe<IModelSpecInfo[]> {\n const tooltipSpec = chartSpec[this.specKey];\n if (!tooltipSpec) {\n return null;\n }\n if (!isArray(tooltipSpec)) {\n return [\n {\n spec: tooltipSpec,\n specPath: [this.specKey],\n specInfoPath: ['component', this.specKey, 0],\n type: ComponentTypeEnum.tooltip\n }\n ];\n }\n const specInfos: IModelSpecInfo[] = [];\n tooltipSpec.forEach((s: any, i: number) => {\n specInfos.push({\n spec: s,\n specPath: [this.specKey, i],\n specInfoPath: ['component', this.specKey, i],\n type: ComponentTypeEnum.tooltip\n });\n });\n return specInfos;\n }\n\n tooltipHandler?: ITooltipHandler;\n\n processor: ITooltipActiveTypeAsKeys<MarkTooltipProcessor, DimensionTooltipProcessor, GroupTooltipProcessor>;\n\n private _alwaysShow: boolean = false;\n\n private _cacheInfo: TooltipInfo | undefined;\n private _cacheParams: BaseEventParams | undefined;\n private _cacheActiveType: TooltipActiveType | undefined;\n\n private _eventList: EventHandlerList = [];\n\n protected _isTooltipShown: boolean = false;\n\n protected _clickLock: boolean = false;\n\n /** 当前是否正在显示 tooltip */\n isTooltipShown() {\n return this._isTooltipShown;\n }\n\n changeRegions(regions: IRegion[]) {\n /* do nothing */\n }\n protected _getNeedClearVRenderComponents(): IGraphic[] {\n return [];\n }\n protected _registerEvent() {\n /* do nothing */\n }\n protected _releaseEvent() {\n /* do nothing */\n }\n onLayout(ctx: IModelLayoutOption) {\n /* do nothing */\n }\n onLayoutEnd(ctx: IModelLayoutOption) {\n /* do nothing */\n }\n onRender(ctx: IModelRenderOption) {\n /* do nothing */\n }\n\n created() {\n super.created();\n this._regions = this._option.getAllRegions();\n // event\n this._initEvent();\n }\n\n release() {\n super.release();\n if (this._timer) {\n clearTimeout(this._timer);\n }\n\n this._eventList.forEach(({ eventType, handler }) => {\n this.event.off(eventType, handler);\n });\n this._eventList = [];\n this.tooltipHandler?.release?.();\n this._isTooltipShown = false;\n }\n\n beforeRelease() {\n // 触发事件\n this.event.emit(ChartEvent.tooltipHide, {\n tooltip: this,\n chart: this.getChart()\n } as unknown as TooltipEventParams);\n this.event.emit(ChartEvent.tooltipRelease, {\n tooltip: this,\n chart: this.getChart()\n } as unknown as TooltipEventParams);\n }\n\n protected _initHandler() {\n const renderMode = this._spec.renderMode ?? 'html';\n\n const userTooltipHandler = this._option.globalInstance.getTooltipHandlerByUser();\n if (userTooltipHandler) {\n this.tooltipHandler = userTooltipHandler;\n } else {\n // 构造内部默认 handler\n const type = renderMode === 'canvas' ? TooltipHandlerType.canvas : TooltipHandlerType.dom;\n const handlerConstructor = Factory.getComponentPluginInType(type);\n if (!handlerConstructor) {\n error('Can not find tooltip handler: ' + type);\n }\n const handler = new handlerConstructor();\n handler.name = `${this._spec.className}-${this._option.globalInstance.id ?? 0}-${this.getSpecIndex()}`;\n this.pluginService?.load([handler]);\n\n this.tooltipHandler = handler as unknown as ITooltipHandler;\n }\n }\n\n protected _initProcessor() {\n // 初始化 tooltip 类型\n this.processor = {\n mark: new MarkTooltipProcessor(this),\n dimension: new DimensionTooltipProcessor(this),\n group: new GroupTooltipProcessor(this)\n };\n }\n\n protected _initEvent() {\n if (this._option.disableTriggerEvent) {\n return;\n }\n const trigger = array(this._spec.trigger ?? 'hover');\n // TODO: triggerOff完整支持\n // const triggerOff = this._spec.triggerOff ?? trigger;\n const mode = this._option.mode;\n\n if (trigger.includes('hover')) {\n this._mountEvent('pointermove', { source: 'chart' }, this._getMouseMoveHandler(false));\n // 移动端的点按 + 滑动触发\n if (isMobileLikeMode(mode) || isMiniAppLikeMode(mode)) {\n this._mountEvent('pointerdown', { source: 'chart' }, this._getMouseMoveHandler(false));\n this._mountEvent('pointerup', { source: 'window' }, this._getMouseOutHandler(true));\n }\n this._mountEvent('pointerout', { source: 'canvas' }, this._getMouseOutHandler(false));\n }\n if (trigger.includes('click')) {\n this._mountEvent('pointertap', { source: 'chart' }, this._getMouseMoveHandler(true));\n this._mountEvent('pointerup', { source: 'window' }, this._getMouseOutHandler(true));\n }\n }\n\n protected _mountEvent = (eType: EventType, query: EventQuery, callback: EventCallback<any>) => {\n this.event.on(eType, query, callback);\n this._eventList.push({\n eventType: eType,\n handler: callback\n });\n };\n\n protected _getMouseOutHandler = (needPointerDetection?: boolean) => (params: BaseEventParams) => {\n if (this._alwaysShow) {\n return;\n }\n\n if (!this._isTooltipShown && !this.tooltipHandler?.isTooltipShown?.()) {\n return;\n }\n\n const browserEnv = isTrueBrowser(this._option?.mode);\n const { clientX, clientY } = params.event as MouseEvent;\n\n // 当 enterable 为 true,同时鼠标移入 tooltip 时 pointerleave 事件也会触发,所以这里做一个判断\n if (browserEnv && this._isPointerOnTooltip(params)) {\n return;\n }\n\n // 判断鼠标是否在图表范围内\n if (browserEnv && needPointerDetection && this._isPointerInChart({ x: clientX, y: clientY })) {\n return;\n }\n\n this._handleChartMouseOut(params);\n };\n\n protected _handleChartMouseOut = (params?: BaseEventParams) => {\n if (this._alwaysShow) {\n return;\n }\n\n if (this._spec.triggerOff !== 'none') {\n this._hideTooltipByHandler({\n ...(params as any),\n tooltip: this\n });\n this._cacheInfo = undefined;\n this._cacheParams = undefined;\n this._cacheActiveType = undefined;\n }\n };\n\n protected _getMouseMoveHandler = (isClick: boolean) => (params: BaseEventParams) => {\n if (!this.tooltipHandler) {\n this._initHandler();\n }\n\n if (!this.processor) {\n this._initProcessor();\n }\n\n if (this._alwaysShow) {\n return;\n }\n if (this._isPointerOnTooltip(params)) {\n return;\n }\n if (!isClick && this._clickLock) {\n return;\n }\n\n /* 获取 tooltip 原始数据 */\n const mouseEventData = this._getMouseEventData(params);\n const {\n tooltipInfo: { dimension: dimensionInfo },\n ignore: { mark: ignoreMark, dimension: ignoreDimension }\n } = mouseEventData;\n\n /** tooltip 是否显示成功 */\n const success: ITooltipActiveTypeAsKeys<boolean, boolean, boolean> = {\n mark: false,\n dimension: false,\n group: false\n };\n\n /* 显示常规tooltip */\n success.group = this._showTooltipByMouseEvent('group', mouseEventData, params, isClick);\n if (!success.group) {\n success.mark = this._showTooltipByMouseEvent('mark', mouseEventData, params, isClick);\n }\n if (!success.mark && !success.group) {\n success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick);\n }\n\n /* 如果不是常规情况,进行一些特殊情况tooltip处理 */\n if (Object.values(success).every(val => !val) && !isEmptyPos(params)) {\n // 用户手动配置ignore,则继续显示缓存tooltip\n if (ignoreMark && isMarkInfo(this._cacheInfo)) {\n success.mark = this._showTooltipByMouseEvent('mark', mouseEventData, params, isClick, true);\n } else if (ignoreDimension && isDimensionInfo(this._cacheInfo)) {\n success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick, true);\n } else if (isValid(dimensionInfo)) {\n // 用户没有手动配置ignore的话,默认显示dimension tooltip\n success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick);\n }\n }\n\n /* 如果还是不应该显示tooltip,则隐藏上一次tooltip */\n if (!success.mark && !success.group && (!success.dimension || isNil(dimensionInfo))) {\n this._handleChartMouseOut(params);\n if (isClick && this._clickLock) {\n this._clickLock = false;\n }\n }\n };\n\n /**\n * 通过鼠标事件触发 tooltip,返回是否成功\n * @param activeType tooltip 类型\n * @param mouseEventData tooltip 相关数据\n * @param params 事件参数\n * @param useCache 是否直接显示缓存 tooltip\n * @returns 是否成功执行\n */\n protected _showTooltipByMouseEvent = (\n activeType: TooltipActiveType,\n mouseEventData: TotalMouseEventData,\n params: BaseEventParams,\n isClick: boolean,\n useCache?: boolean\n ): boolean => {\n const processor = this.processor[activeType];\n // 判断是否应该触发 tooltip\n if (\n !processor.shouldHandleTooltip(params, {\n tooltipInfo: mouseEventData.tooltipInfo[activeType],\n ignore: mouseEventData.ignore[activeType]\n })\n ) {\n return false;\n }\n\n let success: boolean;\n if (useCache) {\n // 直接显示缓存 tooltip\n success = !processor.showTooltip(this._cacheInfo as any, params, true);\n } else {\n const tooltipInfo = mouseEventData.tooltipInfo[activeType];\n const isSameAsCache = this._isSameAsCache(tooltipInfo, params, activeType);\n success = !processor.showTooltip(tooltipInfo as any, params, isSameAsCache);\n if (success) {\n // 成功显示 tooltip,则更新缓存\n this._cacheInfo = tooltipInfo;\n this._cacheParams = params;\n this._cacheActiveType = activeType;\n }\n }\n if (success) {\n this._isTooltipShown = true;\n if (isClick && this._spec.lockAfterClick && !this._clickLock) {\n this._clickLock = true;\n } else if (Number.isFinite(this._spec.hideTimer)) {\n if (this._timer) {\n clearTimeout(this._timer);\n }\n\n this._timer = setTimeout(() => {\n this._handleChartMouseOut();\n }, this._spec.hideTimer as number) as unknown as number;\n }\n }\n // 全局唯一 tooltip\n const vchart = this._option?.globalInstance;\n if (success && VChart.globalConfig.uniqueTooltip && vchart) {\n VChart.hideTooltip(vchart.id);\n }\n return success;\n };\n\n protected _getMouseEventData = (params: BaseEventParams): TotalMouseEventData => {\n const result: TotalMouseEventData = {\n tooltipInfo: {},\n ignore: {}\n };\n\n let activeType: TooltipActiveType = 'dimension';\n const { tooltipInfo, ignore } = this.processor[activeType].getMouseEventData(params);\n result.tooltipInfo[activeType] = tooltipInfo as any;\n result.ignore[activeType] = ignore;\n\n const dimensionInfo = tooltipInfo as DimensionTooltipInfo;\n\n for (activeType of Object.keys(this.processor) as any) {\n if (activeType !== 'dimension') {\n const { tooltipInfo, ignore } = this.processor[activeType].getMouseEventData(params, dimensionInfo);\n result.tooltipInfo[activeType] = tooltipInfo as any;\n result.ignore[activeType] = ignore;\n }\n }\n return result;\n };\n\n protected _hideTooltipByHandler = (params: TooltipHandlerParams): TooltipResult => {\n if (!this._isTooltipShown && !this.tooltipHandler?.isTooltipShown?.()) {\n // 如果当前 tooltip 未显示,则提前退出\n return TooltipResult.success;\n }\n\n // 触发事件\n this.event.emit(ChartEvent.tooltipHide, {\n ...params,\n source: Event_Source_Type.chart, // 统一 event 的来源\n tooltip: this\n });\n\n // 删除缓存\n Object.values(this.processor).forEach((processor: BaseTooltipProcessor) => {\n processor.clearCache();\n });\n\n // 隐藏 tooltip\n let hideTooltip;\n if (this._spec.handler?.hideTooltip) {\n hideTooltip = this._spec.handler.hideTooltip.bind(this._spec.handler);\n } else if (this.tooltipHandler?.hideTooltip) {\n hideTooltip = this.tooltipHandler.hideTooltip.bind(this.tooltipHandler);\n }\n if (hideTooltip) {\n const result = hideTooltip(params);\n if (!result) {\n this._isTooltipShown = false;\n }\n return result;\n }\n return TooltipResult.failed;\n };\n\n reInit(spec?: any) {\n super.reInit(spec);\n\n if (this.tooltipHandler) {\n this.tooltipHandler.reInit?.();\n } else {\n this._initHandler();\n }\n }\n\n showTooltip(datum: Datum, options: IShowTooltipOption) {\n if (!this.tooltipHandler) {\n this._initHandler();\n }\n\n if (!this.processor) {\n this._initProcessor();\n }\n\n if (!this.tooltipHandler?.showTooltip) {\n return false;\n }\n const result = showTooltip(datum, options, this);\n if (result !== 'none') {\n this._alwaysShow = !!options?.alwaysShow;\n }\n return result;\n }\n\n /** 手动隐藏 tooltip,返回是否成功 */\n hideTooltip(): boolean {\n const params: TooltipHandlerParams = {\n changePositionOnly: false,\n tooltip: this,\n item: undefined,\n datum: undefined,\n source: Event_Source_Type.chart\n } as any;\n\n this._alwaysShow = false;\n return !this._hideTooltipByHandler(params);\n }\n\n private _isSameAsCache(\n nextInfo?: TooltipInfo,\n nextParams?: BaseEventParams,\n nextActiveType?: TooltipActiveType\n ): boolean {\n if (nextActiveType !== this._cacheActiveType) {\n return false;\n }\n if (nextInfo === this._cacheInfo) {\n return true;\n }\n if (isNil(this._cacheInfo) || isNil(nextInfo)) {\n return false;\n }\n\n // 判断 tooltip 信息是否一致\n if (isDimensionInfo(nextInfo)) {\n if (isMarkInfo(this._cacheInfo)) {\n return false;\n }\n\n const prevInfo = this._cacheInfo as DimensionTooltipInfo;\n const isSameAsCacheInfo =\n prevInfo.length === nextInfo.length && nextInfo.every((info, i) => isSameDimensionInfo(info, prevInfo[i]));\n if (!isSameAsCacheInfo) {\n return false;\n }\n } else {\n if (isDimensionInfo(this._cacheInfo)) {\n return false;\n }\n\n const prevInfo = this._cacheInfo as MarkTooltipInfo;\n const isSameAsCacheInfo =\n nextInfo?.datum === prevInfo.datum && nextInfo?.mark === prevInfo.mark && nextInfo?.series === prevInfo.series;\n if (!isSameAsCacheInfo) {\n return false;\n }\n }\n\n // 判断事件触发信息是否一致\n const prevParams = this._cacheParams;\n if (isNil(prevParams) || isNil(nextParams)) {\n return false;\n }\n return (\n prevParams.mark === nextParams.mark &&\n prevParams.model === nextParams.model &&\n prevParams.datum === nextParams.datum\n );\n }\n\n private _isPointerInChart(point: IPoint): boolean {\n const globalInstance = this._option?.globalInstance;\n if (!globalInstance) {\n return false;\n }\n const chart = globalInstance.getChart();\n if (!chart) {\n return false;\n }\n const { x, y } = point;\n const canvas = globalInstance.getCanvas();\n const { x: chartX, y: chartY, width: chartWidth, height: chartHeight } = canvas.getBoundingClientRect();\n // 鼠标仍在图表范围内,则不处理\n if (x >= chartX && x <= chartX + chartWidth && y >= chartY && y <= chartY + chartHeight) {\n return true;\n }\n\n return false;\n }\n\n private _isPointerOnTooltip(params: BaseEventParams): boolean {\n // TODO:后续支持 renderMode === 'canvas' 场景\n if (this._spec.enterable && this._spec.renderMode === 'html') {\n const { event } = params;\n let newTarget: any;\n if (isValid(event.nativeEvent)) {\n // get native event object\n const nativeEvent = event.nativeEvent as any;\n newTarget = nativeEvent.relatedTarget;\n // if in shadow DOM use composedPath to access target\n // FIXME: shadow DOM 的 relatedTarget 的属性是?\n if (nativeEvent.composedPath && nativeEvent.composedPath().length > 0) {\n newTarget = nativeEvent.composedPath()[0];\n }\n } else {\n newTarget = event.relatedTarget;\n }\n const container = this.tooltipHandler?.getTooltipContainer?.();\n if (isValid(container) && isValid(newTarget) && hasParentElement(newTarget, container)) {\n return true;\n }\n }\n return false;\n }\n\n getVisible() {\n return this._spec.visible !== false;\n }\n}\n\nexport const registerTooltip = () => {\n Factory.registerComponent(Tooltip.type, Tooltip);\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/component/tooltip/tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,EAAE,aAAa,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,cAAc,0CAAE,mBAAmB,kDAAI,CAAC;YAC/D,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE;gBACtF,OAAO,IAAI,CAAC;aACb;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC;IACtC,CAAC;;AAjiBM,YAAI,GAAG,iBAAiB,CAAC,OAAO,CAAC;AACxB,8BAAsB,GAAG,sBAAsB,CAAC;AAKzD,eAAO,GAAG,SAAS,CAAC;AA8hB7B,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC,CAAC","file":"tooltip.js","sourcesContent":["import { ComponentTypeEnum } from '../interface/type';\nimport type { IModelLayoutOption, IModelRenderOption, IModelSpecInfo } from '../../model/interface';\nimport type { IRegion } from '../../region/interface';\nimport { BaseComponent } from '../base/base-component';\nimport type { BaseEventParams, EventCallback, EventQuery, EventType } from '../../event/interface';\nimport type { ITooltipHandler, TooltipActiveType } from '../../typings/tooltip';\nimport type { Datum, IPoint, IShowTooltipOption } from '../../typings';\nimport { isMobileLikeMode, isTrueBrowser, isMiniAppLikeMode } from '../../util/env';\nimport type {\n ITooltip,\n ITooltipActiveTypeAsKeys,\n ITooltipSpec,\n TooltipHandlerParams,\n TotalMouseEventData\n} from './interface';\nimport { TooltipResult } from './interface/common';\nimport { showTooltip } from './utils/show-tooltip';\nimport { isEmptyPos } from './utils/common';\nimport { isSameDimensionInfo } from '../../event/events/dimension/util/common';\nimport { ChartEvent, Event_Source_Type } from '../../constant';\nimport type { BaseTooltipProcessor, DimensionTooltipInfo, MarkTooltipInfo, TooltipInfo } from './processor';\n// eslint-disable-next-line no-duplicate-imports\nimport { GroupTooltipProcessor, DimensionTooltipProcessor, MarkTooltipProcessor } from './processor';\nimport { isDimensionInfo, isMarkInfo } from './processor/util';\nimport type { Maybe } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { hasParentElement, isArray, isValid, isNil, array } from '@visactor/vutils';\nimport { VChart } from '../../core/vchart';\nimport type { TooltipEventParams } from './interface/event';\nimport { Factory } from '../../core/factory';\nimport type { IGraphic } from '@visactor/vrender-core';\nimport { TooltipSpecTransformer } from './tooltip-transformer';\nimport { error } from '../../util';\nimport { TooltipHandlerType } from './constant';\n\ntype EventHandlerList = {\n eventType: EventType;\n handler: any;\n}[];\n\nexport class Tooltip extends BaseComponent<any> implements ITooltip {\n protected layoutZIndex: number = 1;\n static type = ComponentTypeEnum.tooltip;\n static readonly transformerConstructor = TooltipSpecTransformer;\n type = ComponentTypeEnum.tooltip;\n name: string = ComponentTypeEnum.tooltip;\n readonly transformerConstructor = TooltipSpecTransformer;\n\n static specKey = 'tooltip';\n specKey = 'tooltip';\n\n layoutType: 'none' = 'none';\n private _timer?: number;\n protected declare _spec: ITooltipSpec;\n\n static getSpecInfo(chartSpec: any): Maybe<IModelSpecInfo[]> {\n const tooltipSpec = chartSpec[this.specKey];\n if (!tooltipSpec) {\n return null;\n }\n if (!isArray(tooltipSpec)) {\n return [\n {\n spec: tooltipSpec,\n specPath: [this.specKey],\n specInfoPath: ['component', this.specKey, 0],\n type: ComponentTypeEnum.tooltip\n }\n ];\n }\n const specInfos: IModelSpecInfo[] = [];\n tooltipSpec.forEach((s: any, i: number) => {\n specInfos.push({\n spec: s,\n specPath: [this.specKey, i],\n specInfoPath: ['component', this.specKey, i],\n type: ComponentTypeEnum.tooltip\n });\n });\n return specInfos;\n }\n\n tooltipHandler?: ITooltipHandler;\n\n processor: ITooltipActiveTypeAsKeys<MarkTooltipProcessor, DimensionTooltipProcessor, GroupTooltipProcessor>;\n\n private _alwaysShow: boolean = false;\n\n private _cacheInfo: TooltipInfo | undefined;\n private _cacheParams: BaseEventParams | undefined;\n private _cacheActiveType: TooltipActiveType | undefined;\n\n private _eventList: EventHandlerList = [];\n\n protected _isTooltipShown: boolean = false;\n\n protected _clickLock: boolean = false;\n\n /** 当前是否正在显示 tooltip */\n isTooltipShown() {\n return this._isTooltipShown;\n }\n\n changeRegions(regions: IRegion[]) {\n /* do nothing */\n }\n protected _getNeedClearVRenderComponents(): IGraphic[] {\n return [];\n }\n protected _registerEvent() {\n /* do nothing */\n }\n protected _releaseEvent() {\n /* do nothing */\n }\n onLayout(ctx: IModelLayoutOption) {\n /* do nothing */\n }\n onLayoutEnd(ctx: IModelLayoutOption) {\n /* do nothing */\n }\n onRender(ctx: IModelRenderOption) {\n /* do nothing */\n }\n\n created() {\n super.created();\n this._regions = this._option.getAllRegions();\n // event\n this._initEvent();\n }\n\n release() {\n super.release();\n if (this._timer) {\n clearTimeout(this._timer);\n }\n\n this._eventList.forEach(({ eventType, handler }) => {\n this.event.off(eventType, handler);\n });\n this._eventList = [];\n this.tooltipHandler?.release?.();\n this._isTooltipShown = false;\n }\n\n beforeRelease() {\n // 触发事件\n this.event.emit(ChartEvent.tooltipHide, {\n tooltip: this,\n chart: this.getChart()\n } as unknown as TooltipEventParams);\n this.event.emit(ChartEvent.tooltipRelease, {\n tooltip: this,\n chart: this.getChart()\n } as unknown as TooltipEventParams);\n }\n\n protected _initHandler() {\n const renderMode = this._spec.renderMode ?? 'html';\n\n const userTooltipHandler = this._option.globalInstance.getTooltipHandlerByUser();\n if (userTooltipHandler) {\n this.tooltipHandler = userTooltipHandler;\n } else {\n // 构造内部默认 handler\n const type = renderMode === 'canvas' ? TooltipHandlerType.canvas : TooltipHandlerType.dom;\n const handlerConstructor = Factory.getComponentPluginInType(type);\n if (!handlerConstructor) {\n error('Can not find tooltip handler: ' + type);\n }\n const handler = new handlerConstructor();\n handler.name = `${this._spec.className}-${this._option.globalInstance.id ?? 0}-${this.getSpecIndex()}`;\n this.pluginService?.load([handler]);\n\n this.tooltipHandler = handler as unknown as ITooltipHandler;\n }\n }\n\n protected _initProcessor() {\n // 初始化 tooltip 类型\n this.processor = {\n mark: new MarkTooltipProcessor(this),\n dimension: new DimensionTooltipProcessor(this),\n group: new GroupTooltipProcessor(this)\n };\n }\n\n protected _initEvent() {\n if (this._option.disableTriggerEvent) {\n return;\n }\n const trigger = array(this._spec.trigger ?? 'hover');\n // TODO: triggerOff完整支持\n // const triggerOff = this._spec.triggerOff ?? trigger;\n const mode = this._option.mode;\n\n if (trigger.includes('hover')) {\n this._mountEvent('pointermove', { source: 'chart' }, this._getMouseMoveHandler(false));\n // 移动端的点按 + 滑动触发\n if (isMobileLikeMode(mode) || isMiniAppLikeMode(mode)) {\n this._mountEvent('pointerdown', { source: 'chart' }, this._getMouseMoveHandler(false));\n this._mountEvent('pointerup', { source: 'window' }, this._getMouseOutHandler(true));\n }\n this._mountEvent('pointerout', { source: 'canvas' }, this._getMouseOutHandler(false));\n }\n if (trigger.includes('click')) {\n this._mountEvent('pointertap', { source: 'chart' }, this._getMouseMoveHandler(true));\n this._mountEvent('pointerup', { source: 'window' }, this._getMouseOutHandler(true));\n }\n }\n\n protected _mountEvent = (eType: EventType, query: EventQuery, callback: EventCallback<any>) => {\n this.event.on(eType, query, callback);\n this._eventList.push({\n eventType: eType,\n handler: callback\n });\n };\n\n protected _getMouseOutHandler = (needPointerDetection?: boolean) => (params: BaseEventParams) => {\n if (this._alwaysShow) {\n return;\n }\n\n if (!this._isTooltipShown && !this.tooltipHandler?.isTooltipShown?.()) {\n return;\n }\n\n const browserEnv = isTrueBrowser(this._option?.mode);\n const { clientX, clientY } = params.event as MouseEvent;\n\n // 当 enterable 为 true,同时鼠标移入 tooltip 时 pointerleave 事件也会触发,所以这里做一个判断\n if (browserEnv && this._isPointerOnTooltip(params)) {\n return;\n }\n\n // 判断鼠标是否在图表范围内\n if (browserEnv && needPointerDetection && this._isPointerInChart({ x: clientX, y: clientY })) {\n return;\n }\n\n this._handleChartMouseOut(params);\n };\n\n protected _handleChartMouseOut = (params?: BaseEventParams) => {\n if (this._alwaysShow) {\n return;\n }\n\n if (this._spec.triggerOff !== 'none') {\n this._hideTooltipByHandler({\n ...(params as any),\n tooltip: this\n });\n this._cacheInfo = undefined;\n this._cacheParams = undefined;\n this._cacheActiveType = undefined;\n }\n };\n\n protected _getMouseMoveHandler = (isClick: boolean) => (params: BaseEventParams) => {\n if (!this.tooltipHandler) {\n this._initHandler();\n }\n\n if (!this.processor) {\n this._initProcessor();\n }\n\n if (this._alwaysShow) {\n return;\n }\n if (this._isPointerOnTooltip(params)) {\n return;\n }\n if (!isClick && this._clickLock) {\n return;\n }\n\n /* 获取 tooltip 原始数据 */\n const mouseEventData = this._getMouseEventData(params);\n const {\n tooltipInfo: { dimension: dimensionInfo },\n ignore: { mark: ignoreMark, dimension: ignoreDimension }\n } = mouseEventData;\n\n /** tooltip 是否显示成功 */\n const success: ITooltipActiveTypeAsKeys<boolean, boolean, boolean> = {\n mark: false,\n dimension: false,\n group: false\n };\n\n /* 显示常规tooltip */\n success.group = this._showTooltipByMouseEvent('group', mouseEventData, params, isClick);\n if (!success.group) {\n success.mark = this._showTooltipByMouseEvent('mark', mouseEventData, params, isClick);\n }\n if (!success.mark && !success.group) {\n success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick);\n }\n\n /* 如果不是常规情况,进行一些特殊情况tooltip处理 */\n if (Object.values(success).every(val => !val) && !isEmptyPos(params)) {\n // 用户手动配置ignore,则继续显示缓存tooltip\n if (ignoreMark && isMarkInfo(this._cacheInfo)) {\n success.mark = this._showTooltipByMouseEvent('mark', mouseEventData, params, isClick, true);\n } else if (ignoreDimension && isDimensionInfo(this._cacheInfo)) {\n success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick, true);\n } else if (isValid(dimensionInfo)) {\n // 用户没有手动配置ignore的话,默认显示dimension tooltip\n success.dimension = this._showTooltipByMouseEvent('dimension', mouseEventData, params, isClick);\n }\n }\n\n /* 如果还是不应该显示tooltip,则隐藏上一次tooltip */\n if (!success.mark && !success.group && (!success.dimension || isNil(dimensionInfo))) {\n this._handleChartMouseOut(params);\n if (isClick && this._clickLock) {\n this._clickLock = false;\n }\n }\n };\n\n /**\n * 通过鼠标事件触发 tooltip,返回是否成功\n * @param activeType tooltip 类型\n * @param mouseEventData tooltip 相关数据\n * @param params 事件参数\n * @param useCache 是否直接显示缓存 tooltip\n * @returns 是否成功执行\n */\n protected _showTooltipByMouseEvent = (\n activeType: TooltipActiveType,\n mouseEventData: TotalMouseEventData,\n params: BaseEventParams,\n isClick: boolean,\n useCache?: boolean\n ): boolean => {\n const processor = this.processor[activeType];\n // 判断是否应该触发 tooltip\n if (\n !processor.shouldHandleTooltip(params, {\n tooltipInfo: mouseEventData.tooltipInfo[activeType],\n ignore: mouseEventData.ignore[activeType]\n })\n ) {\n return false;\n }\n if (this._timer) {\n clearTimeout(this._timer);\n }\n\n let success: boolean;\n if (useCache) {\n // 直接显示缓存 tooltip\n success = !processor.showTooltip(this._cacheInfo as any, params, true);\n } else {\n const tooltipInfo = mouseEventData.tooltipInfo[activeType];\n const isSameAsCache = this._isSameAsCache(tooltipInfo, params, activeType);\n success = !processor.showTooltip(tooltipInfo as any, params, isSameAsCache);\n if (success) {\n // 成功显示 tooltip,则更新缓存\n this._cacheInfo = tooltipInfo;\n this._cacheParams = params;\n this._cacheActiveType = activeType;\n }\n }\n if (success) {\n this._isTooltipShown = true;\n if (isClick && this._spec.lockAfterClick && !this._clickLock) {\n this._clickLock = true;\n } else if (Number.isFinite(this._spec.hideTimer)) {\n this._timer = setTimeout(() => {\n this._handleChartMouseOut();\n }, this._spec.hideTimer as number) as unknown as number;\n }\n }\n // 全局唯一 tooltip\n const vchart = this._option?.globalInstance;\n if (success && VChart.globalConfig.uniqueTooltip && vchart) {\n VChart.hideTooltip(vchart.id);\n }\n return success;\n };\n\n protected _getMouseEventData = (params: BaseEventParams): TotalMouseEventData => {\n const result: TotalMouseEventData = {\n tooltipInfo: {},\n ignore: {}\n };\n\n let activeType: TooltipActiveType = 'dimension';\n const { tooltipInfo, ignore } = this.processor[activeType].getMouseEventData(params);\n result.tooltipInfo[activeType] = tooltipInfo as any;\n result.ignore[activeType] = ignore;\n\n const dimensionInfo = tooltipInfo as DimensionTooltipInfo;\n\n for (activeType of Object.keys(this.processor) as any) {\n if (activeType !== 'dimension') {\n const { tooltipInfo, ignore } = this.processor[activeType].getMouseEventData(params, dimensionInfo);\n result.tooltipInfo[activeType] = tooltipInfo as any;\n result.ignore[activeType] = ignore;\n }\n }\n return result;\n };\n\n protected _hideTooltipByHandler = (params: TooltipHandlerParams): TooltipResult => {\n if (!this._isTooltipShown && !this.tooltipHandler?.isTooltipShown?.()) {\n // 如果当前 tooltip 未显示,则提前退出\n return TooltipResult.success;\n }\n\n // 触发事件\n this.event.emit(ChartEvent.tooltipHide, {\n ...params,\n source: Event_Source_Type.chart, // 统一 event 的来源\n tooltip: this\n });\n\n // 删除缓存\n Object.values(this.processor).forEach((processor: BaseTooltipProcessor) => {\n processor.clearCache();\n });\n\n // 隐藏 tooltip\n let hideTooltip;\n if (this._spec.handler?.hideTooltip) {\n hideTooltip = this._spec.handler.hideTooltip.bind(this._spec.handler);\n } else if (this.tooltipHandler?.hideTooltip) {\n hideTooltip = this.tooltipHandler.hideTooltip.bind(this.tooltipHandler);\n }\n if (hideTooltip) {\n const result = hideTooltip(params);\n if (!result) {\n this._isTooltipShown = false;\n }\n return result;\n }\n return TooltipResult.failed;\n };\n\n reInit(spec?: any) {\n super.reInit(spec);\n\n if (this.tooltipHandler) {\n this.tooltipHandler.reInit?.();\n } else {\n this._initHandler();\n }\n }\n\n showTooltip(datum: Datum, options: IShowTooltipOption) {\n if (!this.tooltipHandler) {\n this._initHandler();\n }\n\n if (!this.processor) {\n this._initProcessor();\n }\n\n if (!this.tooltipHandler?.showTooltip) {\n return false;\n }\n const result = showTooltip(datum, options, this);\n if (result !== 'none') {\n this._alwaysShow = !!options?.alwaysShow;\n }\n return result;\n }\n\n /** 手动隐藏 tooltip,返回是否成功 */\n hideTooltip(): boolean {\n const params: TooltipHandlerParams = {\n changePositionOnly: false,\n tooltip: this,\n item: undefined,\n datum: undefined,\n source: Event_Source_Type.chart\n } as any;\n\n this._alwaysShow = false;\n return !this._hideTooltipByHandler(params);\n }\n\n private _isSameAsCache(\n nextInfo?: TooltipInfo,\n nextParams?: BaseEventParams,\n nextActiveType?: TooltipActiveType\n ): boolean {\n if (nextActiveType !== this._cacheActiveType) {\n return false;\n }\n if (nextInfo === this._cacheInfo) {\n return true;\n }\n if (isNil(this._cacheInfo) || isNil(nextInfo)) {\n return false;\n }\n\n // 判断 tooltip 信息是否一致\n if (isDimensionInfo(nextInfo)) {\n if (isMarkInfo(this._cacheInfo)) {\n return false;\n }\n\n const prevInfo = this._cacheInfo as DimensionTooltipInfo;\n const isSameAsCacheInfo =\n prevInfo.length === nextInfo.length && nextInfo.every((info, i) => isSameDimensionInfo(info, prevInfo[i]));\n if (!isSameAsCacheInfo) {\n return false;\n }\n } else {\n if (isDimensionInfo(this._cacheInfo)) {\n return false;\n }\n\n const prevInfo = this._cacheInfo as MarkTooltipInfo;\n const isSameAsCacheInfo =\n nextInfo?.datum === prevInfo.datum && nextInfo?.mark === prevInfo.mark && nextInfo?.series === prevInfo.series;\n if (!isSameAsCacheInfo) {\n return false;\n }\n }\n\n // 判断事件触发信息是否一致\n const prevParams = this._cacheParams;\n if (isNil(prevParams) || isNil(nextParams)) {\n return false;\n }\n return (\n prevParams.mark === nextParams.mark &&\n prevParams.model === nextParams.model &&\n prevParams.datum === nextParams.datum\n );\n }\n\n private _isPointerInChart(point: IPoint): boolean {\n const globalInstance = this._option?.globalInstance;\n if (!globalInstance) {\n return false;\n }\n const chart = globalInstance.getChart();\n if (!chart) {\n return false;\n }\n const { x, y } = point;\n const canvas = globalInstance.getCanvas();\n const { x: chartX, y: chartY, width: chartWidth, height: chartHeight } = canvas.getBoundingClientRect();\n // 鼠标仍在图表范围内,则不处理\n if (x >= chartX && x <= chartX + chartWidth && y >= chartY && y <= chartY + chartHeight) {\n return true;\n }\n\n return false;\n }\n\n private _isPointerOnTooltip(params: BaseEventParams): boolean {\n // TODO:后续支持 renderMode === 'canvas' 场景\n if (this._spec.enterable && this._spec.renderMode === 'html') {\n const { event } = params;\n let newTarget: any;\n if (isValid(event.nativeEvent)) {\n // get native event object\n const nativeEvent = event.nativeEvent as any;\n newTarget = nativeEvent.relatedTarget;\n // if in shadow DOM use composedPath to access target\n // FIXME: shadow DOM 的 relatedTarget 的属性是?\n if (nativeEvent.composedPath && nativeEvent.composedPath().length > 0) {\n newTarget = nativeEvent.composedPath()[0];\n }\n } else {\n newTarget = event.relatedTarget;\n }\n const container = this.tooltipHandler?.getTooltipContainer?.();\n if (isValid(container) && isValid(newTarget) && hasParentElement(newTarget, container)) {\n return true;\n }\n }\n return false;\n }\n\n getVisible() {\n return this._spec.visible !== false;\n }\n}\n\nexport const registerTooltip = () => {\n Factory.registerComponent(Tooltip.type, Tooltip);\n};\n"]}
|
package/esm/component/util.js
CHANGED
package/esm/core/index.d.ts
CHANGED
|
@@ -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 = "1.11.
|
|
4
|
+
export declare const version = "1.11.8";
|
|
5
5
|
export type { IVChart } from './interface';
|
|
6
6
|
export type { IStateSpec, StateValueType } from '../compile/mark';
|
|
7
7
|
export * from '../typings/spec/common';
|
package/esm/core/index.js
CHANGED
package/esm/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAG3B,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAMhC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAK5B,cAAc,uBAAuB,CAAC;AAGtC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,cAAc,WAAW,CAAC","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 = \"1.11.
|
|
1
|
+
{"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAG3B,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAMhC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAK5B,cAAc,uBAAuB,CAAC;AAGtC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,cAAc,WAAW,CAAC","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 = \"1.11.8\";\n\n// export necessary types\nexport type { IVChart } from './interface';\nexport type { IStateSpec, StateValueType } from '../compile/mark';\n\nexport * from '../typings/spec/common';\nexport * from '../event/interface';\nexport * from '../theme/interface';\nexport * from '../constant';\nexport * from './interface';\n\n/**\n * spec\n */\nexport * from '../typings/spec/index';\n\n// tooltip\nexport * from '../typings/tooltip';\n\n// theme\nexport * from '../theme/index';\n\n// vrender\nexport { vglobal } from '@visactor/vrender-core';\n\n// plugin\nexport * from '../plugin';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vchart",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.8",
|
|
4
4
|
"description": "charts lib based @visactor/VGrammar",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -82,26 +82,26 @@
|
|
|
82
82
|
"rimraf": "3.0.2",
|
|
83
83
|
"cross-env": "^7.0.3",
|
|
84
84
|
"@internal/typescript-json-schema": "0.0.1",
|
|
85
|
+
"@internal/bundler": "0.0.1",
|
|
85
86
|
"@internal/eslint-config": "0.0.1",
|
|
86
|
-
"@internal/ts-config": "0.0.1"
|
|
87
|
-
"@internal/bundler": "0.0.1"
|
|
87
|
+
"@internal/ts-config": "0.0.1"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@visactor/vutils": "~0.18.10",
|
|
91
91
|
"@visactor/vdataset": "~0.18.10",
|
|
92
92
|
"@visactor/vscale": "~0.18.10",
|
|
93
|
-
"@visactor/vrender-core": "0.19.
|
|
94
|
-
"@visactor/vrender-kits": "0.19.
|
|
95
|
-
"@visactor/vrender-components": "0.19.
|
|
96
|
-
"@visactor/vgrammar-core": "0.13.
|
|
97
|
-
"@visactor/vgrammar-projection": "0.13.
|
|
98
|
-
"@visactor/vgrammar-wordcloud": "0.13.
|
|
99
|
-
"@visactor/vgrammar-wordcloud-shape": "0.13.
|
|
100
|
-
"@visactor/vgrammar-hierarchy": "0.13.
|
|
101
|
-
"@visactor/vgrammar-sankey": "0.13.
|
|
102
|
-
"@visactor/vgrammar-venn": "0.13.
|
|
103
|
-
"@visactor/vgrammar-util": "0.13.
|
|
104
|
-
"@visactor/vutils-extension": "1.11.
|
|
93
|
+
"@visactor/vrender-core": "0.19.17",
|
|
94
|
+
"@visactor/vrender-kits": "0.19.17",
|
|
95
|
+
"@visactor/vrender-components": "0.19.17",
|
|
96
|
+
"@visactor/vgrammar-core": "0.13.14",
|
|
97
|
+
"@visactor/vgrammar-projection": "0.13.14",
|
|
98
|
+
"@visactor/vgrammar-wordcloud": "0.13.14",
|
|
99
|
+
"@visactor/vgrammar-wordcloud-shape": "0.13.14",
|
|
100
|
+
"@visactor/vgrammar-hierarchy": "0.13.14",
|
|
101
|
+
"@visactor/vgrammar-sankey": "0.13.14",
|
|
102
|
+
"@visactor/vgrammar-venn": "0.13.14",
|
|
103
|
+
"@visactor/vgrammar-util": "0.13.14",
|
|
104
|
+
"@visactor/vutils-extension": "1.11.8"
|
|
105
105
|
},
|
|
106
106
|
"publishConfig": {
|
|
107
107
|
"access": "public",
|