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 type { FunctionalComponent } from 'vue'
|
||||||
import BaseEdge from './BaseEdge'
|
import BaseEdge from './BaseEdge'
|
||||||
|
import type { BezierEdgeProps } from '~/types'
|
||||||
import { Position } 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 (
|
const BezierEdge: FunctionalComponent<BezierEdgeProps> = function (
|
||||||
{ sourcePosition = Position.Bottom, targetPosition = Position.Top, ...props },
|
{ sourcePosition = Position.Bottom, targetPosition = Position.Top, ...props },
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
import type { FunctionalComponent } from 'vue'
|
import type { FunctionalComponent } from 'vue'
|
||||||
import BaseEdge from './BaseEdge'
|
import BaseEdge from './BaseEdge'
|
||||||
|
import type { SimpleBezierEdgeProps } from '~/types'
|
||||||
import { Position } 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 (
|
const SimpleBezierEdge: FunctionalComponent<SimpleBezierEdgeProps> = function (
|
||||||
{ sourcePosition = Position.Bottom, targetPosition = Position.Top, ...props },
|
{ sourcePosition = Position.Bottom, targetPosition = Position.Top, ...props },
|
||||||
|
|||||||
@@ -1,13 +1,8 @@
|
|||||||
import type { FunctionalComponent } from 'vue'
|
import type { FunctionalComponent } from 'vue'
|
||||||
import BaseEdge from './BaseEdge'
|
import BaseEdge from './BaseEdge'
|
||||||
import type { BaseEdgeProps, EdgePositions, EdgeProps, SmoothStepPathOptions } from '~/types'
|
import type { SmoothStepEdgeProps } from '~/types'
|
||||||
import { Position } 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 (
|
const SmoothStepEdge: FunctionalComponent<SmoothStepEdgeProps> = function (
|
||||||
{ sourcePosition = Position.Bottom, targetPosition = Position.Top, ...props },
|
{ sourcePosition = Position.Bottom, targetPosition = Position.Top, ...props },
|
||||||
{ attrs },
|
{ attrs },
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
import type { FunctionalComponent } from 'vue'
|
import type { FunctionalComponent } from 'vue'
|
||||||
import SmoothStepEdge from './SmoothStepEdge'
|
import SmoothStepEdge from './SmoothStepEdge'
|
||||||
import type { BaseEdgeProps, EdgePositions, EdgeProps } from '~/types'
|
import type { StepEdgeProps } from '~/types'
|
||||||
|
|
||||||
export type StepEdgeProps = EdgePositions &
|
|
||||||
Omit<BaseEdgeProps, 'labelX' | 'labelY' | 'path'> &
|
|
||||||
Pick<EdgeProps, 'sourcePosition' | 'targetPosition'>
|
|
||||||
|
|
||||||
const StepEdge: FunctionalComponent<StepEdgeProps> = function (props, { attrs }) {
|
const StepEdge: FunctionalComponent<StepEdgeProps> = function (props, { attrs }) {
|
||||||
return h(SmoothStepEdge, { ...props, ...attrs, borderRadius: 0 })
|
return h(SmoothStepEdge, { ...props, ...attrs, borderRadius: 0 })
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import type { FunctionalComponent } from 'vue'
|
import type { FunctionalComponent } from 'vue'
|
||||||
import BaseEdge from './BaseEdge'
|
import BaseEdge from './BaseEdge'
|
||||||
import type { BaseEdgeProps, EdgePositions } from '~/types'
|
import type { StraightEdgeProps } from '~/types'
|
||||||
|
|
||||||
export type StraightEdgeProps = EdgePositions & Omit<BaseEdgeProps, 'labelX' | 'labelY' | 'path'>
|
|
||||||
|
|
||||||
const StraightEdge: FunctionalComponent<StraightEdgeProps> = function (props, { attrs }) {
|
const StraightEdge: FunctionalComponent<StraightEdgeProps> = function (props, { attrs }) {
|
||||||
const [path, labelX, labelY] = getStraightPath(props)
|
const [path, labelX, labelY] = getStraightPath(props)
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
export { default as BaseEdge } from './BaseEdge'
|
export { default as BaseEdge } from './BaseEdge'
|
||||||
export { default as BezierEdge, BezierEdgeProps } from './BezierEdge'
|
export { default as BezierEdge } from './BezierEdge'
|
||||||
export { default as SimpleBezierEdge, SimpleBezierEdgeProps } from './SimpleBezierEdge'
|
export { default as SimpleBezierEdge } from './SimpleBezierEdge'
|
||||||
export { default as StepEdge, StepEdgeProps } from './StepEdge'
|
export { default as StepEdge } from './StepEdge'
|
||||||
export { default as SmoothStepEdge, SmoothStepEdgeProps } from './SmoothStepEdge'
|
export { default as SmoothStepEdge } from './SmoothStepEdge'
|
||||||
export { default as StraightEdge, StraightEdgeProps } from './StraightEdge'
|
export { default as StraightEdge } from './StraightEdge'
|
||||||
export { default as EdgeAnchor } from './EdgeAnchor'
|
export { default as EdgeAnchor } from './EdgeAnchor'
|
||||||
export { default as EdgeText } from './EdgeText.vue'
|
export { default as EdgeText } from './EdgeText.vue'
|
||||||
export { default as EdgeWrapper } from './EdgeWrapper'
|
export { default as EdgeWrapper } from './EdgeWrapper'
|
||||||
|
|||||||
@@ -11,15 +11,10 @@ export { default as Panel } from './components/Panel/Panel.vue'
|
|||||||
|
|
||||||
export {
|
export {
|
||||||
StraightEdge,
|
StraightEdge,
|
||||||
StraightEdgeProps,
|
|
||||||
StepEdge,
|
StepEdge,
|
||||||
StepEdgeProps,
|
|
||||||
BezierEdge,
|
BezierEdge,
|
||||||
BezierEdgeProps,
|
|
||||||
SimpleBezierEdge,
|
SimpleBezierEdge,
|
||||||
SimpleBezierEdgeProps,
|
|
||||||
SmoothStepEdge,
|
SmoothStepEdge,
|
||||||
SmoothStepEdgeProps,
|
|
||||||
BaseEdge,
|
BaseEdge,
|
||||||
EdgeText,
|
EdgeText,
|
||||||
EdgeLabelRenderer,
|
EdgeLabelRenderer,
|
||||||
|
|||||||
@@ -188,3 +188,23 @@ export interface BaseEdgeProps extends EdgeLabelOptions {
|
|||||||
markerEnd?: string
|
markerEnd?: string
|
||||||
interactionWidth?: number
|
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