Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add diff graph demo #432

Merged
merged 11 commits into from
Nov 18, 2023
166 changes: 139 additions & 27 deletions apps/basic/src/pages/diff/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ const originalData = {
{
id: '1',
shape: 'rect',
x: 100,
x: 500,
y: 100,
width: 100,
height: 40,
data: {
a: 'test',
},
attrs: {
body: {
stroke: '#8f8f8f',
Expand All @@ -28,7 +25,7 @@ const originalData = {
{
id: '2',
shape: 'rect',
x: 50,
x: 400,
y: 200,
width: 100,
height: 40,
Expand All @@ -52,11 +49,11 @@ const originalData = {
{
id: '3',
shape: 'rect',
x: 180,
x: 600,
y: 200,
width: 100,
height: 40,
label: 'cat',
label: 'cat(change)',
attrs: {
body: {
stroke: '#8f8f8f',
Expand All @@ -67,9 +64,42 @@ const originalData = {
},
},
data: {
animal: {
name: 'cat',
age: 1,
cat: 'cat1',
},
},
{
id: '5',
shape: 'rect',
x: 325,
y: 300,
width: 100,
height: 40,
label: 'dog-1(del)',
attrs: {
body: {
stroke: '#8f8f8f',
strokeWidth: 1,
fill: '#fff',
rx: 6,
ry: 6,
},
},
},
{
id: '6',
shape: 'rect',
x: 450,
y: 300,
width: 100,
height: 40,
label: 'dog-2(del)',
attrs: {
body: {
stroke: '#8f8f8f',
strokeWidth: 1,
fill: '#fff',
rx: 6,
ry: 6,
},
},
},
Expand All @@ -90,9 +120,28 @@ const originalData = {
id: 'edge-2',
source: '1',
target: '3',
data: {
a: 'test',
attrs: {
line: {
stroke: '#8f8f8f',
strokeWidth: 1,
},
},
},
{
id: 'edge-4',
source: '2',
target: '5',
attrs: {
line: {
stroke: '#8f8f8f',
strokeWidth: 1,
},
},
},
{
id: 'edge-5',
source: '2',
target: '6',
attrs: {
line: {
stroke: '#8f8f8f',
Expand All @@ -109,13 +158,10 @@ const currentData = {
{
id: '1',
shape: 'rect',
x: 100,
x: 500,
y: 100,
width: 100,
height: 40,
data: {
a: 'test1',
},
attrs: {
body: {
stroke: '#8f8f8f',
Expand All @@ -128,13 +174,13 @@ const currentData = {
label: 'svg',
},
{
id: '3',
id: '2',
shape: 'rect',
x: 180,
x: 400,
y: 200,
width: 100,
height: 40,
label: 'cat',
label: 'dog',
attrs: {
body: {
stroke: '#8f8f8f',
Expand All @@ -146,19 +192,66 @@ const currentData = {
},
data: {
animal: {
name: 'cat',
name: 'dog',
age: 1,
},
},
},
{
id: '3',
shape: 'rect',
x: 600,
y: 200,
width: 100,
height: 40,
label: 'cat(change)',
attrs: {
body: {
stroke: '#8f8f8f',
strokeWidth: 1,
fill: '#fff',
rx: 6,
ry: 6,
},
},
data: {
data: {
cat: 'cat2',
},
},
},
{
id: '4',
shape: 'rect',
x: 250,
x: 550,
y: 300,
width: 100,
height: 40,
label: 'fish-1(add)',
attrs: {
body: {
stroke: '#8f8f8f',
strokeWidth: 1,
fill: '#fff',
rx: 6,
ry: 6,
},
},
data: {
animal: {
name: 'fish',
age: 1,
},
},
},
{
id: '7',
shape: 'rect',
x: 675,
y: 300,
width: 100,
height: 40,
label: 'fish',
label: 'fish-2(add)',
attrs: {
body: {
stroke: '#8f8f8f',
Expand All @@ -178,9 +271,9 @@ const currentData = {
],
edges: [
{
id: 'edge-3',
source: '3',
target: '4',
id: 'edge-1',
source: '1',
target: '2',
attrs: {
line: {
stroke: '#8f8f8f',
Expand All @@ -192,9 +285,28 @@ const currentData = {
id: 'edge-2',
source: '1',
target: '3',
data: {
a: 'test1',
attrs: {
line: {
stroke: '#8f8f8f',
strokeWidth: 1,
},
},
},
{
id: 'edge-3',
source: '3',
target: '4',
attrs: {
line: {
stroke: '#8f8f8f',
strokeWidth: 1,
},
},
},
{
id: 'edge-6',
source: '3',
target: '7',
attrs: {
line: {
stroke: '#8f8f8f',
Expand Down
Loading