refactor(nodes): rename parentNode to parentId

This commit is contained in:
moklick
2024-04-09 13:26:54 +02:00
parent 4570b2494b
commit 3e59ab94f0
10 changed files with 41 additions and 39 deletions

View File

@@ -137,7 +137,7 @@ const initialNodes: Node[] = [
label: 'Child with extent: parent',
},
position: { x: 50, y: 50 },
parentNode: '5',
parentId: '5',
extent: 'parent',
width: 50,
height: 100,
@@ -148,7 +148,7 @@ const initialNodes: Node[] = [
type: 'defaultResizer',
data: { label: 'Child with expandParent' },
position: { x: 150, y: 100 },
parentNode: '5',
parentId: '5',
expandParent: true,
style: { ...nodeStyle },
},
@@ -157,7 +157,7 @@ const initialNodes: Node[] = [
type: 'defaultResizer',
data: { label: 'Child with expandParent & keepAspectRatio', keepAspectRatio: true },
position: { x: 25, y: 200 },
parentNode: '5',
parentId: '5',
expandParent: true,
style: { ...nodeStyle },
},

View File

@@ -50,7 +50,7 @@ const initialNodes: Node[] = [
data: { label: 'Node 4a' },
position: { x: 15, y: 15 },
className: 'light',
parentNode: '4',
parentId: '4',
origin: [0.5, 0.5],
extent: [
@@ -68,21 +68,21 @@ const initialNodes: Node[] = [
height: 200,
width: 300,
},
parentNode: '4',
parentId: '4',
},
{
id: '4b1',
data: { label: 'Node 4b1' },
position: { x: 40, y: 20 },
className: 'light',
parentNode: '4b',
parentId: '4b',
},
{
id: '4b2',
data: { label: 'Node 4b2' },
position: { x: 20, y: 100 },
className: 'light',
parentNode: '4b',
parentId: '4b',
},
{
id: '5',
@@ -98,7 +98,7 @@ const initialNodes: Node[] = [
data: { label: 'Node 5a' },
position: { x: 0, y: 0 },
className: 'light',
parentNode: '5',
parentId: '5',
extent: 'parent',
},
{
@@ -106,7 +106,7 @@ const initialNodes: Node[] = [
data: { label: 'Node 5b' },
position: { x: 225, y: 50 },
className: 'light',
parentNode: '5',
parentId: '5',
expandParent: true,
},
{
@@ -160,7 +160,7 @@ const Subflow = () => {
const updatePos = () => {
setNodes((nds) => {
return nds.map((n) => {
if (!n.parentNode) {
if (!n.parentId) {
return {
...n,
position: {
@@ -194,7 +194,7 @@ const Subflow = () => {
return nds.map((n) => {
return {
...n,
hidden: !!n.parentNode && !n.hidden,
hidden: !!n.parentId && !n.hidden,
};
});
});

View File

@@ -113,7 +113,7 @@
type: 'defaultResizer',
data: { label: 'Child with extent parent' },
position: { x: 50, y: 50 },
parentNode: '5',
parentId: '5',
extent: 'parent',
style: nodeStyle
},
@@ -122,7 +122,7 @@
type: 'defaultResizer',
data: { label: 'Child' },
position: { x: 100, y: 100 },
parentNode: '5',
parentId: '5',
style: nodeStyle
}
]);

View File

@@ -36,7 +36,7 @@
id: '4a',
data: { label: 'Node 4a' },
position: { x: 15, y: 15 },
parentNode: '4',
parentId: '4',
extent: [
[0, 0],
[100, 100]
@@ -47,19 +47,19 @@
data: { label: 'Node 4b' },
position: { x: 100, y: 60 },
style: 'width: 300px; height: 200px;',
parentNode: '4'
parentId: '4'
},
{
id: '4b1',
data: { label: 'Node 4b1' },
position: { x: 40, y: 20 },
parentNode: '4b'
parentId: '4b'
},
{
id: '4b2',
data: { label: 'Node 4b2' },
position: { x: 20, y: 100 },
parentNode: '4b'
parentId: '4b'
},
{
id: '5',
@@ -73,14 +73,14 @@
id: '5a',
data: { label: 'Node 5a' },
position: { x: 0, y: 0 },
parentNode: '5',
parentId: '5',
extent: 'parent'
},
{
id: '5b',
data: { label: 'Node 5b' },
position: { x: 225, y: 50 },
parentNode: '5',
parentId: '5',
expandParent: true
},
{