Skip to content

Commit

Permalink
Merge pull request #588 from VisActor/release/0.14.16
Browse files Browse the repository at this point in the history
[Auto release] release 0.14.16
  • Loading branch information
xile611 authored Nov 25, 2024
2 parents f1cd251 + b34930b commit 4c7d2e5
Show file tree
Hide file tree
Showing 29 changed files with 350 additions and 265 deletions.
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.15","mainProject":"@visactor/vgrammar-core","nextBump":"patch"}]
[{"definitionName":"lockStepVersion","policyName":"vgrammarMain","version":"0.14.16","mainProject":"@visactor/vgrammar-core","nextBump":"patch"}]
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.18.18",
"@visactor/vgrammar": "workspace:0.14.15",
"@visactor/vgrammar-core": "workspace:0.14.15",
"@visactor/vgrammar-hierarchy": "workspace:0.14.15",
"@visactor/vgrammar-sankey": "workspace:0.14.15",
"@visactor/vgrammar-projection": "workspace:0.14.15",
"@visactor/vgrammar-wordcloud": "workspace:0.14.15",
"@visactor/vgrammar-wordcloud-shape": "workspace:0.14.15",
"@visactor/vgrammar-plot": "workspace:0.14.15",
"@visactor/vrender-core": "0.20.15",
"@visactor/vrender-kits": "0.20.15",
"@visactor/vrender": "0.20.15",
"@visactor/vgrammar": "workspace:0.14.16",
"@visactor/vgrammar-core": "workspace:0.14.16",
"@visactor/vgrammar-hierarchy": "workspace:0.14.16",
"@visactor/vgrammar-sankey": "workspace:0.14.16",
"@visactor/vgrammar-projection": "workspace:0.14.16",
"@visactor/vgrammar-wordcloud": "workspace:0.14.16",
"@visactor/vgrammar-wordcloud-shape": "workspace:0.14.16",
"@visactor/vgrammar-plot": "workspace:0.14.16",
"@visactor/vrender-core": "0.20.16",
"@visactor/vrender-kits": "0.20.16",
"@visactor/vrender": "0.20.16",
"d3-scale-chromatic": "^3.0.0",
"lodash": "4.17.21",
"typescript": "4.9.5",
"vite": "3.2.6",
"@visactor/vgrammar-util": "workspace:0.14.15",
"@visactor/vgrammar-coordinate": "workspace:0.14.15",
"@visactor/vgrammar-util": "workspace:0.14.16",
"@visactor/vgrammar-coordinate": "workspace:0.14.16",
"@vitejs/plugin-react": "3.1.0"
}
}
12 changes: 12 additions & 0 deletions docs/site/assets/changelog/en/release.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# v0.14.15

2024-11-19


**What's Changed**


**Full Changelog**: https://github.com/VisActor/VGrammar/compare/v0.14.14...v0.14.15

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

# v0.14.14

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

2024-11-19


**What's Changed**


**Full Changelog**: https://github.com/VisActor/VGrammar/compare/v0.14.14...v0.14.15

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

# v0.14.14

2024-11-13
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.18.18",
"@visactor/vgrammar": "workspace:0.14.15",
"@visactor/vgrammar-core": "workspace:0.14.15",
"@visactor/vgrammar-hierarchy": "workspace:0.14.15",
"@visactor/vgrammar-sankey": "workspace:0.14.15",
"@visactor/vgrammar-projection": "workspace:0.14.15",
"@visactor/vgrammar-wordcloud": "workspace:0.14.15",
"@visactor/vgrammar-wordcloud-shape": "workspace:0.14.15",
"@visactor/vgrammar-plot": "workspace:0.14.15",
"@visactor/vgrammar-util": "workspace:0.14.15",
"@visactor/vgrammar-coordinate": "workspace:0.14.15",
"@visactor/vgrammar-venn": "workspace:0.14.15",
"@visactor/vrender-core": "0.20.15",
"@visactor/vrender-kits": "0.20.15",
"@visactor/vrender": "0.20.15",
"@visactor/vgrammar": "workspace:0.14.16",
"@visactor/vgrammar-core": "workspace:0.14.16",
"@visactor/vgrammar-hierarchy": "workspace:0.14.16",
"@visactor/vgrammar-sankey": "workspace:0.14.16",
"@visactor/vgrammar-projection": "workspace:0.14.16",
"@visactor/vgrammar-wordcloud": "workspace:0.14.16",
"@visactor/vgrammar-wordcloud-shape": "workspace:0.14.16",
"@visactor/vgrammar-plot": "workspace:0.14.16",
"@visactor/vgrammar-util": "workspace:0.14.16",
"@visactor/vgrammar-coordinate": "workspace:0.14.16",
"@visactor/vgrammar-venn": "workspace:0.14.16",
"@visactor/vrender-core": "0.20.16",
"@visactor/vrender-kits": "0.20.16",
"@visactor/vrender": "0.20.16",
"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.15",
"version": "0.14.16",
"description": "Coordinates for VGrammar",
"keywords": [
"coordinate",
Expand Down Expand Up @@ -35,7 +35,7 @@
},
"dependencies": {
"@visactor/vutils": "~0.18.18",
"@visactor/vgrammar-util": "workspace:0.14.15"
"@visactor/vgrammar-util": "workspace:0.14.16"
},
"devDependencies": {
"@internal/bundler": "workspace:*",
Expand Down
12 changes: 12 additions & 0 deletions packages/vgrammar-core/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{
"name": "@visactor/vgrammar-core",
"entries": [
{
"version": "0.14.16",
"tag": "@visactor/vgrammar-core_v0.14.16",
"date": "Thu, 21 Nov 2024 07:41:48 GMT",
"comments": {
"none": [
{
"comment": "fix: fix reset of interactions\n\n"
}
]
}
},
{
"version": "0.14.15",
"tag": "@visactor/vgrammar-core_v0.14.15",
Expand Down
11 changes: 10 additions & 1 deletion packages/vgrammar-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Change Log - @visactor/vgrammar-core

This log was last generated on Fri, 15 Nov 2024 10:20:09 GMT and should not be manually modified.
This log was last generated on Thu, 21 Nov 2024 07:41:48 GMT and should not be manually modified.

## 0.14.16
Thu, 21 Nov 2024 07:41:48 GMT

### Updates

- fix: fix reset of interactions



## 0.14.15
Fri, 15 Nov 2024 10:20:09 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.15",
"version": "0.14.16",
"description": "VGrammar is a visual grammar library",
"keywords": [
"grammar",
Expand Down Expand Up @@ -37,12 +37,12 @@
"dependencies": {
"@visactor/vutils": "~0.18.18",
"@visactor/vdataset": "~0.18.18",
"@visactor/vgrammar-coordinate": "workspace:0.14.15",
"@visactor/vgrammar-util": "workspace:0.14.15",
"@visactor/vgrammar-coordinate": "workspace:0.14.16",
"@visactor/vgrammar-util": "workspace:0.14.16",
"@visactor/vscale": "~0.18.18",
"@visactor/vrender-core": "0.20.15",
"@visactor/vrender-kits": "0.20.15",
"@visactor/vrender-components": "0.20.15"
"@visactor/vrender-core": "0.20.16",
"@visactor/vrender-kits": "0.20.16",
"@visactor/vrender-components": "0.20.16"
},
"devDependencies": {
"@internal/bundler": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/vgrammar-core/src/interactions/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export abstract class BaseInteraction<T extends IBaseInteractionOptions> {
}

reset(element?: IElement | IGlyphElement) {
// do nothing
// do nothing
}

protected dispatchEvent(type: 'start' | 'reset' | 'update' | 'end', params: any) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,29 @@ export class ElementActiveByLegend extends BaseInteraction<ElementActiveByLegend
});
}

reset() {
resetAll() {
this._marks.forEach(mark => {
mark.elements.forEach(el => {
el.removeState(this.options.state);
});
});
}

reset(element?: InteractionEvent['element']) {
if (element) {
if (this._marks && this._marks.includes(element.mark)) {
element.removeState(this.options.state);
}
} else {
this.resetAll();
}
}

handleStart = (e: InteractionEvent) => {
this.start(e.detail?.data?.id);
};

handleReset = (e: InteractionEvent) => {
this.reset();
this.resetAll();
};
}
14 changes: 9 additions & 5 deletions packages/vgrammar-core/src/interactions/element-active.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InteractionStateEnum } from '../graph/enums';
import type { ElementActiveOptions, IMark, IView, InteractionEvent } from '../types';
import type { ElementActiveOptions, IElement, IMark, IView, InteractionEvent } from '../types';
import { BaseInteraction } from './base';

export class ElementActive extends BaseInteraction<ElementActiveOptions> {
Expand All @@ -13,6 +13,7 @@ export class ElementActive extends BaseInteraction<ElementActiveOptions> {
};
options: ElementActiveOptions;
protected _marks?: IMark[];
protected _prevActiveElement?: IElement;

constructor(view: IView, options?: ElementActiveOptions) {
super(view, options);
Expand All @@ -39,14 +40,17 @@ export class ElementActive extends BaseInteraction<ElementActiveOptions> {
if (element) {
if (this._marks && this._marks.includes(element.mark)) {
element.addState(this.options.state);
this._prevActiveElement = element;
}
}
}

reset(element: InteractionEvent['element']) {
if (element) {
if (this._marks && this._marks.includes(element.mark)) {
element.removeState(this.options.state);
reset(element?: InteractionEvent['element']) {
const el = element ?? this._prevActiveElement;

if (el) {
if (this._marks && this._marks.includes(el.mark)) {
el.removeState(this.options.state);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class ElementHighlightByGroup extends BaseInteraction<ElementHighlightOpt
];
}

clearPrevElements() {
resetAll() {
const states = [this.options.highlightState, this.options.blurState];

this._marks.forEach(mark => {
Expand Down Expand Up @@ -74,11 +74,13 @@ export class ElementHighlightByGroup extends BaseInteraction<ElementHighlightOpt
}
}

reset(element: InteractionEvent['element']) {
const hasActiveElement = element && this._marks && this._marks.includes(element.mark);

if (hasActiveElement) {
this.clearPrevElements();
reset(element?: InteractionEvent['element']) {
if (element) {
if (this._marks && this._marks.includes(element.mark)) {
element.removeState([this.options.highlightState, this.options.blurState]);
}
} else {
this.resetAll();
}
}

Expand All @@ -87,6 +89,11 @@ export class ElementHighlightByGroup extends BaseInteraction<ElementHighlightOpt
};

handleReset = (e: InteractionEvent) => {
this.reset(e.element);
const element = e.element;
const hasActiveElement = element && this._marks && this._marks.includes(element.mark);

if (hasActiveElement) {
this.resetAll();
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class ElementHighlightByKey extends BaseInteraction<ElementHighlightOptio
];
}

clearPrevElements() {
resetAll() {
const states = [this.options.highlightState, this.options.blurState];

this._marks.forEach(mark => {
Expand Down Expand Up @@ -74,30 +74,13 @@ export class ElementHighlightByKey extends BaseInteraction<ElementHighlightOptio
}
}

reset(element: InteractionEvent['element']) {
if (element && this._marks && this._marks.includes(element.mark)) {
const highlightKey = element.key;

if (isNil(highlightKey)) {
return;
reset(element?: InteractionEvent['element']) {
if (element) {
if (this._marks && this._marks.includes(element.mark)) {
element.removeState([this.options.highlightState, this.options.blurState]);
}
this._marks.forEach(mark => {
mark.elements.forEach(el => {
const isHighlight = el.key === highlightKey;

if (isHighlight) {
el.updateStates({
[this.options.blurState]: false,
[this.options.highlightState]: true
});
} else {
el.updateStates({
[this.options.blurState]: true,
[this.options.highlightState]: false
});
}
});
});
} else {
this.resetAll();
}
}

Expand All @@ -109,7 +92,7 @@ export class ElementHighlightByKey extends BaseInteraction<ElementHighlightOptio
const hasActiveElement = e.element && this._marks && this._marks.includes(e.element.mark);

if (hasActiveElement) {
this.clearPrevElements();
this.resetAll();
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,31 @@ export class ElementHighlightByLegend extends BaseInteraction<ElementHighlightBy
});
}

reset() {
const states = [this.options.blurState, this.options.highlightState];
resetAll() {
const states = [this.options.highlightState, this.options.blurState];

this._marks.forEach(mark => {
mark.elements.forEach(el => {
el.removeState(states);
});
});
}

reset(element?: InteractionEvent['element']) {
if (element) {
if (this._marks && this._marks.includes(element.mark)) {
element.removeState([this.options.highlightState, this.options.blurState]);
}
} else {
this.resetAll();
}
}

handleStart = (e: InteractionEvent, element: IElement | IGlyphElement) => {
this.start(e.detail?.data?.id);
};

handleReset = (e: InteractionEvent) => {
this.reset();
this.resetAll();
};
}
Loading

0 comments on commit 4c7d2e5

Please sign in to comment.