Skip to content

Commit

Permalink
Merge pull request #1697 from VisActor/release/0.21.12
Browse files Browse the repository at this point in the history
[Auto release] release 0.21.12
  • Loading branch information
neuqzxy authored Feb 5, 2025
2 parents ef2e8ba + 6a1d10f commit 461fedb
Show file tree
Hide file tree
Showing 32 changed files with 287 additions and 87 deletions.
26 changes: 13 additions & 13 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/config/rush/version-policies.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"definitionName":"lockStepVersion","policyName":"vrenderMain","version":"0.21.11","nextBump":"patch"}]
[{"definitionName":"lockStepVersion","policyName":"vrenderMain","version":"0.21.12","nextBump":"patch"}]
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@visactor/vchart": "1.3.0",
"@visactor/vutils": "~0.19.3",
"@visactor/vgrammar": "~0.5.7",
"@visactor/vrender": "workspace:0.21.11",
"@visactor/vrender": "workspace:0.21.12",
"markdown-it": "^13.0.0",
"highlight.js": "^11.8.0",
"axios": "^1.4.0",
Expand Down
6 changes: 6 additions & 0 deletions packages/react-vrender-utils/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@visactor/react-vrender-utils",
"entries": [
{
"version": "0.21.12",
"tag": "@visactor/react-vrender-utils_v0.21.12",
"date": "Wed, 05 Feb 2025 07:04:09 GMT",
"comments": {}
},
{
"version": "0.21.11",
"tag": "@visactor/react-vrender-utils_v0.21.11",
Expand Down
7 changes: 6 additions & 1 deletion packages/react-vrender-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log - @visactor/react-vrender-utils

This log was last generated on Wed, 15 Jan 2025 12:13:28 GMT and should not be manually modified.
This log was last generated on Wed, 05 Feb 2025 07:04:09 GMT and should not be manually modified.

## 0.21.12
Wed, 05 Feb 2025 07:04:09 GMT

_Version update only_

## 0.21.11
Wed, 15 Jan 2025 12:13:28 GMT
Expand Down
6 changes: 3 additions & 3 deletions packages/react-vrender-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/react-vrender-utils",
"version": "0.21.11",
"version": "0.21.12",
"description": "",
"sideEffects": false,
"main": "cjs/index.js",
Expand All @@ -24,8 +24,8 @@
"react-dom": "^18.2.0"
},
"dependencies": {
"@visactor/vrender": "workspace:0.21.11",
"@visactor/react-vrender": "workspace:0.21.11",
"@visactor/vrender": "workspace:0.21.12",
"@visactor/react-vrender": "workspace:0.21.12",
"@visactor/vutils": "~0.19.3",
"react-reconciler": "^0.29.0",
"tslib": "^2.3.1"
Expand Down
6 changes: 6 additions & 0 deletions packages/react-vrender/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@visactor/react-vrender",
"entries": [
{
"version": "0.21.12",
"tag": "@visactor/react-vrender_v0.21.12",
"date": "Wed, 05 Feb 2025 07:04:09 GMT",
"comments": {}
},
{
"version": "0.21.11",
"tag": "@visactor/react-vrender_v0.21.11",
Expand Down
7 changes: 6 additions & 1 deletion packages/react-vrender/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log - @visactor/react-vrender

This log was last generated on Wed, 15 Jan 2025 12:13:28 GMT and should not be manually modified.
This log was last generated on Wed, 05 Feb 2025 07:04:09 GMT and should not be manually modified.

## 0.21.12
Wed, 05 Feb 2025 07:04:09 GMT

_Version update only_

## 0.21.11
Wed, 15 Jan 2025 12:13:28 GMT
Expand Down
4 changes: 2 additions & 2 deletions packages/react-vrender/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/react-vrender",
"version": "0.21.11",
"version": "0.21.12",
"description": "",
"sideEffects": false,
"main": "cjs/index.js",
Expand All @@ -23,7 +23,7 @@
"react": "^18.2.0"
},
"dependencies": {
"@visactor/vrender": "workspace:0.21.11",
"@visactor/vrender": "workspace:0.21.12",
"@visactor/vutils": "~0.19.3",
"react-reconciler": "^0.29.0",
"tslib": "^2.3.1"
Expand Down
15 changes: 15 additions & 0 deletions packages/vrender-components/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
{
"name": "@visactor/vrender-components",
"entries": [
{
"version": "0.21.12",
"tag": "@visactor/vrender-components_v0.21.12",
"date": "Wed, 05 Feb 2025 07:04:09 GMT",
"comments": {
"none": [
{
"comment": "feat: add instance to the callback of label\n\n"
},
{
"comment": "fix: fix layout of title when not set height\n\n"
}
]
}
},
{
"version": "0.21.11",
"tag": "@visactor/vrender-components_v0.21.11",
Expand Down
14 changes: 13 additions & 1 deletion packages/vrender-components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# Change Log - @visactor/vrender-components

This log was last generated on Wed, 15 Jan 2025 12:13:28 GMT and should not be manually modified.
This log was last generated on Wed, 05 Feb 2025 07:04:09 GMT and should not be manually modified.

## 0.21.12
Wed, 05 Feb 2025 07:04:09 GMT

### Updates

- feat: add instance to the callback of label


- fix: fix layout of title when not set height



## 0.21.11
Wed, 15 Jan 2025 12:13:28 GMT
Expand Down
6 changes: 3 additions & 3 deletions packages/vrender-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vrender-components",
"version": "0.21.11",
"version": "0.21.12",
"description": "components library for dp visualization",
"sideEffects": false,
"main": "cjs/index.js",
Expand All @@ -27,8 +27,8 @@
"dependencies": {
"@visactor/vutils": "~0.19.3",
"@visactor/vscale": "~0.19.3",
"@visactor/vrender-core": "workspace:0.21.11",
"@visactor/vrender-kits": "workspace:0.21.11"
"@visactor/vrender-core": "workspace:0.21.12",
"@visactor/vrender-kits": "workspace:0.21.12"
},
"devDependencies": {
"@internal/bundler": "workspace:*",
Expand Down
9 changes: 6 additions & 3 deletions packages/vrender-components/src/label/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ export class LabelBase<T extends BaseLabelAttrs> extends AbstractComponent<T> {
data,
labels,
this.getRelatedGraphic.bind(this),
this._isCollectionBase ? (d: LabelItem) => this._idToPoint.get(d.id) : null
this._isCollectionBase ? (d: LabelItem) => this._idToPoint.get(d.id) : null,
this
);
} else {
// 根据关联图元和配置的position计算标签坐标
Expand All @@ -206,7 +207,8 @@ export class LabelBase<T extends BaseLabelAttrs> extends AbstractComponent<T> {
labels = customOverlapFunc(
labels as Text[],
this.getRelatedGraphic.bind(this),
this._isCollectionBase ? (d: LabelItem) => this._idToPoint.get(d.id) : null
this._isCollectionBase ? (d: LabelItem) => this._idToPoint.get(d.id) : null,
this
);
} else {
// 防重叠逻辑
Expand All @@ -219,7 +221,8 @@ export class LabelBase<T extends BaseLabelAttrs> extends AbstractComponent<T> {
this.attribute.onAfterOverlapping(
labels as Text[],
this.getRelatedGraphic.bind(this),
this._isCollectionBase ? (d: LabelItem) => this._idToPoint.get(d.id) : null
this._isCollectionBase ? (d: LabelItem) => this._idToPoint.get(d.id) : null,
this
);
}

Expand Down
9 changes: 6 additions & 3 deletions packages/vrender-components/src/label/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ export interface BaseLabelAttrs extends IGroupGraphicAttribute {
item: LabelItem[],
labels: (IText | IRichText)[],
getRelatedGraphic: (data: LabelItem) => IGraphic,
getRelatedPoint?: (data: LabelItem) => IPointLike
getRelatedPoint: ((data: LabelItem) => IPointLike) | null | undefined,
labelComponent: IGroup
) => (IText | IRichText)[];

/** 自定义标签躲避函数
Expand All @@ -138,7 +139,8 @@ export interface BaseLabelAttrs extends IGroupGraphicAttribute {
customOverlapFunc?: (
label: (IText | IRichText)[],
getRelatedGraphic: (data: LabelItem) => IGraphic,
getRelatedPoint?: (data: LabelItem) => IPointLike
getRelatedPoint: ((data: LabelItem) => IPointLike) | null | undefined,
labelComponent: IGroup
) => (IText | IRichText)[];
/**
* 防重叠计算完成后的回调函数
Expand All @@ -147,7 +149,8 @@ export interface BaseLabelAttrs extends IGroupGraphicAttribute {
onAfterOverlapping?: (
labels: (IText | IRichText)[],
getRelatedGraphic: (data: LabelItem) => IGraphic,
getRelatedPoint?: (data: LabelItem) => IPointLike
getRelatedPoint: ((data: LabelItem) => IPointLike) | null | undefined,
labelComponent: IGroup
) => void;
/**
* 关闭交互效果
Expand Down
66 changes: 35 additions & 31 deletions packages/vrender-components/src/title/title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type { TitleAttrs } from './type';
import type { ComponentOptions } from '../interface';
import { DEFAULT_HTML_TEXT_SPEC } from '../constant';
import { loadTitleComponent } from './register';
import { Text } from '@visactor/vrender-core';

loadTitleComponent();
export class Title extends AbstractComponent<Required<TitleAttrs>> {
Expand Down Expand Up @@ -259,18 +260,20 @@ export class Title extends AbstractComponent<Required<TitleAttrs>> {
}
}

if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {
const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign;
if (mainTitleVerticalAlign === 'middle' && isValid(fixedMainTitleHeight)) {
this._mainTitle.setAttribute('y', fixedMainTitleHeight / 2);
this._mainTitle.setAttribute('textBaseline', 'middle');
} else if (mainTitleVerticalAlign === 'bottom' && isValid(fixedMainTitleHeight)) {
this._mainTitle.setAttribute('y', fixedMainTitleHeight);
this._mainTitle.setAttribute('textBaseline', 'bottom');
} else {
this._mainTitle.setAttribute('y', 0);
this._mainTitle.setAttribute('textBaseline', 'top');
}
const mainTitleVerticalAlign = textStyle.verticalAlign ? textStyle.verticalAlign : verticalAlign;
const mainTitleHeight =
fixedMainTitleHeight ?? (this._mainTitle.AABBBounds.empty() ? 0 : this._mainTitle.AABBBounds.height());

if (mainTitleVerticalAlign === 'middle') {
this._mainTitle.setAttribute('y', mainTitleHeight / 2);
this._mainTitle.setAttribute('textBaseline', 'middle');
} else if (mainTitleVerticalAlign === 'bottom') {
this._mainTitle.setAttribute('y', mainTitleHeight);
this._mainTitle.setAttribute('textBaseline', 'bottom');
} else {
// 如果没有显示的设置verticalAlign,默认top
this._mainTitle.setAttribute('y', 0);
this._mainTitle.setAttribute('textBaseline', 'top');
}
}

Expand All @@ -291,25 +294,26 @@ export class Title extends AbstractComponent<Required<TitleAttrs>> {
}
}

if (isValid(verticalAlign) || isValid(textStyle.verticalAlign)) {
const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign;
const subTitleYStart = this._mainTitle
? isValid(fixedMainTitleHeight)
? // 如果是用户指定的高度,根据bounds的height 和指定高度求最大值
this._mainTitle.AABBBounds.y1 + Math.max(this._mainTitle.AABBBounds.height(), fixedMainTitleHeight)
: this._mainTitle.AABBBounds.y2
: 0;
const subTitleHeight = subtextStyle.height ?? height;
if (subTitleVerticalAlign === 'middle' && isValid(subTitleHeight)) {
this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight / 2);
this._subTitle.setAttribute('textBaseline', 'middle');
} else if (subTitleVerticalAlign === 'bottom' && isValid(subTitleHeight)) {
this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight);
this._subTitle.setAttribute('textBaseline', 'bottom');
} else {
this._subTitle.setAttribute('y', subTitleYStart);
this._subTitle.setAttribute('textBaseline', 'top');
}
const subTitleVerticalAlign = subtextStyle.verticalAlign ? subtextStyle.verticalAlign : verticalAlign;

const subTitleYStart = this._mainTitle
? isValid(fixedMainTitleHeight)
? // 如果是用户指定的高度,根据bounds的height 和指定高度求最大值
this._mainTitle.AABBBounds.y1 +
Math.max(this._mainTitle.AABBBounds.empty() ? 0 : this._mainTitle.AABBBounds.height(), fixedMainTitleHeight)
: this._mainTitle.AABBBounds.y2
: 0;
const subTitleHeight =
subtextStyle.height ?? height ?? (this._subTitle.AABBBounds.empty() ? 0 : this._subTitle.AABBBounds.height());
if (subTitleVerticalAlign === 'middle') {
this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight / 2);
this._subTitle.setAttribute('textBaseline', 'middle');
} else if (subTitleVerticalAlign === 'bottom') {
this._subTitle.setAttribute('y', subTitleYStart + subTitleHeight);
this._subTitle.setAttribute('textBaseline', 'bottom');
} else {
this._subTitle.setAttribute('y', subTitleYStart);
this._subTitle.setAttribute('textBaseline', 'top');
}
}
}
Expand Down
Loading

0 comments on commit 461fedb

Please sign in to comment.