Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
214 changes: 107 additions & 107 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

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":"vgrammarMain","version":"0.14.18","mainProject":"@visactor/vgrammar-core","nextBump":"patch"}]
[{"definitionName":"lockStepVersion","policyName":"vgrammarMain","version":"0.15.0","mainProject":"@visactor/vgrammar-core","nextBump":"minor"}]
26 changes: 13 additions & 13 deletions docs/dev-demos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@
"@internal/eslint-config": "workspace:*",
"@internal/ts-config": "workspace:*",
"@visactor/vutils": "~0.19.2",
"@visactor/vgrammar": "workspace:0.14.18",
"@visactor/vgrammar-core": "workspace:0.14.18",
"@visactor/vgrammar-hierarchy": "workspace:0.14.18",
"@visactor/vgrammar-sankey": "workspace:0.14.18",
"@visactor/vgrammar-projection": "workspace:0.14.18",
"@visactor/vgrammar-wordcloud": "workspace:0.14.18",
"@visactor/vgrammar-wordcloud-shape": "workspace:0.14.18",
"@visactor/vgrammar-plot": "workspace:0.14.18",
"@visactor/vrender-core": "0.20.18",
"@visactor/vrender-kits": "0.20.18",
"@visactor/vrender": "0.20.18",
"@visactor/vgrammar": "workspace:0.15.0",
"@visactor/vgrammar-core": "workspace:0.15.0",
"@visactor/vgrammar-hierarchy": "workspace:0.15.0",
"@visactor/vgrammar-sankey": "workspace:0.15.0",
"@visactor/vgrammar-projection": "workspace:0.15.0",
"@visactor/vgrammar-wordcloud": "workspace:0.15.0",
"@visactor/vgrammar-wordcloud-shape": "workspace:0.15.0",
"@visactor/vgrammar-plot": "workspace:0.15.0",
"@visactor/vrender-core": "0.21.1",
"@visactor/vrender-kits": "0.21.1",
"@visactor/vrender": "0.21.1",
"d3-scale-chromatic": "^3.0.0",
"lodash": "4.17.21",
"typescript": "4.9.5",
"vite": "3.2.6",
"@visactor/vgrammar-util": "workspace:0.14.18",
"@visactor/vgrammar-coordinate": "workspace:0.14.18",
"@visactor/vgrammar-util": "workspace:0.15.0",
"@visactor/vgrammar-coordinate": "workspace:0.15.0",
"@vitejs/plugin-react": "3.1.0"
}
}
35 changes: 35 additions & 0 deletions docs/site/assets/changelog/en/release.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
# v0.14.18

2024-12-05


**What's Changed**

* [Auto Sync] Sync the code from branch main to branch develop after release 0.14.17 by @github-actions in https://github.com/VisActor/VGrammar/pull/598
* [Auto release] release 0.14.18 by @github-actions in https://github.com/VisActor/VGrammar/pull/600


**Full Changelog**: https://github.com/VisActor/VGrammar/compare/v0.14.17...v0.14.18

[more detail about v0.14.18](https://github.com/VisActor/VGrammar/releases/tag/v0.14.18)

# v0.14.17

2024-12-05


**🆕 New feature**

- **@visactor/vgrammar-core**: support `maxNodeHeight` and `maxLinkHeight`, `crossNodeAlign` value `parent` in sankey
- **@visactor/vgrammar-core**: add `autoRefresh` to stage

**🐛 Bug fix**

- **@visactor/vgrammar-core**: fix the issue of animation cannot be cleared for reused mark
- **@visactor/vgrammar-core**: glyph state should work when resize
- **@visactor/vgrammar-core**: support react and html attributes in textmark



[more detail about v0.14.17](https://github.com/VisActor/VGrammar/releases/tag/v0.14.17)

# v0.14.16

2024-11-25
Expand Down
35 changes: 35 additions & 0 deletions docs/site/assets/changelog/zh/release.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
# v0.14.18

2024-12-05


**What's Changed**

* [Auto Sync] Sync the code from branch main to branch develop after release 0.14.17 by @github-actions in https://github.com/VisActor/VGrammar/pull/598
* [Auto release] release 0.14.18 by @github-actions in https://github.com/VisActor/VGrammar/pull/600


**Full Changelog**: https://github.com/VisActor/VGrammar/compare/v0.14.17...v0.14.18

[更多详情请查看 v0.14.18](https://github.com/VisActor/VGrammar/releases/tag/v0.14.18)

# v0.14.17

2024-12-05


**🆕 新增功能**

- **@visactor/vgrammar-core**: support `maxNodeHeight` and `maxLinkHeight`, `crossNodeAlign` value `parent` in sankey
- **@visactor/vgrammar-core**: add `autoRefresh` to stage

**🐛 功能修复**

- **@visactor/vgrammar-core**: fix the issue of animation cannot be cleared for reused mark
- **@visactor/vgrammar-core**: glyph state should work when resize
- **@visactor/vgrammar-core**: support react and html attributes in textmark



[更多详情请查看 v0.14.17](https://github.com/VisActor/VGrammar/releases/tag/v0.14.17)

# v0.14.16

2024-11-25
Expand Down
28 changes: 14 additions & 14 deletions docs/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
"dependencies": {
"@arco-design/web-react": "2.46.1",
"@visactor/vutils": "~0.19.2",
"@visactor/vgrammar": "workspace:0.14.18",
"@visactor/vgrammar-core": "workspace:0.14.18",
"@visactor/vgrammar-hierarchy": "workspace:0.14.18",
"@visactor/vgrammar-sankey": "workspace:0.14.18",
"@visactor/vgrammar-projection": "workspace:0.14.18",
"@visactor/vgrammar-wordcloud": "workspace:0.14.18",
"@visactor/vgrammar-wordcloud-shape": "workspace:0.14.18",
"@visactor/vgrammar-plot": "workspace:0.14.18",
"@visactor/vgrammar-util": "workspace:0.14.18",
"@visactor/vgrammar-coordinate": "workspace:0.14.18",
"@visactor/vgrammar-venn": "workspace:0.14.18",
"@visactor/vrender-core": "0.20.18",
"@visactor/vrender-kits": "0.20.18",
"@visactor/vrender": "0.20.18",
"@visactor/vgrammar": "workspace:0.15.0",
"@visactor/vgrammar-core": "workspace:0.15.0",
"@visactor/vgrammar-hierarchy": "workspace:0.15.0",
"@visactor/vgrammar-sankey": "workspace:0.15.0",
"@visactor/vgrammar-projection": "workspace:0.15.0",
"@visactor/vgrammar-wordcloud": "workspace:0.15.0",
"@visactor/vgrammar-wordcloud-shape": "workspace:0.15.0",
"@visactor/vgrammar-plot": "workspace:0.15.0",
"@visactor/vgrammar-util": "workspace:0.15.0",
"@visactor/vgrammar-coordinate": "workspace:0.15.0",
"@visactor/vgrammar-venn": "workspace:0.15.0",
"@visactor/vrender-core": "0.21.1",
"@visactor/vrender-kits": "0.21.1",
"@visactor/vrender": "0.21.1",
"markdown-it": "^13.0.0",
"highlight.js": "^11.8.0",
"axios": "^1.4.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/vgrammar-coordinate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vgrammar-coordinate",
"version": "0.14.18",
"version": "0.15.0",
"description": "Coordinates for VGrammar",
"keywords": [
"coordinate",
Expand Down Expand Up @@ -35,7 +35,7 @@
},
"dependencies": {
"@visactor/vutils": "~0.19.2",
"@visactor/vgrammar-util": "workspace:0.14.18"
"@visactor/vgrammar-util": "workspace:0.15.0"
},
"devDependencies": {
"@internal/bundler": "workspace:*",
Expand Down
18 changes: 18 additions & 0 deletions packages/vgrammar-core/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
{
"name": "@visactor/vgrammar-core",
"entries": [
{
"version": "0.15.0",
"tag": "@visactor/vgrammar-core_v0.15.0",
"date": "Thu, 05 Dec 2024 09:52:00 GMT",
"comments": {
"none": [
{
"comment": "feat: support overflow of mark\n\n"
},
{
"comment": " feat: add interaction for highlight/select by graphic name"
},
{
"comment": "feat: add `graphicName` in markOption"
}
]
}
},
{
"version": "0.14.18",
"tag": "@visactor/vgrammar-core_v0.14.18",
Expand Down
13 changes: 12 additions & 1 deletion packages/vgrammar-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Change Log - @visactor/vgrammar-core

This log was last generated on Thu, 05 Dec 2024 08:32:52 GMT and should not be manually modified.
This log was last generated on Thu, 05 Dec 2024 09:52:00 GMT and should not be manually modified.

## 0.15.0
Thu, 05 Dec 2024 09:52:00 GMT

### Updates

- feat: support overflow of mark


- feat: add interaction for highlight/select by graphic name
- feat: add `graphicName` in markOption

## 0.14.18
Thu, 05 Dec 2024 08:32:52 GMT
Expand Down
12 changes: 6 additions & 6 deletions packages/vgrammar-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vgrammar-core",
"version": "0.14.18",
"version": "0.15.0",
"description": "VGrammar is a visual grammar library",
"keywords": [
"grammar",
Expand Down Expand Up @@ -37,12 +37,12 @@
"dependencies": {
"@visactor/vutils": "~0.19.2",
"@visactor/vdataset": "~0.19.2",
"@visactor/vgrammar-coordinate": "workspace:0.14.18",
"@visactor/vgrammar-util": "workspace:0.14.18",
"@visactor/vgrammar-coordinate": "workspace:0.15.0",
"@visactor/vgrammar-util": "workspace:0.15.0",
"@visactor/vscale": "~0.19.2",
"@visactor/vrender-core": "0.20.18",
"@visactor/vrender-kits": "0.20.18",
"@visactor/vrender-components": "0.20.18"
"@visactor/vrender-core": "0.21.1",
"@visactor/vrender-kits": "0.21.1",
"@visactor/vrender-components": "0.21.1"
},
"devDependencies": {
"@internal/bundler": "workspace:*",
Expand Down
8 changes: 8 additions & 0 deletions packages/vgrammar-core/src/graph/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ export class Element implements IElement {
if (!this.graphicItem) {
return;
}

const { graphicName } = this.mark.getSpec();
if (isString(graphicName)) {
this.graphicItem.name = graphicName;
} else if (isFunction(graphicName)) {
this.graphicItem.name = graphicName(this);
}

// 统一读取mark中是否可交互的配置
this.graphicItem[BridgeElementKey] = this;
if (attrTransforms) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import type { ElementHighlightByGraphicNameOptions, IElement, IGlyphElement, IView, InteractionEvent } from '../types';
import { isNil } from '@visactor/vutils';
import { ElementHighlight } from './element-highlight';

export class ElementHighlightByGraphicName extends ElementHighlight {
static type: string = 'element-highlight-by-graphic-name';
type: string = ElementHighlightByGraphicName.type;

options: ElementHighlightByGraphicNameOptions;

constructor(view: IView, options?: ElementHighlightByGraphicNameOptions) {
super(view, options);
this.options = Object.assign({}, ElementHighlightByGraphicName.defaultOptions, options);
this._marks = view.getMarksBySelector(this.options.selector);
}

protected _filterByName(e: InteractionEvent) {
const name = e?.target?.name;
return !!name;
}

protected _parseTargetKey(e: InteractionEvent, element: IElement | IGlyphElement) {
return e.target.name;
}

start(itemKey: IElement | IGlyphElement | string) {
if (isNil(itemKey)) {
return;
}

this._marks.forEach(mark => {
mark.elements.forEach(el => {
const isHighlight = el.getGraphicItem()?.name === itemKey;
if (isHighlight) {
el.updateStates({
[this.options.blurState]: false,
[this.options.highlightState]: true
});
} else {
el.updateStates({
[this.options.blurState]: true,
[this.options.highlightState]: false
});
}
});
});
}

reset() {
const states = [this.options.blurState, this.options.highlightState];
this._marks.forEach(mark => {
mark.elements.forEach(el => {
el.removeState(states);
});
});
}

handleStart = (e: InteractionEvent) => {
if (e && e.element && this._marks.includes(e.element.mark)) {
const shouldStart = this.options.shouldStart ? this.options.shouldStart(e) : this._filterByName(e);
if (shouldStart) {
const itemKey = this._parseTargetKey(e, e.element);
this.start(itemKey);
}
}
};

handleReset = (e: InteractionEvent) => {
if (e && e.element && this._marks.includes(e.element.mark)) {
this.reset();
}
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { InteractionEvent } from '../types';
import { ElementSelect } from './element-select';

export class ElementSelectByGraphicName extends ElementSelect {
static type: string = 'element-select-by-graphic-name';
type: string = ElementSelectByGraphicName.type;

start(element: InteractionEvent['element']) {
const name = element.getGraphicItem()?.name;
if (name) {
this._marks.forEach(mark => {
mark.elements.forEach(el => {
if (el.getGraphicItem()?.name === name) {
super.start(el);
}
});
});
}
}
}
11 changes: 11 additions & 0 deletions packages/vgrammar-core/src/interactions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { ElementHighlightByGroup } from './element-highlight-by-group';
import { ElementActiveByLegend } from './element-active-by-legend';
import { ElementHighlightByLegend } from './element-highlight-by-legend';
import { ElementHighlightByName } from './element-highlight-by-name';
import { ElementHighlightByGraphicName } from './element-highlight-by-graphic-name';
import { ElementSelectByGraphicName } from './element-select-by-graphic-name';

import { BrushHighlight } from './brush-highlight';
import { BrushActive } from './brush-active';
import { BrushFilter } from './brush-filter';
Expand Down Expand Up @@ -92,6 +95,14 @@ export const registerElementHighlightByName = () => {
Factory.registerInteraction(ElementHighlightByName.type, ElementHighlightByName);
};

export const registerElementHighlightByGraphicName = () => {
Factory.registerInteraction(ElementHighlightByGraphicName.type, ElementHighlightByGraphicName);
};

export const registerElementSelectByGraphicName = () => {
Factory.registerInteraction(ElementSelectByGraphicName.type, ElementSelectByGraphicName);
};

export const registerBrushHighlight = () => {
Factory.registerInteraction(BrushHighlight.type, BrushHighlight);
};
Expand Down
2 changes: 2 additions & 0 deletions packages/vgrammar-core/src/types/interaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ export interface ElementHighlightByNameOptions extends ElementHighlightByLegendO
parseData?: (e: InteractionEvent) => any;
}

export type ElementHighlightByGraphicNameOptions = ElementHighlightOptions;

export interface BrushEventParams {
operateType: string;
operateMask: IPolygon;
Expand Down
5 changes: 5 additions & 0 deletions packages/vgrammar-core/src/types/mark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ export interface IMarkConfig {
* only used in line/area mark
*/
enableSegments?: boolean;
/**
* set graphic name
*/
graphicName?: string | ((element: IElement) => string);
overflow?: 'scroll' | 'hidden' | 'scroll-x' | 'scroll-y';
}

/**
Expand Down
Loading