update(types!): Merge EdgeProps into Edge type
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -1,17 +1,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {
|
import { useHooks, useStore, getEdgeCenter, getBezierPath, getMarkerEnd, ArrowHeadType, Edge, ElementId, Position } from '~/index'
|
||||||
useHooks,
|
|
||||||
useStore,
|
|
||||||
getEdgeCenter,
|
|
||||||
getBezierPath,
|
|
||||||
getMarkerEnd,
|
|
||||||
ArrowHeadType,
|
|
||||||
EdgeProps,
|
|
||||||
ElementId,
|
|
||||||
Position,
|
|
||||||
} from '~/index'
|
|
||||||
|
|
||||||
interface CustomEdgeProps<T = any> extends EdgeProps<T> {
|
interface CustomEdgeProps<T = any> extends Edge<T> {
|
||||||
id: ElementId
|
id: ElementId
|
||||||
sourceX: number
|
sourceX: number
|
||||||
sourceY: number
|
sourceY: number
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ArrowHeadType, ElementId, getBezierPath, getMarkerEnd, Position, EdgeProps } from '~/index'
|
import { ArrowHeadType, ElementId, getBezierPath, getMarkerEnd, Position, EdgeProps } from '~/index'
|
||||||
|
|
||||||
interface CustomEdgeProps<T = any> extends EdgeProps<T> {
|
interface CustomEdgeProps<T = { text: string }> extends EdgeProps<T> {
|
||||||
source: ElementId
|
source: ElementId
|
||||||
target: ElementId
|
target: ElementId
|
||||||
sourceHandleId?: ElementId
|
sourceHandleId?: ElementId
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { getBezierPath, getMarkerEnd } from '~/components/Edges/utils'
|
import { getBezierPath, getMarkerEnd } from '~/components/Edges/utils'
|
||||||
import { ArrowHeadType, EdgeProps, ElementId, getEdgeCenter, Position, EdgeText } from '~/index'
|
import { ArrowHeadType, ElementId, getEdgeCenter, Position, EdgeText, EdgeProps } from '~/index'
|
||||||
|
|
||||||
interface CustomEdgeProps<T = any> extends EdgeProps<T> {
|
interface CustomEdgeProps extends EdgeProps {
|
||||||
source: ElementId
|
source: ElementId
|
||||||
target: ElementId
|
target: ElementId
|
||||||
sourceHandleId?: ElementId
|
sourceHandleId?: ElementId
|
||||||
@@ -16,7 +16,7 @@ interface CustomEdgeProps<T = any> extends EdgeProps<T> {
|
|||||||
targetPosition: Position
|
targetPosition: Position
|
||||||
arrowHeadType?: ArrowHeadType
|
arrowHeadType?: ArrowHeadType
|
||||||
markerEndId?: string
|
markerEndId?: string
|
||||||
data?: T
|
data?: any
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<CustomEdgeProps>()
|
const props = defineProps<CustomEdgeProps>()
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
import { CSSProperties } from 'vue'
|
import { CSSProperties } from 'vue'
|
||||||
import { getCenter, getMarkerEnd, getBezierPath } from './utils'
|
import { getCenter, getMarkerEnd, getBezierPath } from './utils'
|
||||||
import EdgeText from './EdgeText.vue'
|
import EdgeText from './EdgeText.vue'
|
||||||
import { ArrowHeadType, ElementId, Position } from '~/types'
|
import { ArrowHeadType, EdgeProps, ElementId, Position } from '~/types'
|
||||||
|
|
||||||
interface BezierEdgeProps {
|
interface BezierEdgeProps extends EdgeProps {
|
||||||
id: ElementId
|
id: ElementId
|
||||||
source: ElementId
|
source: ElementId
|
||||||
target: ElementId
|
target: ElementId
|
||||||
@@ -14,8 +14,8 @@ interface BezierEdgeProps {
|
|||||||
targetY: number
|
targetY: number
|
||||||
selected?: boolean
|
selected?: boolean
|
||||||
animated?: boolean
|
animated?: boolean
|
||||||
sourcePosition?: Position
|
sourcePosition: Position
|
||||||
targetPosition?: Position
|
targetPosition: Position
|
||||||
label?:
|
label?:
|
||||||
| string
|
| string
|
||||||
| {
|
| {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import EdgeText from './EdgeText.vue'
|
import EdgeText from './EdgeText.vue'
|
||||||
import { getCenter, getMarkerEnd, getSmoothStepPath } from './utils'
|
import { getCenter, getMarkerEnd, getSmoothStepPath } from './utils'
|
||||||
import { ArrowHeadType, ElementId, Position } from '~/types'
|
import { ArrowHeadType, EdgeProps, ElementId, Position } from '~/types'
|
||||||
|
|
||||||
export interface EdgeSmoothStepProps {
|
interface SmoothStepEdgeProps extends EdgeProps {
|
||||||
id: ElementId
|
id: ElementId
|
||||||
source: ElementId
|
source: ElementId
|
||||||
target: ElementId
|
target: ElementId
|
||||||
@@ -13,8 +13,8 @@ export interface EdgeSmoothStepProps {
|
|||||||
targetY: number
|
targetY: number
|
||||||
selected?: boolean
|
selected?: boolean
|
||||||
animated?: boolean
|
animated?: boolean
|
||||||
sourcePosition?: Position
|
sourcePosition: Position
|
||||||
targetPosition?: Position
|
targetPosition: Position
|
||||||
label?:
|
label?:
|
||||||
| string
|
| string
|
||||||
| {
|
| {
|
||||||
@@ -35,7 +35,7 @@ export interface EdgeSmoothStepProps {
|
|||||||
targetHandleId?: ElementId | null
|
targetHandleId?: ElementId | null
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<EdgeSmoothStepProps>(), {
|
const props = withDefaults(defineProps<SmoothStepEdgeProps>(), {
|
||||||
selected: false,
|
selected: false,
|
||||||
sourcePosition: Position.Bottom,
|
sourcePosition: Position.Bottom,
|
||||||
targetPosition: Position.Top,
|
targetPosition: Position.Top,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import SmoothStepEdge from './SmoothStepEdge.vue'
|
import SmoothStepEdge from './SmoothStepEdge.vue'
|
||||||
import { ArrowHeadType, ElementId, Position } from '~/types'
|
import { ArrowHeadType, EdgeProps, ElementId, Position } from '~/types'
|
||||||
|
|
||||||
export interface EdgeStepProps {
|
export interface StepEdgeProps extends EdgeProps {
|
||||||
id: ElementId
|
id: ElementId
|
||||||
source: ElementId
|
source: ElementId
|
||||||
target: ElementId
|
target: ElementId
|
||||||
@@ -12,8 +12,8 @@ export interface EdgeStepProps {
|
|||||||
targetY: number
|
targetY: number
|
||||||
selected?: boolean
|
selected?: boolean
|
||||||
animated?: boolean
|
animated?: boolean
|
||||||
sourcePosition?: Position
|
sourcePosition: Position
|
||||||
targetPosition?: Position
|
targetPosition: Position
|
||||||
label?:
|
label?:
|
||||||
| string
|
| string
|
||||||
| {
|
| {
|
||||||
@@ -33,7 +33,7 @@ export interface EdgeStepProps {
|
|||||||
targetHandleId?: ElementId | null
|
targetHandleId?: ElementId | null
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<EdgeStepProps>(), {
|
const props = withDefaults(defineProps<StepEdgeProps>(), {
|
||||||
selected: false,
|
selected: false,
|
||||||
sourcePosition: Position.Bottom,
|
sourcePosition: Position.Bottom,
|
||||||
targetPosition: Position.Top,
|
targetPosition: Position.Top,
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import EdgeText from './EdgeText.vue'
|
import EdgeText from './EdgeText.vue'
|
||||||
import { getMarkerEnd, getBezierPath } from './utils'
|
import { getMarkerEnd, getBezierPath } from './utils'
|
||||||
import { ArrowHeadType, ElementId, Position } from '~/types'
|
import { ArrowHeadType, EdgeProps, ElementId, Position } from '~/types'
|
||||||
|
|
||||||
interface StraightEdgeProps {
|
interface StraightEdgeProps extends EdgeProps {
|
||||||
id: ElementId
|
id: ElementId
|
||||||
source: ElementId
|
source: ElementId
|
||||||
target: ElementId
|
target: ElementId
|
||||||
@@ -13,8 +13,8 @@ interface StraightEdgeProps {
|
|||||||
targetY: number
|
targetY: number
|
||||||
selected?: boolean
|
selected?: boolean
|
||||||
animated?: boolean
|
animated?: boolean
|
||||||
sourcePosition?: Position
|
sourcePosition: Position
|
||||||
targetPosition?: Position
|
targetPosition: Position
|
||||||
label?:
|
label?:
|
||||||
| string
|
| string
|
||||||
| {
|
| {
|
||||||
|
|||||||
+12
-22
@@ -1,4 +1,4 @@
|
|||||||
import { DefineComponent } from 'vue'
|
import { CSSProperties, DefineComponent } from 'vue'
|
||||||
import { ArrowHeadType, ElementId, Position } from './types'
|
import { ArrowHeadType, ElementId, Position } from './types'
|
||||||
|
|
||||||
export interface Edge<T = any> {
|
export interface Edge<T = any> {
|
||||||
@@ -6,8 +6,15 @@ export interface Edge<T = any> {
|
|||||||
type?: string
|
type?: string
|
||||||
source: ElementId
|
source: ElementId
|
||||||
target: ElementId
|
target: ElementId
|
||||||
|
sourceX: number
|
||||||
|
sourceY: number
|
||||||
|
targetX: number
|
||||||
|
targetY: number
|
||||||
sourceHandle?: ElementId | null
|
sourceHandle?: ElementId | null
|
||||||
targetHandle?: ElementId | null
|
targetHandle?: ElementId | null
|
||||||
|
selected?: boolean
|
||||||
|
sourcePosition?: Position
|
||||||
|
targetPosition?: Position
|
||||||
label?:
|
label?:
|
||||||
| string
|
| string
|
||||||
| {
|
| {
|
||||||
@@ -19,41 +26,24 @@ export interface Edge<T = any> {
|
|||||||
labelBgStyle?: any
|
labelBgStyle?: any
|
||||||
labelBgPadding?: [number, number]
|
labelBgPadding?: [number, number]
|
||||||
labelBgBorderRadius?: number
|
labelBgBorderRadius?: number
|
||||||
style?: any
|
style?: CSSProperties
|
||||||
animated?: boolean
|
animated?: boolean
|
||||||
arrowHeadType?: ArrowHeadType
|
arrowHeadType?: ArrowHeadType
|
||||||
isHidden?: boolean
|
markerEndId?: string
|
||||||
data?: T
|
data?: T
|
||||||
class?: string
|
class?: string
|
||||||
|
isHidden?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EdgeProps<T = any> {
|
export interface EdgeProps<T = any> extends Edge<T> {
|
||||||
id: ElementId
|
|
||||||
source: ElementId
|
|
||||||
target: ElementId
|
|
||||||
sourceX: number
|
sourceX: number
|
||||||
sourceY: number
|
sourceY: number
|
||||||
targetX: number
|
targetX: number
|
||||||
targetY: number
|
targetY: number
|
||||||
selected?: boolean
|
selected?: boolean
|
||||||
animated?: boolean
|
|
||||||
sourcePosition: Position
|
sourcePosition: Position
|
||||||
targetPosition: Position
|
targetPosition: Position
|
||||||
label?:
|
|
||||||
| string
|
|
||||||
| {
|
|
||||||
component: any
|
|
||||||
props?: any
|
|
||||||
}
|
|
||||||
labelStyle?: any
|
|
||||||
labelShowBg?: boolean
|
|
||||||
labelBgStyle?: any
|
|
||||||
labelBgPadding?: [number, number]
|
|
||||||
labelBgBorderRadius?: number
|
|
||||||
style?: any
|
|
||||||
arrowHeadType?: ArrowHeadType
|
|
||||||
markerEndId?: string
|
markerEndId?: string
|
||||||
data?: T
|
|
||||||
sourceHandleId?: ElementId | null
|
sourceHandleId?: ElementId | null
|
||||||
targetHandleId?: ElementId | null
|
targetHandleId?: ElementId | null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user