chore: lint
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import { Background, ConnectionMode, Controls, MiniMap, VueFlow, useVueFlow } from '@braks/vue-flow'
|
||||
import { Background, ConnectionMode, Controls, MiniMap, VueFlow, useVueFlow } from '@braks/vue-flow/src/index'
|
||||
|
||||
const { onConnect, nodes, edges, addEdges, addNodes } = useVueFlow({
|
||||
fitViewOnInit: true,
|
||||
|
||||
@@ -14,9 +14,8 @@ import type {
|
||||
import {
|
||||
addEdgeToStore,
|
||||
applyChanges,
|
||||
createGraphNodes,
|
||||
connectionExists,
|
||||
createAdditionChange,
|
||||
createGraphNodes,
|
||||
createPositionChange,
|
||||
createSelectionChange,
|
||||
getDimensions,
|
||||
@@ -230,9 +229,7 @@ export default (state: State, getters: ComputedGetters): Actions => {
|
||||
if (missingTarget) console.warn(`[vueflow]: Couldn't create edge for target id: ${edge.target}; edge id: ${edge.id}`)
|
||||
if (missingTarget || missingSource) return acc
|
||||
|
||||
acc.push(
|
||||
createAdditionChange<GraphEdge>(shallowReactive(edge)),
|
||||
)
|
||||
acc.push(createAdditionChange<GraphEdge>(shallowReactive(edge)))
|
||||
}
|
||||
|
||||
return acc
|
||||
|
||||
@@ -2,6 +2,7 @@ import { clampPosition, isGraphEdge, isGraphNode } from './graph'
|
||||
import type {
|
||||
CoordinateExtent,
|
||||
Edge,
|
||||
EdgeAddChange,
|
||||
EdgeChange,
|
||||
EdgeSelectionChange,
|
||||
ElementChange,
|
||||
@@ -11,11 +12,10 @@ import type {
|
||||
GraphEdge,
|
||||
GraphNode,
|
||||
Node,
|
||||
NodeAddChange,
|
||||
NodeChange,
|
||||
NodePositionChange,
|
||||
NodeSelectionChange,
|
||||
NodeAddChange,
|
||||
EdgeAddChange,
|
||||
XYPosition,
|
||||
} from '~/types'
|
||||
|
||||
@@ -106,43 +106,43 @@ export const applyChanges = <
|
||||
return elements.push(item)
|
||||
}
|
||||
|
||||
const i = elementIds.indexOf((<any>change).id)
|
||||
const el = elements[i]
|
||||
switch (change.type) {
|
||||
case 'select':
|
||||
if (isGraphNode(el) || isGraphEdge(el)) el.selected = change.selected
|
||||
break
|
||||
case 'position':
|
||||
if (isGraphNode(el)) {
|
||||
if (typeof change.position !== 'undefined') el.position = change.position
|
||||
if (el.expandParent && el.parentNode) {
|
||||
const parent = elements.find((parent) => parent.id === el.parentNode)
|
||||
const i = elementIds.indexOf((<any>change).id)
|
||||
const el = elements[i]
|
||||
switch (change.type) {
|
||||
case 'select':
|
||||
if (isGraphNode(el) || isGraphEdge(el)) el.selected = change.selected
|
||||
break
|
||||
case 'position':
|
||||
if (isGraphNode(el)) {
|
||||
if (typeof change.position !== 'undefined') el.position = change.position
|
||||
if (el.expandParent && el.parentNode) {
|
||||
const parent = elements.find((parent) => parent.id === el.parentNode)
|
||||
|
||||
if (parent && isGraphNode(parent)) {
|
||||
handleParentExpand(el, parent)
|
||||
if (parent && isGraphNode(parent)) {
|
||||
handleParentExpand(el, parent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
case 'dimensions':
|
||||
if (isGraphNode(el)) {
|
||||
if (typeof change.dimensions !== 'undefined') el.dimensions = change.dimensions
|
||||
if (el.expandParent && el.parentNode) {
|
||||
const parent = elements.find((parent) => parent.id === el.parentNode)
|
||||
break
|
||||
case 'dimensions':
|
||||
if (isGraphNode(el)) {
|
||||
if (typeof change.dimensions !== 'undefined') el.dimensions = change.dimensions
|
||||
if (el.expandParent && el.parentNode) {
|
||||
const parent = elements.find((parent) => parent.id === el.parentNode)
|
||||
|
||||
if (parent && isGraphNode(parent)) {
|
||||
handleParentExpand(el, parent)
|
||||
if (parent && isGraphNode(parent)) {
|
||||
handleParentExpand(el, parent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
case 'remove':
|
||||
if (elementIds.includes(change.id)) {
|
||||
elements.splice(i, 1)
|
||||
elementIds = elements.map((el) => el.id)
|
||||
}
|
||||
break
|
||||
}
|
||||
break
|
||||
case 'remove':
|
||||
if (elementIds.includes(change.id)) {
|
||||
elements.splice(i, 1)
|
||||
elementIds = elements.map((el) => el.id)
|
||||
}
|
||||
break
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user