update(nodes): add __vf to node props

* move edge/node component-types to components file

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-11-25 15:21:36 +01:00
parent 3855e9fe3f
commit f2e38ca7ac
6 changed files with 39 additions and 37 deletions
+18 -20
View File
@@ -1,7 +1,7 @@
import { Component, CSSProperties, DefineComponent } from 'vue'
import { CSSProperties } from 'vue'
import { DraggableOptions } from '@braks/revue-draggable'
import { XYPosition, ElementId, Position, SnapGrid } from './flow'
import { HandleElement, ValidConnectionFunc } from './components'
import { HandleElement, NodeTypes, ValidConnectionFunc } from './components'
export interface VFInternals {
isDragging?: boolean
@@ -13,24 +13,6 @@ export interface VFInternals {
}
}
export interface NodeProps<T = any> {
id: ElementId
type?: string
data?: T
selected?: boolean
connectable?: boolean
xPos?: number
yPos?: number
targetPosition?: Position
sourcePosition?: Position
dragging?: boolean
isValidTargetPos?: ValidConnectionFunc
isValidSourcePos?: ValidConnectionFunc
}
export type NodeComponent = Component<NodeProps> | DefineComponent<NodeProps, any, any, any, any> | string
export type DefaultNodeTypes = { [key in 'input' | 'output' | 'default']: Component<NodeProps> }
export type NodeTypes = (keyof DefaultNodeTypes | string)[]
export type Draggable = Omit<DraggableOptions, 'scale' | 'grid' | 'enableUserSelectHack' | 'enableTransformFix'> | boolean
export interface Node<T = any> {
@@ -56,6 +38,22 @@ export interface GraphNode<T = any> extends Node<T> {
__vf: VFInternals
}
export interface NodeProps<T = any> extends GraphNode {
id: ElementId
type?: string
data?: T
selected?: boolean
connectable?: boolean
xPos?: number
yPos?: number
targetPosition?: Position
sourcePosition?: Position
dragging?: boolean
isValidTargetPos?: ValidConnectionFunc
isValidSourcePos?: ValidConnectionFunc
__vf: VFInternals
}
export type TranslateExtent = [[number, number], [number, number]]
export type NodeExtent = TranslateExtent