refactor(core): move edge prop types
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
import type { FunctionalComponent } from 'vue'
|
||||
import BaseEdge from './BaseEdge'
|
||||
import type { BezierEdgeProps } from '~/types'
|
||||
import { Position } from '~/types'
|
||||
import type { BaseEdgeProps, BezierPathOptions, EdgePositions, EdgeProps } from '~/types'
|
||||
|
||||
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 },
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import type { FunctionalComponent } from 'vue'
|
||||
import BaseEdge from './BaseEdge'
|
||||
import type { SimpleBezierEdgeProps } from '~/types'
|
||||
import { Position } from '~/types'
|
||||
import type { BaseEdgeProps, EdgePositions, EdgeProps } from '~/types'
|
||||
|
||||
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 },
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
import type { FunctionalComponent } from 'vue'
|
||||
import BaseEdge from './BaseEdge'
|
||||
import type { BaseEdgeProps, EdgePositions, EdgeProps, SmoothStepPathOptions } from '~/types'
|
||||
import type { SmoothStepEdgeProps } 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 },
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import type { FunctionalComponent } from 'vue'
|
||||
import SmoothStepEdge from './SmoothStepEdge'
|
||||
import type { BaseEdgeProps, EdgePositions, EdgeProps } from '~/types'
|
||||
|
||||
export type StepEdgeProps = EdgePositions &
|
||||
Omit<BaseEdgeProps, 'labelX' | 'labelY' | 'path'> &
|
||||
Pick<EdgeProps, 'sourcePosition' | 'targetPosition'>
|
||||
import type { StepEdgeProps } from '~/types'
|
||||
|
||||
const StepEdge: FunctionalComponent<StepEdgeProps> = function (props, { attrs }) {
|
||||
return h(SmoothStepEdge, { ...props, ...attrs, borderRadius: 0 })
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import type { FunctionalComponent } from 'vue'
|
||||
import BaseEdge from './BaseEdge'
|
||||
import type { BaseEdgeProps, EdgePositions } from '~/types'
|
||||
|
||||
export type StraightEdgeProps = EdgePositions & Omit<BaseEdgeProps, 'labelX' | 'labelY' | 'path'>
|
||||
import type { StraightEdgeProps } from '~/types'
|
||||
|
||||
const StraightEdge: FunctionalComponent<StraightEdgeProps> = function (props, { attrs }) {
|
||||
const [path, labelX, labelY] = getStraightPath(props)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
export { default as BaseEdge } from './BaseEdge'
|
||||
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 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 EdgeAnchor } from './EdgeAnchor'
|
||||
export { default as EdgeText } from './EdgeText.vue'
|
||||
export { default as EdgeWrapper } from './EdgeWrapper'
|
||||
|
||||
@@ -11,15 +11,10 @@ export { default as Panel } from './components/Panel/Panel.vue'
|
||||
|
||||
export {
|
||||
StraightEdge,
|
||||
StraightEdgeProps,
|
||||
StepEdge,
|
||||
StepEdgeProps,
|
||||
BezierEdge,
|
||||
BezierEdgeProps,
|
||||
SimpleBezierEdge,
|
||||
SimpleBezierEdgeProps,
|
||||
SmoothStepEdge,
|
||||
SmoothStepEdgeProps,
|
||||
BaseEdge,
|
||||
EdgeText,
|
||||
EdgeLabelRenderer,
|
||||
|
||||
@@ -188,3 +188,23 @@ export interface BaseEdgeProps extends EdgeLabelOptions {
|
||||
markerEnd?: string
|
||||
interactionWidth?: number
|
||||
}
|
||||
|
||||
export type BezierEdgeProps = EdgePositions &
|
||||
BezierPathOptions &
|
||||
Omit<BaseEdgeProps, 'labelX' | 'labelY' | 'path'> &
|
||||
Pick<EdgeProps, 'sourcePosition' | 'targetPosition'>
|
||||
|
||||
export type SimpleBezierEdgeProps = EdgePositions &
|
||||
Omit<BaseEdgeProps, 'labelX' | 'labelY' | 'path'> &
|
||||
Pick<EdgeProps, 'sourcePosition' | 'targetPosition'>
|
||||
|
||||
export type StraightEdgeProps = EdgePositions & Omit<BaseEdgeProps, 'labelX' | 'labelY' | 'path'>
|
||||
|
||||
export type StepEdgeProps = EdgePositions &
|
||||
Omit<BaseEdgeProps, 'labelX' | 'labelY' | 'path'> &
|
||||
Pick<EdgeProps, 'sourcePosition' | 'targetPosition'>
|
||||
|
||||
export type SmoothStepEdgeProps = EdgePositions &
|
||||
Omit<BaseEdgeProps, 'labelX' | 'labelY' | 'path'> &
|
||||
Pick<EdgeProps, 'sourcePosition' | 'targetPosition'> &
|
||||
SmoothStepPathOptions
|
||||
|
||||
Reference in New Issue
Block a user