refactor(types)!: change node and edge types to extend element

* element type provides intersection interface of nodes and edges
* rename isHidden to hidden

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-12-20 19:29:52 +01:00
parent da54bc3316
commit fe0eeaeae9
6 changed files with 18 additions and 31 deletions
+2 -17
View File
@@ -1,36 +1,21 @@
import { CSSProperties } from 'vue'
import { ArrowHeadType, ElementId, Position } from './flow'
import { EdgeTextProps, EdgeTypes } from './components'
import { ArrowHeadType, ElementId, Position, Element } from './flow'
import { GraphNode } from './node'
export interface Edge<T = any> {
id: ElementId
type?: EdgeTypes[number]
export interface Edge<T = any> extends Element<T> {
source: ElementId
target: ElementId
sourceHandle?: ElementId
targetHandle?: ElementId
selected?: boolean
sourcePosition?: Position
targetPosition?: Position
label?:
| string
| {
component: any
props?: Record<string, any> & Partial<EdgeTextProps>
}
labelStyle?: any
labelShowBg?: boolean
labelBgStyle?: any
labelBgPadding?: [number, number]
labelBgBorderRadius?: number
style?: CSSProperties | unknown
animated?: boolean
arrowHeadType?: ArrowHeadType
markerEndId?: string
data?: T
class?: string
isHidden?: boolean
updatable?: boolean
}