refactor(components): Use plugin to import prop types
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -1,16 +1,10 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { BackgroundVariant } from '../../types'
|
import { BackgroundVariant } from '../../types'
|
||||||
import { useVueFlow } from '../../composables'
|
import { useVueFlow } from '../../composables'
|
||||||
|
import type { BackgroundProps } from '../../types/components'
|
||||||
interface BackgroundProps {
|
|
||||||
variant?: BackgroundVariant
|
|
||||||
gap?: number
|
|
||||||
color?: string
|
|
||||||
size?: number
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<BackgroundProps>(), {
|
const props = withDefaults(defineProps<BackgroundProps>(), {
|
||||||
variant: BackgroundVariant.Dots,
|
variant: 'dots' as BackgroundVariant,
|
||||||
gap: 10,
|
gap: 10,
|
||||||
size: 0.4,
|
size: 0.4,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { FitViewParams } from '../../types'
|
|
||||||
import { useZoomPanHelper, useVueFlow } from '../../composables'
|
import { useZoomPanHelper, useVueFlow } from '../../composables'
|
||||||
|
import type { ControlProps, ControlEvents } from '../../types/components'
|
||||||
import ControlButton from './ControlButton.vue'
|
import ControlButton from './ControlButton.vue'
|
||||||
import PlusIcon from '~/assets/icons/plus.svg'
|
import PlusIcon from '~/assets/icons/plus.svg'
|
||||||
import MinusIcon from '~/assets/icons/minus.svg'
|
import MinusIcon from '~/assets/icons/minus.svg'
|
||||||
@@ -8,20 +8,6 @@ import Fitview from '~/assets/icons/fitview.svg'
|
|||||||
import Lock from '~/assets/icons/lock.svg'
|
import Lock from '~/assets/icons/lock.svg'
|
||||||
import Unlock from '~/assets/icons/unlock.svg'
|
import Unlock from '~/assets/icons/unlock.svg'
|
||||||
|
|
||||||
interface ControlProps {
|
|
||||||
showZoom?: boolean
|
|
||||||
showFitView?: boolean
|
|
||||||
showInteractive?: boolean
|
|
||||||
fitViewParams?: FitViewParams
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ControlEvents {
|
|
||||||
(event: 'zoom-in'): void
|
|
||||||
(event: 'zoom-out'): void
|
|
||||||
(event: 'fit-view'): void
|
|
||||||
(event: 'interaction-change', active: boolean): void
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<ControlProps>(), {
|
const props = withDefaults(defineProps<ControlProps>(), {
|
||||||
showZoom: true,
|
showZoom: true,
|
||||||
showFitView: true,
|
showFitView: true,
|
||||||
|
|||||||
@@ -2,18 +2,9 @@
|
|||||||
import { GraphNode, ShapeRendering } from '../../types'
|
import { GraphNode, ShapeRendering } from '../../types'
|
||||||
import { useVueFlow, useWindow } from '../../composables'
|
import { useVueFlow, useWindow } from '../../composables'
|
||||||
import { getBoundsofRects, getRectOfNodes } from '../../utils'
|
import { getBoundsofRects, getRectOfNodes } from '../../utils'
|
||||||
|
import type { MiniMapProps } from '../../types/components'
|
||||||
import MiniMapNode from './MiniMapNode.vue'
|
import MiniMapNode from './MiniMapNode.vue'
|
||||||
|
|
||||||
type StringFunc = (node: GraphNode) => string
|
|
||||||
interface MiniMapProps {
|
|
||||||
nodeColor?: string | StringFunc
|
|
||||||
nodeStrokeColor?: string | StringFunc
|
|
||||||
nodeClassName?: string | StringFunc
|
|
||||||
nodeBorderRadius?: number
|
|
||||||
nodeStrokeWidth?: number
|
|
||||||
maskColor?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<MiniMapProps>(), {
|
const props = withDefaults(defineProps<MiniMapProps>(), {
|
||||||
nodeStrokeColor: '#555',
|
nodeStrokeColor: '#555',
|
||||||
nodeColor: '#fff',
|
nodeColor: '#fff',
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ export type StringFunc<N = any> = (node: Node<N> | GraphNode<N>) => string
|
|||||||
export type ShapeRendering = 'inherit' | 'auto' | 'geometricPrecision' | 'optimizeSpeed' | 'crispEdges' | undefined
|
export type ShapeRendering = 'inherit' | 'auto' | 'geometricPrecision' | 'optimizeSpeed' | 'crispEdges' | undefined
|
||||||
|
|
||||||
export interface MiniMapProps<N = any> {
|
export interface MiniMapProps<N = any> {
|
||||||
nodeColor?: string | StringFunc<N>
|
nodeColor?: string | ((node: Node<N> | GraphNode<N>) => string)
|
||||||
nodeStrokeColor?: string | StringFunc<N>
|
nodeStrokeColor?: string | ((node: Node<N> | GraphNode<N>) => string)
|
||||||
nodeClassName?: string | StringFunc<N>
|
nodeClassName?: string | ((node: Node<N> | GraphNode<N>) => string)
|
||||||
nodeBorderRadius?: number
|
nodeBorderRadius?: number
|
||||||
nodeStrokeWidth?: number
|
nodeStrokeWidth?: number
|
||||||
maskColor?: string
|
maskColor?: string
|
||||||
@@ -87,7 +87,7 @@ export interface EdgeTextProps {
|
|||||||
labelBgBorderRadius?: number
|
labelBgBorderRadius?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CustomConnectionLineProps<N = any> {
|
export interface ConnectionLineProps<N = any> {
|
||||||
sourceX: number
|
sourceX: number
|
||||||
sourceY: number
|
sourceY: number
|
||||||
sourcePosition: Position
|
sourcePosition: Position
|
||||||
|
|||||||
Reference in New Issue
Block a user