Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Patrik Meijer
react-components
Commits
0e04c2bb
Commit
0e04c2bb
authored
Feb 19, 2019
by
Patrik Meijer
Browse files
Store attr/regs setAttrs in cy nodes
parent
f08de3fd
Changes
3
Show whitespace changes
Inline
Side-by-side
src/components/GraphEditor/DefaultStyles.jsx
View file @
0e04c2bb
...
@@ -12,7 +12,7 @@ const DEFAULT_STYLES = [
...
@@ -12,7 +12,7 @@ const DEFAULT_STYLES = [
{
{
selector
:
'
node.gme-node[hasChildren]
'
,
selector
:
'
node.gme-node[hasChildren]
'
,
style
:
{
style
:
{
content
:
'
data(
label
)
'
,
content
:
'
data(
attributes.name
)
'
,
// http://js.cytoscape.org/#style/background-image
// http://js.cytoscape.org/#style/background-image
'
background-width
'
:
'
20%
'
,
'
background-width
'
:
'
20%
'
,
'
background-height
'
:
'
20%
'
,
'
background-height
'
:
'
20%
'
,
...
@@ -21,7 +21,7 @@ const DEFAULT_STYLES = [
...
@@ -21,7 +21,7 @@ const DEFAULT_STYLES = [
{
{
selector
:
'
node.gme-node[^hasChildren]
'
,
selector
:
'
node.gme-node[^hasChildren]
'
,
style
:
{
style
:
{
content
:
'
data(
label
)
'
,
content
:
'
data(
attributes.name
)
'
,
// http://js.cytoscape.org/#style/background-image
// http://js.cytoscape.org/#style/background-image
'
background-width
'
:
'
80%
'
,
'
background-width
'
:
'
80%
'
,
'
background-height
'
:
'
80%
'
,
'
background-height
'
:
'
80%
'
,
...
...
src/components/GraphEditor/GraphEditor.jsx
View file @
0e04c2bb
...
@@ -232,11 +232,12 @@ export default class GraphEditor extends Component {
...
@@ -232,11 +232,12 @@ export default class GraphEditor extends Component {
const
edgeData
=
{
const
edgeData
=
{
data
:
{
data
:
{
id
,
id
,
label
:
childData
.
attributes
.
name
,
attributes
:
childData
.
attributes
,
registries
:
childData
.
registries
,
source
:
childData
.
pointers
.
src
,
source
:
childData
.
pointers
.
src
,
target
:
childData
.
pointers
.
dst
,
target
:
childData
.
pointers
.
dst
,
},
},
classes
:
`gme-connection
${
childData
.
attributes
.
nam
e
}
-gme-connection\
classes
:
`gme-connection
${
childData
.
metaTyp
e
}
-gme-connection\
${
activeSelection
.
includes
(
id
)
?
'
in-active-selection
'
:
''
}
`
,
${
activeSelection
.
includes
(
id
)
?
'
in-active-selection
'
:
''
}
`
,
};
};
...
@@ -255,16 +256,15 @@ ${activeSelection.includes(id) ? ' in-active-selection' : ''}`,
...
@@ -255,16 +256,15 @@ ${activeSelection.includes(id) ? ' in-active-selection' : ''}`,
const
cytoData
=
{
const
cytoData
=
{
data
:
{
data
:
{
id
,
id
,
name
:
childData
.
attributes
.
name
,
attributes
:
childData
.
attributes
,
label
:
childData
.
attributes
.
label
registries
:
childData
.
registries
,
?
`
${
childData
.
attributes
.
name
}
::
${
childData
.
attributes
.
label
}
`
:
childData
.
attributes
.
name
,
parent
:
childData
.
parent
,
parent
:
childData
.
parent
,
metaType
:
childData
.
metaType
,
metaType
:
childData
.
metaType
,
},
},
position
:
getPosition
(
id
),
position
:
getPosition
(
id
),
grabbable
:
!
readOnly
,
grabbable
:
!
readOnly
,
classes
:
`gme-node
${
activeSelection
.
includes
(
id
)
?
'
in-active-selection
'
:
''
}
`
,
classes
:
`gme-node
${
childData
.
metaType
}
-gme-node \
${
activeSelection
.
includes
(
id
)
?
'
in-active-selection
'
:
''
}
`
,
};
};
result
.
elements
.
nodes
.
push
(
cytoData
);
result
.
elements
.
nodes
.
push
(
cytoData
);
...
@@ -308,7 +308,7 @@ ${activeSelection.includes(id) ? ' in-active-selection' : ''}`,
...
@@ -308,7 +308,7 @@ ${activeSelection.includes(id) ? ' in-active-selection' : ''}`,
source
:
id
,
source
:
id
,
target
:
setMemberData
.
id
,
target
:
setMemberData
.
id
,
label
:
setName
,
label
:
setName
,
m
emberAttrs
:
setMemberData
.
m
emberAttrs
,
setM
emberAttr
ibute
s
:
setMemberData
.
setM
emberAttr
ibute
s
,
},
},
classes
:
`set-member
${
setName
}
-set-member
${
activeSelection
.
includes
(
edgeId
)
classes
:
`set-member
${
setName
}
-set-member
${
activeSelection
.
includes
(
edgeId
)
?
'
in-active-selection
'
:
''
}
`
,
?
'
in-active-selection
'
:
''
}
`
,
...
...
src/components/SubTreeWatcher/SubTreeWatcher.jsx
View file @
0e04c2bb
...
@@ -43,7 +43,7 @@ const DEFAULT_OPTIONS = {
...
@@ -43,7 +43,7 @@ const DEFAULT_OPTIONS = {
setNames
:
null
,
setNames
:
null
,
// Mapping from set name to set attribute name
// Mapping from set name to set attribute name
setMemberAttributes
:
{},
setMemberAttributes
:
{},
// The depth of the territory, i.e. the number of levels of containment-hierarchy to
display
.
// The depth of the territory, i.e. the number of levels of containment-hierarchy to
load
.
depth
:
10
,
depth
:
10
,
};
};
...
@@ -112,17 +112,13 @@ export default class SubTreeWatcher extends Component {
...
@@ -112,17 +112,13 @@ export default class SubTreeWatcher extends Component {
result
=
nodeObj
.
getMemberIds
(
setName
).
map
((
id
)
=>
{
result
=
nodeObj
.
getMemberIds
(
setName
).
map
((
id
)
=>
{
const
entry
=
{
const
entry
=
{
id
,
id
,
m
emberAttrs
:
[]
,
setM
emberAttr
ibute
s
:
{}
,
};
};
if
(
options
.
setMemberAttributes
[
setName
])
{
if
(
options
.
setMemberAttributes
[
setName
])
{
options
.
setMemberAttributes
[
setName
]
options
.
setMemberAttributes
[
setName
]
.
forEach
((
attrEntry
)
=>
{
.
forEach
((
name
)
=>
{
const
value
=
nodeObj
.
getMemberAttribute
(
setName
,
id
,
attrEntry
.
name
);
entry
.
setMemberAttributes
[
name
]
=
nodeObj
.
getMemberAttribute
(
setName
,
id
,
name
)
||
''
;
entry
.
memberAttrs
.
push
({
name
:
attrEntry
.
name
,
value
,
});
});
});
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment