Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
369f252
fix: (iadd demon prorogress)
liaodalin19903 Mar 31, 2025
7bcf2e1
fix: docs/update-custom-react-node
liaodalin19903 Mar 31, 2025
34fcdfd
fix: 修复Fisheye在update时,未更新this.r/this.d (#6956)
k644606347 Mar 31, 2025
bf0cc01
docs: update antv-dagre layout document (#6958)
chiga0 Apr 1, 2025
3e9c69e
docs: 改造Fisheye插件文档 (#6960)
k644606347 Apr 1, 2025
a5ae240
docs: 优化Watermark水印的文档 (#6963)
k644606347 Apr 1, 2025
8254624
docs: update antv-dagre layout document (#6965)
chiga0 Apr 1, 2025
888d6a7
docs(CreateEdge): 改造文档 [交互 - 内置交互 - CreateEdge 创建边] (#6962)
avrinfly Apr 3, 2025
a38f140
chore(site): optimize ssr in production env (#6970)
yvonneyx Apr 3, 2025
099752c
docs: update theme overview and custom theme docs (#6939)
yvonneyx Apr 3, 2025
39f034a
chore: pin dumi version to 2.4.17 (#6973)
yvonneyx Apr 3, 2025
f372054
fix: (iadd demon prorogress)
liaodalin19903 Mar 31, 2025
770244c
fix: docs/update-custom-react-node
liaodalin19903 Mar 31, 2025
5dd7d57
fix: docs/update-custom-node-react
liaodalin19903 Apr 3, 2025
a606a37
fix: solve the confict
liaodalin19903 Apr 3, 2025
8d529c8
fix: EdgeFilterLens在触发update时,options.r未赋值给this.r,导致配置未生效;fix: style …
k644606347 Apr 9, 2025
31ea481
fix: fix g6-ssr (#6984)
Aarebecca Apr 9, 2025
a1cf3e9
feat(g6-extension-react): react 19 compatibility support (#6972)
yvonneyx Apr 9, 2025
10ee238
docs: 优化EdgeFilterLens边过滤镜文档,更新中英文手册内容 (#6975)
k644606347 Apr 9, 2025
b9b9626
chore: update version (#6985)
yvonneyx Apr 9, 2025
368316c
docs: update demo links from Codesandbox to Stackblitz (#7000)
yvonneyx Apr 9, 2025
d43591e
fix: 更新fisheye demo里的style属性,与缩略图保持一致 (#7001)
k644606347 Apr 9, 2025
ad0ec66
fix: docs/update-custom-node-react
liaodalin19903 Apr 10, 2025
a399007
fix: (iadd demon prorogress)
liaodalin19903 Mar 31, 2025
4d791c5
fix: docs/update-custom-react-node
liaodalin19903 Mar 31, 2025
83b5d5c
fix: docs/update-custom-node-react
liaodalin19903 Apr 3, 2025
963b8d7
fix: docs/update-custom-node-react rebase origin/v5
liaodalin19903 Apr 10, 2025
e95b6ab
Merge branch 'docs/update-custom-node-react' of https://github.com/li…
liaodalin19903 Apr 10, 2025
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
2 changes: 1 addition & 1 deletion packages/g6-extension-3d/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g6-extension-3d",
"version": "0.1.18",
"version": "0.1.19",
"description": "3D extension for G6",
"keywords": [
"antv",
Expand Down
4 changes: 2 additions & 2 deletions packages/g6-extension-react/__tests__/graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface GraphProps {

export const Graph = (props: GraphProps) => {
const { options, onRender, onDestroy } = props;
const graphRef = useRef<G6Graph>();
const graphRef = useRef<G6Graph | null>(null);
const containerRef = useRef<HTMLDivElement>(null);

useEffect(() => {
Expand All @@ -22,7 +22,7 @@ export const Graph = (props: GraphProps) => {
if (graph) {
graph.destroy();
onDestroy?.();
graphRef.current = undefined;
graphRef.current = null;
}
};
}, []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ it('attribute changed callback', () => {
},
});

const spy = jest.spyOn(node, 'attributeChangedCallback');
const spy = jest.fn();
node.attributeChangedCallback = spy;

const component = () => <div>test1</div>;

Expand Down
10 changes: 5 additions & 5 deletions packages/g6-extension-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g6-extension-react",
"version": "0.2.0",
"version": "0.2.1",
"description": "Using React Component to Define Your G6 Graph Node",
"keywords": [
"antv",
Expand Down Expand Up @@ -41,11 +41,11 @@
"devDependencies": {
"@ant-design/icons": "^5.5.2",
"@antv/g6": "workspace:*",
"@types/react": "^18.3.17",
"@types/react-dom": "^18.3.5",
"@types/react": "^19.1.0",
"@types/react-dom": "^19.1.0",
"antd": "^5.22.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-router-dom": "^6.28.0",
"styled-components": "^6.1.13"
},
Expand Down
1 change: 1 addition & 0 deletions packages/g6-extension-react/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default [
name: 'G6ExtensionReact',
format: 'umd',
sourcemap: false,
inlineDynamicImports: true,
},
plugins: [
nodePolyfills(),
Expand Down
27 changes: 20 additions & 7 deletions packages/g6-extension-react/src/react-node/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,27 @@ const fullClone = {

type CreateRoot = (container: ContainerType) => Root;

const { version, render: reactRender, unmountComponentAtNode } = fullClone;
const { version, render: reactRender, unmountComponentAtNode } = fullClone as any;

let createRoot: CreateRoot | undefined;
try {

async function initCreateRoot() {
if (createRoot) return;
const mainVersion = Number((version || '').split('.')[0]);
if (mainVersion >= 18 && fullClone.createRoot) {
({ createRoot } = fullClone);

// React 18+ 使用 createRoot
if (mainVersion >= 18) {
try {
/* @vite-ignore */
const client = await import('react-dom/client');
if (client.createRoot) {
createRoot = client.createRoot;
}
} catch (error) {
// 如果动态导入失败,回退到旧版本渲染
// Silent error
}
}
} catch (e) {
// Do nothing;
}

/**
Expand Down Expand Up @@ -85,7 +96,8 @@ function legacyRender(node: React.ReactElement, container: ContainerType) {
* @param node - <zh/> React 节点 | <en/> React node
* @param container - <zh/> 容器 | <en/> Container
*/
export function render(node: React.ReactElement, container: ContainerType) {
export async function render(node: React.ReactElement, container: ContainerType) {
await initCreateRoot();
if (createRoot) modernRender(node, container);
else legacyRender(node, container);
}
Expand Down Expand Up @@ -123,6 +135,7 @@ function legacyUnmount(container: ContainerType) {
* @returns <zh/> Promise | <en/> Promise
*/
export async function unmount(container: ContainerType) {
await initCreateRoot();
if (createRoot) {
// Delay to unmount to avoid React 18 sync warning
return modernUnmount(container);
Expand Down
2 changes: 1 addition & 1 deletion packages/g6-ssr/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g6-ssr",
"version": "0.0.14",
"version": "0.0.16",
"description": "Support SSR for G6",
"keywords": [
"antv",
Expand Down
3 changes: 3 additions & 0 deletions packages/g6-ssr/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import * as G6 from '@antv/g6';

export { getExtension, getExtensions, register } from '@antv/g6';
export { createCanvas } from './canvas';
export { createGraph } from './graph';
export type { Graph, MetaData, Options } from './types';
export { G6 };
2 changes: 1 addition & 1 deletion packages/g6/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/g6",
"version": "5.0.44",
"version": "5.0.45",
"description": "A Graph Visualization Framework in JavaScript",
"keywords": [
"antv",
Expand Down
8 changes: 4 additions & 4 deletions packages/g6/src/plugins/edge-filter-lens/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { BaseStyleProps } from '@antv/g';
import { CommonEvent } from '../../constants';
import { Circle } from '../../elements';
import { Circle, type CircleStyleProps } from '../../elements';
import type { RuntimeContext } from '../../runtime/types';
import type { EdgeData, GraphData, NodeData } from '../../spec';
import type { EdgeStyle } from '../../spec/element/edge';
Expand Down Expand Up @@ -100,7 +99,7 @@ export interface EdgeFilterLensOptions extends BasePluginOptions {
*
* <en/> The style of the lens
*/
style?: BaseStyleProps;
style?: Partial<CircleStyleProps>;
/**
* <zh/> 在透镜中节点的样式
*
Expand All @@ -122,7 +121,7 @@ export interface EdgeFilterLensOptions extends BasePluginOptions {
preventDefault?: boolean;
}

const defaultLensStyle: BaseStyleProps = {
const defaultLensStyle: Exclude<CircleStyleProps, 'r'> = {
fill: '#fff',
fillOpacity: 1,
lineWidth: 1,
Expand Down Expand Up @@ -388,6 +387,7 @@ export class EdgeFilterLens extends BasePlugin<EdgeFilterLensOptions> {
public update(options: Partial<EdgeFilterLensOptions>) {
this.unbindEvents();
super.update(options);
this.r = options.r ?? this.r;
this.bindEvents();
}

Expand Down
2 changes: 2 additions & 0 deletions packages/g6/src/plugins/fisheye/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,8 @@ export class Fisheye extends BasePlugin<FisheyeOptions> {
public update(options: Partial<FisheyeOptions>) {
this.unbindEvents();
super.update(options);
this.r = options.r ?? this.r;
this.d = options.d ?? this.d;
this.bindEvents();
}

Expand Down
2 changes: 1 addition & 1 deletion packages/g6/src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = '5.0.44';
export const version = '5.0.45';
2 changes: 1 addition & 1 deletion packages/site/.dumi/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if (typeof window !== 'undefined' && window) {

window.react = require('react');
window.React = window.react;
window.client = require('react-dom');
window.client = require('react-dom/client');
window.styledComponents = require('styled-components');

window.addPanel = async (renderPanel: (gui) => void) => {
Expand Down
30 changes: 12 additions & 18 deletions packages/site/.dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ import { version } from '../g6/package.json';
import { homepage, repository } from './package.json';

export default defineConfig({
ssr:
process.env.NODE_ENV === 'production'
? {
builder: 'mako',
}
: false,
mako: {},
...(process.env.NODE_ENV === 'production' ? { ssr: { builder: 'webpack', mako: false } } : { ssr: false, mako: {} }),
locales: [
{ id: 'zh', name: '中文' },
{ id: 'en', name: 'English' },
Expand Down Expand Up @@ -133,23 +127,23 @@ export default defineConfig({
{
slug: 'manual/graph',
title: {
zh: '图 - Graph',
zh: '图 Graph',
en: 'Graph',
},
order: 3,
},
{
slug: 'manual/element',
title: {
zh: '元素 - Element',
zh: '元素 Element',
en: 'Element',
},
order: 5,
},
{
slug: 'manual/element/node',
title: {
zh: '节点',
zh: '节点 Node',
en: 'Node',
},
order: 3,
Expand All @@ -165,7 +159,7 @@ export default defineConfig({
{
slug: 'manual/element/edge',
title: {
zh: '边',
zh: '边 Edge',
en: 'Edge',
},
order: 4,
Expand All @@ -181,7 +175,7 @@ export default defineConfig({
{
slug: 'manual/element/combo',
title: {
zh: '组合',
zh: '组合 Combo',
en: 'Combo',
},
order: 5,
Expand All @@ -205,7 +199,7 @@ export default defineConfig({
{
slug: 'manual/layout',
title: {
zh: '布局 - Layout',
zh: '布局 Layout',
en: 'Layout',
},
order: 5,
Expand All @@ -221,7 +215,7 @@ export default defineConfig({
{
slug: 'manual/behavior',
title: {
zh: '交互 - Behavior',
zh: '交互 Behavior',
en: 'Behavior',
},
order: 6,
Expand All @@ -237,7 +231,7 @@ export default defineConfig({
{
slug: 'manual/plugin',
title: {
zh: '插件 - Plugin',
zh: '插件 Plugin',
en: 'Plugin',
},
order: 7,
Expand All @@ -253,7 +247,7 @@ export default defineConfig({
{
slug: 'manual/transform',
title: {
zh: '数据处理 - Transform',
zh: '数据处理 Transform',
en: 'Transform',
},
order: 8,
Expand All @@ -269,15 +263,15 @@ export default defineConfig({
{
slug: 'manual/theme',
title: {
zh: '主题 - Theme',
zh: '主题 Theme',
en: 'Theme',
},
order: 9,
},
{
slug: 'manual/animation',
title: {
zh: '动画 - Animation',
zh: '动画 Animation',
en: 'Animation',
},
order: 10,
Expand Down
3 changes: 3 additions & 0 deletions packages/site/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
docs/api/.gitignore

/server

# Dead links report
dead-links-report.log
8 changes: 2 additions & 6 deletions packages/site/common/angular-snippet.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<iframe src="https://codesandbox.io/embed/2gv4rt?view=split&module=%2Fsrc%2Fapp%2Fapp.component.ts&hidenavigation=1&theme=light"
style="width:100%; height: 500px; border:0; border-radius: 4px; overflow:hidden;"
title="G6 Angular"
allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking"
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
></iframe>
<iframe src="https://stackblitz.com/edit/g6-in-angular?embed=1&file=src%2Fmain.ts&theme=light"
style="width:100%; height: 500px; border:0; border-radius: 4px; overflow:hidden;"></iframe>

**app.component.html**

Expand Down
Loading
Loading