diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index c1f5725dd2..e06d3bea00 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -22,8 +22,8 @@ importers: '@visactor/vchart-extension': workspace:2.0.10 '@visactor/vchart-theme': ~1.6.6 '@visactor/vmind': 1.2.4-alpha.5 - '@visactor/vrender': ~1.0.30 - '@visactor/vrender-kits': ~1.0.30 + '@visactor/vrender': ~1.0.31 + '@visactor/vrender-kits': ~1.0.31 '@visactor/vtable': 1.19.0-alpha.0 '@visactor/vtable-calendar': 1.19.0-alpha.0 '@visactor/vtable-editors': 1.19.0-alpha.0 @@ -59,8 +59,8 @@ importers: '@visactor/vchart-extension': link:../packages/vchart-extension '@visactor/vchart-theme': 1.6.9 '@visactor/vmind': 1.2.4-alpha.5 - '@visactor/vrender': 1.0.30 - '@visactor/vrender-kits': 1.0.30 + '@visactor/vrender': 1.0.31 + '@visactor/vrender-kits': 1.0.31 '@visactor/vtable': 1.19.0-alpha.0 '@visactor/vtable-calendar': 1.19.0-alpha.0 '@visactor/vtable-editors': 1.19.0-alpha.0 @@ -144,8 +144,8 @@ importers: '@types/offscreencanvas': 2019.6.4 '@types/react-is': ^17.0.3 '@visactor/vchart': workspace:2.0.10 - '@visactor/vrender-core': ~1.0.30 - '@visactor/vrender-kits': ~1.0.30 + '@visactor/vrender-core': ~1.0.31 + '@visactor/vrender-kits': ~1.0.31 '@visactor/vutils': ~1.0.12 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 @@ -164,8 +164,8 @@ importers: vite: 3.2.6 dependencies: '@visactor/vchart': link:../vchart - '@visactor/vrender-core': 1.0.30 - '@visactor/vrender-kits': 1.0.30 + '@visactor/vrender-core': 1.0.31 + '@visactor/vrender-kits': 1.0.31 '@visactor/vutils': 1.0.12 react-is: 18.3.1 devDependencies: @@ -208,8 +208,8 @@ importers: '@types/react-is': ^17.0.3 '@visactor/vchart': workspace:2.0.10 '@visactor/vchart-extension': workspace:2.0.10 - '@visactor/vrender-core': ~1.0.30 - '@visactor/vrender-kits': ~1.0.30 + '@visactor/vrender-core': ~1.0.31 + '@visactor/vrender-kits': ~1.0.31 '@visactor/vutils': ~1.0.12 '@vitejs/plugin-react': 3.1.0 eslint: ~8.18.0 @@ -230,8 +230,8 @@ importers: dependencies: '@visactor/vchart': link:../vchart '@visactor/vchart-extension': link:../vchart-extension - '@visactor/vrender-core': 1.0.30 - '@visactor/vrender-kits': 1.0.30 + '@visactor/vrender-core': 1.0.31 + '@visactor/vrender-kits': 1.0.31 '@visactor/vutils': 1.0.12 react-is: 18.3.1 devDependencies: @@ -371,10 +371,10 @@ importers: '@types/offscreencanvas': 2019.6.4 '@visactor/vdataset': ~1.0.12 '@visactor/vlayouts': ~1.0.12 - '@visactor/vrender-animate': ~1.0.30 - '@visactor/vrender-components': ~1.0.30 - '@visactor/vrender-core': ~1.0.30 - '@visactor/vrender-kits': ~1.0.30 + '@visactor/vrender-animate': ~1.0.31 + '@visactor/vrender-components': ~1.0.31 + '@visactor/vrender-core': ~1.0.31 + '@visactor/vrender-kits': ~1.0.31 '@visactor/vscale': ~1.0.12 '@visactor/vutils': ~1.0.12 '@visactor/vutils-extension': workspace:2.0.10 @@ -413,10 +413,10 @@ importers: dependencies: '@visactor/vdataset': 1.0.12 '@visactor/vlayouts': 1.0.12 - '@visactor/vrender-animate': 1.0.30 - '@visactor/vrender-components': 1.0.30 - '@visactor/vrender-core': 1.0.30 - '@visactor/vrender-kits': 1.0.30 + '@visactor/vrender-animate': 1.0.31 + '@visactor/vrender-components': 1.0.31 + '@visactor/vrender-core': 1.0.31 + '@visactor/vrender-kits': 1.0.31 '@visactor/vscale': 1.0.12 '@visactor/vutils': 1.0.12 '@visactor/vutils-extension': link:../vutils-extension @@ -478,10 +478,10 @@ importers: '@visactor/vchart': workspace:2.0.10 '@visactor/vdataset': ~1.0.12 '@visactor/vlayouts': ~1.0.12 - '@visactor/vrender-animate': ~1.0.30 - '@visactor/vrender-components': ~1.0.30 - '@visactor/vrender-core': ~1.0.30 - '@visactor/vrender-kits': ~1.0.30 + '@visactor/vrender-animate': ~1.0.31 + '@visactor/vrender-components': ~1.0.31 + '@visactor/vrender-core': ~1.0.31 + '@visactor/vrender-kits': ~1.0.31 '@visactor/vutils': ~1.0.12 '@vitejs/plugin-react': 3.1.0 canvas: 2.11.2 @@ -503,10 +503,10 @@ importers: '@visactor/vchart': link:../vchart '@visactor/vdataset': 1.0.12 '@visactor/vlayouts': 1.0.12 - '@visactor/vrender-animate': 1.0.30 - '@visactor/vrender-components': 1.0.30 - '@visactor/vrender-core': 1.0.30 - '@visactor/vrender-kits': 1.0.30 + '@visactor/vrender-animate': 1.0.31 + '@visactor/vrender-components': 1.0.31 + '@visactor/vrender-core': 1.0.31 + '@visactor/vrender-kits': 1.0.31 '@visactor/vutils': 1.0.12 devDependencies: '@internal/bundler': link:../../tools/bundler @@ -878,9 +878,9 @@ importers: '@typescript-eslint/eslint-plugin': 5.30.0 '@typescript-eslint/parser': 5.30.0 '@visactor/vchart': workspace:2.0.10 - '@visactor/vrender': ~1.0.30 - '@visactor/vrender-core': ~1.0.30 - '@visactor/vrender-kits': ~1.0.30 + '@visactor/vrender': ~1.0.31 + '@visactor/vrender-core': ~1.0.31 + '@visactor/vrender-kits': ~1.0.31 '@visactor/vutils': ~1.0.12 cross-env: ^7.0.3 eslint: ~8.18.0 @@ -893,9 +893,9 @@ importers: vite: 3.2.6 dependencies: '@visactor/vchart': link:../../packages/vchart - '@visactor/vrender': 1.0.30 - '@visactor/vrender-core': 1.0.30 - '@visactor/vrender-kits': 1.0.30 + '@visactor/vrender': 1.0.31 + '@visactor/vrender-core': 1.0.31 + '@visactor/vrender-kits': 1.0.31 '@visactor/vutils': 1.0.12 devDependencies: '@internal/bundler': link:../bundler @@ -4884,10 +4884,10 @@ packages: '@visactor/vutils': 1.0.4 dev: false - /@visactor/vrender-animate/1.0.30: - resolution: {integrity: sha512-LgAJqvsJNtCGbxn8W9/68BG0McPz7rcO2lYuz0A+aJU72kyju5MIz+T7aegR/MajHXuHc9o3tayjjQ78qMicfA==} + /@visactor/vrender-animate/1.0.31: + resolution: {integrity: sha512-9xA9B8JihlsEfBziFUHdUGUizh6xRk07lejUk4f0+qGmGwMPvz32btszs2gw1eF9J6FVmBhxJdZILzcXz4ha0Q==} dependencies: - '@visactor/vrender-core': 1.0.30 + '@visactor/vrender-core': 1.0.31 '@visactor/vutils': 1.0.12 dev: false @@ -4901,12 +4901,12 @@ packages: '@visactor/vutils': 1.0.4 dev: false - /@visactor/vrender-components/1.0.30: - resolution: {integrity: sha512-7CMb2J3euo6dS8o1CKILQls4mZ18hkcn4CzL7QJKt3LY/l2Y+ERZsjMnx1HBeoTVE+5tav6Ua2qq3/bQvQh6MA==} + /@visactor/vrender-components/1.0.31: + resolution: {integrity: sha512-kB+ZdqCnfcmoLHleGPml/NmqgXViC0Vqk/64XzQzXd5fvFqCrgS1G6mpq+VrZjZhJx3gxCTQoct6q2qXN1aYIw==} dependencies: - '@visactor/vrender-animate': 1.0.30 - '@visactor/vrender-core': 1.0.30 - '@visactor/vrender-kits': 1.0.30 + '@visactor/vrender-animate': 1.0.31 + '@visactor/vrender-core': 1.0.31 + '@visactor/vrender-kits': 1.0.31 '@visactor/vscale': 1.0.12 '@visactor/vutils': 1.0.12 dev: false @@ -4918,8 +4918,8 @@ packages: color-convert: 2.0.1 dev: false - /@visactor/vrender-core/1.0.30: - resolution: {integrity: sha512-SBKoul3PLOGKMow9yfEgZmKwXV5xc0jZV8drD21z1/g2QlWGstc4iQC3sARXyenhe8HJEPC9kQdYdo/AzZty6A==} + /@visactor/vrender-core/1.0.31: + resolution: {integrity: sha512-4tzN2M5GfI7612IHRiDqUetAjd3J3Ns5gHQxQvmMxismdw7UTrlB8PgnWx9djTYwoxZnhNX0MpPGz9CKgbb7RA==} dependencies: '@visactor/vutils': 1.0.12 color-convert: 2.0.1 @@ -4936,24 +4936,24 @@ packages: roughjs: 4.5.2 dev: false - /@visactor/vrender-kits/1.0.30: - resolution: {integrity: sha512-J6sPXNTu0X0eeIqOdNZrJFQukjrJQQuzblLS/p/kVTFf0UF5nF5rR/wA7NeK1gqMmeX1nQlllPM+doGfc7s4Fw==} + /@visactor/vrender-kits/1.0.31: + resolution: {integrity: sha512-ZS1vslveNfK6MrkL0tMIzQWT9G/q+P7201nNA55YM89N1Tzpzm0X55YHQiIx9TnWTWQijMlqkz1PR5n3Xh+Hjg==} dependencies: '@resvg/resvg-js': 2.4.1 - '@visactor/vrender-core': 1.0.30 + '@visactor/vrender-core': 1.0.31 '@visactor/vutils': 1.0.12 gifuct-js: 2.1.2 lottie-web: 5.13.0 roughjs: 4.6.6 dev: false - /@visactor/vrender/1.0.30: - resolution: {integrity: sha512-Qs1Ozt/cjLHe4YrvTRHs1wpAl4DP5Am2qK84It4qrVUpTxUsVofcZPFVJNey8NVZIlhiBYGeJOl0mAn3W2D5Kw==} + /@visactor/vrender/1.0.31: + resolution: {integrity: sha512-hbwP8inulxlta5XeBTiSVe3MtNeXCVqXsjF+4H2h94r+PGHWa48HG8kDJqZtFgN+p82bSnXaRbSjcQIigWwMiw==} dependencies: - '@visactor/vrender-animate': 1.0.30 - '@visactor/vrender-components': 1.0.30 - '@visactor/vrender-core': 1.0.30 - '@visactor/vrender-kits': 1.0.30 + '@visactor/vrender-animate': 1.0.31 + '@visactor/vrender-components': 1.0.31 + '@visactor/vrender-core': 1.0.31 + '@visactor/vrender-kits': 1.0.31 dev: false /@visactor/vscale/0.18.18: diff --git a/docs/package.json b/docs/package.json index a3e48e4d9a..46dcc132f3 100644 --- a/docs/package.json +++ b/docs/package.json @@ -19,8 +19,8 @@ "@visactor/vchart-theme": "~1.6.6", "@visactor/vmind": "1.2.4-alpha.5", "@visactor/vutils": "~1.0.12", - "@visactor/vrender": "~1.0.30", - "@visactor/vrender-kits": "~1.0.30", + "@visactor/vrender": "~1.0.31", + "@visactor/vrender-kits": "~1.0.31", "@visactor/vtable": "1.19.0-alpha.0", "@visactor/vtable-editors": "1.19.0-alpha.0", "@visactor/vtable-gantt": "1.19.0-alpha.0", @@ -58,4 +58,4 @@ "react-device-detect": "^2.2.2", "minimist": "1.2.8" } -} +} \ No newline at end of file diff --git a/packages/openinula-vchart/package.json b/packages/openinula-vchart/package.json index e180be490e..d702dff2b8 100644 --- a/packages/openinula-vchart/package.json +++ b/packages/openinula-vchart/package.json @@ -30,8 +30,8 @@ "dependencies": { "@visactor/vchart": "workspace:2.0.10", "@visactor/vutils": "~1.0.12", - "@visactor/vrender-core": "~1.0.30", - "@visactor/vrender-kits": "~1.0.30", + "@visactor/vrender-core": "~1.0.31", + "@visactor/vrender-kits": "~1.0.31", "react-is": "^18.2.0" }, "devDependencies": { @@ -78,4 +78,4 @@ "access": "public", "registry": "https://registry.npmjs.org/" } -} +} \ No newline at end of file diff --git a/packages/react-vchart/package.json b/packages/react-vchart/package.json index 02655c229b..ea9add8387 100644 --- a/packages/react-vchart/package.json +++ b/packages/react-vchart/package.json @@ -31,8 +31,8 @@ "@visactor/vchart": "workspace:2.0.10", "@visactor/vchart-extension": "workspace:2.0.10", "@visactor/vutils": "~1.0.12", - "@visactor/vrender-core": "~1.0.30", - "@visactor/vrender-kits": "~1.0.30", + "@visactor/vrender-core": "~1.0.31", + "@visactor/vrender-kits": "~1.0.31", "react-is": "^18.2.0" }, "devDependencies": { @@ -83,4 +83,4 @@ "access": "public", "registry": "https://registry.npmjs.org/" } -} +} \ No newline at end of file diff --git a/packages/vchart-extension/package.json b/packages/vchart-extension/package.json index 3c95c2a13d..79d94d810f 100644 --- a/packages/vchart-extension/package.json +++ b/packages/vchart-extension/package.json @@ -21,10 +21,10 @@ "start": "ts-node __tests__/runtime/browser/scripts/initVite.ts && vite serve __tests__/runtime/browser" }, "dependencies": { - "@visactor/vrender-core": "~1.0.30", - "@visactor/vrender-kits": "~1.0.30", - "@visactor/vrender-components": "~1.0.30", - "@visactor/vrender-animate": "~1.0.30", + "@visactor/vrender-core": "~1.0.31", + "@visactor/vrender-kits": "~1.0.31", + "@visactor/vrender-components": "~1.0.31", + "@visactor/vrender-animate": "~1.0.31", "@visactor/vchart": "workspace:2.0.10", "@visactor/vutils": "~1.0.12", "@visactor/vdataset": "~1.0.12", @@ -61,4 +61,4 @@ "registry": "https://registry.npmjs.org/" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/vchart/CHANGELOG.json b/packages/vchart/CHANGELOG.json index 2e51e0028c..41765c66f1 100644 --- a/packages/vchart/CHANGELOG.json +++ b/packages/vchart/CHANGELOG.json @@ -11,7 +11,7 @@ "comment": "feat: add `outlier` to boxplot, close #4301\n\n" }, { - "comment": "feat: upgrade vrender to 1.0.30\n\n" + "comment": "feat: upgrade vrender to 1.0.31\n\n" }, { "comment": "fix: extensionMark can remove animation\n\n" @@ -4134,4 +4134,4 @@ } } ] -} +} \ No newline at end of file diff --git a/packages/vchart/package.json b/packages/vchart/package.json index d0073f797e..8e21b16155 100644 --- a/packages/vchart/package.json +++ b/packages/vchart/package.json @@ -122,14 +122,14 @@ "@visactor/vdataset": "~1.0.12", "@visactor/vscale": "~1.0.12", "@visactor/vlayouts": "~1.0.12", - "@visactor/vrender-core": "~1.0.30", - "@visactor/vrender-kits": "~1.0.30", - "@visactor/vrender-components": "~1.0.30", - "@visactor/vrender-animate": "~1.0.30", + "@visactor/vrender-core": "~1.0.31", + "@visactor/vrender-kits": "~1.0.31", + "@visactor/vrender-components": "~1.0.31", + "@visactor/vrender-animate": "~1.0.31", "@visactor/vutils-extension": "workspace:2.0.10" }, "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" } -} +} \ No newline at end of file diff --git a/packages/vchart/src/component/crosshair/base.ts b/packages/vchart/src/component/crosshair/base.ts index 4f3b91dbd4..004cfb4cce 100644 --- a/packages/vchart/src/component/crosshair/base.ts +++ b/packages/vchart/src/component/crosshair/base.ts @@ -247,8 +247,7 @@ export abstract class BaseCrossHair implements ITooltip { }; protected _handleChartMouseOut = (params?: BaseEventParams) => { + if ( + this._cacheActiveType && + this._option?.componentShowContent && + (this._option.componentShowContent.tooltip === false || + (isObject(this._option.componentShowContent.tooltip) && + this._option.componentShowContent.tooltip[this._cacheActiveType] === false)) + ) { + return; + } if (this._alwaysShow || this._isReleased || this._isEnterTooltip) { return; } @@ -436,7 +445,11 @@ export class Tooltip extends BaseComponent implements ITooltip { } = mouseEventData; /** tooltip 是否显示成功 */ - const success: ITooltipActiveTypeAsKeys = { + const success: ITooltipActiveTypeAsKeys< + boolean | 'unShowByOption', + boolean | 'unShowByOption', + boolean | 'unShowByOption' + > = { mark: false, dimension: false, group: false @@ -448,7 +461,9 @@ export class Tooltip extends BaseComponent implements ITooltip { const type = supportedTooltip[i]; const res = this.processor[type] ? this._showTooltipByMouseEvent(type, mouseEventData, params, isClick) : false; - if (res) { + if (res === 'unShowByOption') { + success[type] = 'unShowByOption'; + } else if (res) { success[type] = true; break; } @@ -466,13 +481,34 @@ export class Tooltip extends BaseComponent implements ITooltip { } /* 如果还是不应该显示tooltip,则隐藏上一次tooltip */ - if (!success.mark && !success.group && (!success.dimension || isNil(dimensionInfo))) { - this._handleChartMouseOut(params); + if (success.mark !== true && success.group !== true && (success.dimension !== true || isNil(dimensionInfo))) { + // 如果 tooltip 类型都不是 'unShowByOption',则隐藏上一次 tooltip + // 否则,不隐藏上一次 tooltip ,tooltip 不展示属于 'unShowByOption' 类型的情况 + if (!this._cacheActiveType || success[this._cacheActiveType as TooltipActiveType] !== 'unShowByOption') { + this._handleChartMouseOut(params); + } } else { this._initEventOfTooltipContent(); } }; + protected _showContentByEvent(activeType: TooltipActiveType) { + if (this._option?.componentShowContent) { + // 全局关闭 tooltip + if (this._option.componentShowContent.tooltip === false) { + return false; + } + // 单独关闭 tooltip + if ( + isObject(this._option.componentShowContent.tooltip) && + this._option.componentShowContent.tooltip[activeType] === false + ) { + return false; + } + } + return true; + } + /** * 通过鼠标事件触发 tooltip,返回是否成功 * @param activeType tooltip 类型 @@ -487,19 +523,9 @@ export class Tooltip extends BaseComponent implements ITooltip { params: BaseEventParams, isClick: boolean, useCache?: boolean - ): boolean => { - if (this._option?.componentShowContent) { - // 全局关闭 tooltip - if (this._option.componentShowContent.tooltip === false) { - return false; - } - // 单独关闭 tooltip - if ( - isObject(this._option.componentShowContent.tooltip) && - this._option.componentShowContent.tooltip[activeType] === false - ) { - return false; - } + ): boolean | 'unShowByOption' => { + if (!this._showContentByEvent(activeType)) { + return 'unShowByOption'; } const processor = this.processor[activeType]; @@ -582,7 +608,6 @@ export class Tooltip extends BaseComponent implements ITooltip { // 隐藏 tooltip const handler = this._spec.handler ?? this.tooltipHandler; - if (handler.hideTooltip) { const result = handler.hideTooltip.call(handler, params); if (!result) { @@ -627,6 +652,7 @@ export class Tooltip extends BaseComponent implements ITooltip { const result = showTooltip(datum, options, this); if (result !== 'none') { this._alwaysShow = !!options?.alwaysShow; + this._cacheActiveType = result; } return result; } diff --git a/tools/story-player/package.json b/tools/story-player/package.json index 11a7b8916a..3a66cf1dcc 100644 --- a/tools/story-player/package.json +++ b/tools/story-player/package.json @@ -56,10 +56,10 @@ "vite": "3.2.6" }, "dependencies": { - "@visactor/vrender-core": "~1.0.30", - "@visactor/vrender-kits": "~1.0.30", + "@visactor/vrender-core": "~1.0.31", + "@visactor/vrender-kits": "~1.0.31", "@visactor/vchart": "workspace:2.0.10", - "@visactor/vrender": "~1.0.30", + "@visactor/vrender": "~1.0.31", "@visactor/vutils": "~1.0.12" } -} +} \ No newline at end of file