From 155653f4f12d14603d6d8d437e3dc999ce5817e7 Mon Sep 17 00:00:00 2001 From: plainheart Date: Sat, 23 Nov 2024 09:31:30 +0800 Subject: [PATCH] feat(axis): change `isEllipsised` to `isTruncated` and add `value` callback parameter --- package-lock.json | 11 +++++------ package.json | 2 +- src/component/axis/AxisBuilder.ts | 3 ++- test/axisLabel.html | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 29fb8e4f03d..08cb6fc5617 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "dependencies": { "tslib": "^2.3.0", - "zrender": "5.6.0" + "zrender": "github:ecomfe/zrender" }, "devDependencies": { "@babel/code-frame": "7.10.4", @@ -11298,8 +11298,8 @@ }, "node_modules/zrender": { "version": "5.6.0", - "resolved": "https://registry.npmjs.org/zrender/-/zrender-5.6.0.tgz", - "integrity": "sha512-uzgraf4njmmHAbEUxMJ8Oxg+P3fT04O+9p7gY+wJRVxo8Ge+KmYv0WJev945EH4wFuc4OY2NLXz46FZrWS9xJg==", + "resolved": "git+ssh://git@github.com/ecomfe/zrender.git#980b0ea43e68da10f82aa9a18449357e8c40bba0", + "license": "BSD-3-Clause", "dependencies": { "tslib": "2.3.0" } @@ -20322,9 +20322,8 @@ } }, "zrender": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/zrender/-/zrender-5.6.0.tgz", - "integrity": "sha512-uzgraf4njmmHAbEUxMJ8Oxg+P3fT04O+9p7gY+wJRVxo8Ge+KmYv0WJev945EH4wFuc4OY2NLXz46FZrWS9xJg==", + "version": "git+ssh://git@github.com/ecomfe/zrender.git#980b0ea43e68da10f82aa9a18449357e8c40bba0", + "from": "zrender@github:ecomfe/zrender", "requires": { "tslib": "2.3.0" } diff --git a/package.json b/package.json index a7d7586da65..fe472738b0e 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ }, "dependencies": { "tslib": "^2.3.0", - "zrender": "5.6.0" + "zrender": "github:ecomfe/zrender" }, "devDependencies": { "@babel/code-frame": "7.10.4", diff --git a/src/component/axis/AxisBuilder.ts b/src/component/axis/AxisBuilder.ts index 996333f2a78..b139a27fdbf 100644 --- a/src/component/axis/AxisBuilder.ts +++ b/src/component/axis/AxisBuilder.ts @@ -842,7 +842,8 @@ function buildAxisLabel( componentModel: axisModel, itemName: formattedLabel, formatterParamsExtra: { - isEllipsised: () => formattedLabel !== (textEl.childrenRef()[0] as TSpan).style.text, + isTruncated: () => textEl.isTruncated, + value: rawLabel, tickIndex: index } }); diff --git a/test/axisLabel.html b/test/axisLabel.html index 590ec7939c1..572abcffcc2 100644 --- a/test/axisLabel.html +++ b/test/axisLabel.html @@ -397,7 +397,7 @@ position: 'top', trigger: 'item', formatter(p) { - if (p.isEllipsised()) { + if (p.isTruncated()) { return p.name; } if (p.tickIndex > 3) {