a
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
import { createId } from '../../tools/tools'
|
||||
interface NodeOptions {
|
||||
id?: string
|
||||
type: "InputNode" | "SecondaryNode"
|
||||
class?: string
|
||||
position?: { x: number, y: number }
|
||||
component: any
|
||||
data?: object
|
||||
}
|
||||
export class NodeManager {
|
||||
stateManager: any
|
||||
vueFlow: any
|
||||
@@ -6,6 +15,22 @@ export class NodeManager {
|
||||
this.vueFlow = options.vueFlow
|
||||
}
|
||||
nodes: [
|
||||
|
||||
|
||||
]
|
||||
createNode(options: NodeOptions) {
|
||||
const id = options.id || createId()
|
||||
const type = options.type || 'InputNode'
|
||||
const class_ = options.class || 'custom-node'
|
||||
const position = options.position || { x: 0, y: 0 }
|
||||
const data = options.data || {}
|
||||
data['component'] = options.component
|
||||
this.stateManager.nodes.value.push({
|
||||
id,
|
||||
type,
|
||||
class: class_,
|
||||
position,
|
||||
data
|
||||
})
|
||||
console.log(this.stateManager.nodes.value)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user