|
@@ -11,7 +11,13 @@ function getLinked (text) {
|
|
const types = ['siblings', 'children', 'parents']
|
|
const types = ['siblings', 'children', 'parents']
|
|
return types.reduce((acc, type) => {
|
|
return types.reduce((acc, type) => {
|
|
// Handle `null` and `undefined`
|
|
// Handle `null` and `undefined`
|
|
- return text[type] ? [...acc, ...text[type]] : acc
|
|
|
|
|
|
+ if (text[type]) {
|
|
|
|
+ text[type].forEach((item, i) => {
|
|
|
|
+ item.linkType = type
|
|
|
|
+ })
|
|
|
|
+ return [...acc, ...text[type]]
|
|
|
|
+ }
|
|
|
|
+ return acc
|
|
}, [])
|
|
}, [])
|
|
}
|
|
}
|
|
|
|
|
|
@@ -66,7 +72,7 @@ export function toManyManyData (rawData) {
|
|
}, []).map(({ data, children, depth }) => {
|
|
}, []).map(({ data, children, depth }) => {
|
|
if (children) {
|
|
if (children) {
|
|
children.forEach(child => {
|
|
children.forEach(child => {
|
|
- links.push({ source: data.id, target: child.data.id })
|
|
|
|
|
|
+ links.push({ source: data.id, target: child.data.id, linkType: child.data.linkType })
|
|
})
|
|
})
|
|
}
|
|
}
|
|
return {
|
|
return {
|