Files
vue-flow/src/types/node.ts
T
Braks f2e38ca7ac 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>
2021-11-25 15:21:36 +01:00

65 lines
1.6 KiB
TypeScript

import { CSSProperties } from 'vue'
import { DraggableOptions } from '@braks/revue-draggable'
import { XYPosition, ElementId, Position, SnapGrid } from './flow'
import { HandleElement, NodeTypes, ValidConnectionFunc } from './components'
export interface VFInternals {
isDragging?: boolean
width: number
height: number
handleBounds: {
source?: HandleElement[]
target?: HandleElement[]
}
}
export type Draggable = Omit<DraggableOptions, 'scale' | 'grid' | 'enableUserSelectHack' | 'enableTransformFix'> | boolean
export interface Node<T = any> {
id: ElementId
position: XYPosition
type?: NodeTypes[number]
class?: string
style?: CSSProperties
data?: T
targetPosition?: Position
sourcePosition?: Position
isHidden?: boolean
draggable?: Draggable
selectable?: boolean
connectable?: boolean
dragHandle?: string
snapGrid?: SnapGrid
isValidTargetPos?: ValidConnectionFunc
isValidSourcePos?: ValidConnectionFunc
}
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
export type NodeDimensionUpdate = {
id: ElementId
nodeElement: HTMLDivElement
forceUpdate?: boolean
}