fix(core,edges): correct edge component prop types

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2022-12-29 09:32:27 +01:00
committed by Braks
parent da9ec23188
commit 608f797527
9 changed files with 44 additions and 35 deletions
@@ -1,9 +1,14 @@
import type { FunctionalComponent } from 'vue'
import BaseEdge from './BaseEdge'
import { Position } from '~/types'
import type { EdgeProps } from '~/types'
import type { BaseEdgeProps, BezierPathOptions, EdgePositions, EdgeProps } from '~/types'
const BezierEdge: FunctionalComponent<EdgeProps> = function (
export type BezierEdgeProps = EdgePositions &
BezierPathOptions &
Omit<BaseEdgeProps, 'labelX' | 'labelY' | 'path'> &
Pick<EdgeProps, 'sourcePosition' | 'targetPosition'>
const BezierEdge: FunctionalComponent<BezierEdgeProps> = function (
{ sourcePosition = Position.Bottom, targetPosition = Position.Top, ...props },
{ attrs },
) {
@@ -1,9 +1,13 @@
import type { FunctionalComponent } from 'vue'
import BaseEdge from './BaseEdge'
import { Position } from '~/types'
import type { EdgeProps } from '~/types'
import type { BaseEdgeProps, EdgePositions, EdgeProps } from '~/types'
const SimpleBezierEdge: FunctionalComponent<EdgeProps> = function (
export type SimpleBezierEdgeProps = EdgePositions &
Omit<BaseEdgeProps, 'labelX' | 'labelY' | 'path'> &
Pick<EdgeProps, 'sourcePosition' | 'targetPosition'>
const SimpleBezierEdge: FunctionalComponent<SimpleBezierEdgeProps> = function (
{ sourcePosition = Position.Bottom, targetPosition = Position.Top, ...props },
{ attrs },
) {
@@ -1,8 +1,13 @@
import type { FunctionalComponent } from 'vue'
import BaseEdge from './BaseEdge'
import type { SmoothStepEdgeProps } from '~/types'
import type { BaseEdgeProps, EdgePositions, EdgeProps, SmoothStepPathOptions } from '~/types'
import { Position } from '~/types'
export type SmoothStepEdgeProps = EdgePositions &
Omit<BaseEdgeProps, 'labelX' | 'labelY' | 'path'> &
Pick<EdgeProps, 'sourcePosition' | 'targetPosition'> &
SmoothStepPathOptions
const SmoothStepEdge: FunctionalComponent<SmoothStepEdgeProps> = function (
{ sourcePosition = Position.Bottom, targetPosition = Position.Top, ...props },
{ attrs },
@@ -39,6 +44,7 @@ SmoothStepEdge.props = [
'markerEnd',
'markerStart',
'interactionWidth',
'offset',
]
SmoothStepEdge.inheritAttrs = false
@@ -1,8 +1,12 @@
import type { FunctionalComponent } from 'vue'
import SmoothStepEdge from './SmoothStepEdge'
import type { EdgeProps } from '~/types'
import type { BaseEdgeProps, EdgePositions, EdgeProps } from '~/types'
const StepEdge: FunctionalComponent<EdgeProps> = function (props, { attrs }) {
export type StepEdgeProps = EdgePositions &
Omit<BaseEdgeProps, 'labelX' | 'labelY' | 'path'> &
Pick<EdgeProps, 'sourcePosition' | 'targetPosition'>
const StepEdge: FunctionalComponent<StepEdgeProps> = function (props, { attrs }) {
return h(SmoothStepEdge, { ...props, ...attrs, borderRadius: 0 })
}
@@ -1,8 +1,10 @@
import type { FunctionalComponent } from 'vue'
import BaseEdge from './BaseEdge'
import type { EdgeProps } from '~/types'
import type { BaseEdgeProps, EdgePositions } from '~/types'
const StraightEdge: FunctionalComponent<EdgeProps> = function (props, { attrs }) {
export type StraightEdgeProps = EdgePositions & Omit<BaseEdgeProps, 'labelX' | 'labelY' | 'path'>
const StraightEdge: FunctionalComponent<StraightEdgeProps> = function (props, { attrs }) {
const [path, labelX, labelY] = getStraightPath(props)
return h(BaseEdge, {
+5 -5
View File
@@ -1,9 +1,9 @@
export { default as BaseEdge } from './BaseEdge'
export { default as BezierEdge } from './BezierEdge'
export { default as SimpleBezierEdge } from './SimpleBezierEdge'
export { default as StepEdge } from './StepEdge'
export { default as SmoothStepEdge } from './SmoothStepEdge'
export { default as StraightEdge } from './StraightEdge'
export { default as BezierEdge, BezierEdgeProps } from './BezierEdge'
export { default as SimpleBezierEdge, SimpleBezierEdgeProps } from './SimpleBezierEdge'
export { default as StepEdge, StepEdgeProps } from './StepEdge'
export { default as SmoothStepEdge, SmoothStepEdgeProps } from './SmoothStepEdge'
export { default as StraightEdge, StraightEdgeProps } from './StraightEdge'
export { default as EdgeAnchor } from './EdgeAnchor'
export { default as EdgeText } from './EdgeText.vue'
export { default as EdgeWrapper } from './EdgeWrapper'