Added docs for type EdgeUpdatable
Implemented type EdgeUdatable in global configuration for VueFlow instance
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { CSSProperties, Component, FunctionalComponent, VNode } from 'vue'
|
||||
import EdgeAnchor from './EdgeAnchor'
|
||||
import type { EdgeComponent, EdgeEventsOn, EdgeMarkerType, EdgeTextProps, GraphNode, Updatable } from '~/types'
|
||||
import type { EdgeComponent, EdgeEventsOn, EdgeMarkerType, EdgeTextProps, GraphNode, EdgeUpdatable } from '~/types'
|
||||
import { ConnectionMode, Position } from '~/types'
|
||||
import { getEdgePositions, getHandle, getMarkerId } from '~/utils'
|
||||
|
||||
@@ -15,7 +15,7 @@ interface Props {
|
||||
targetHandleId?: string | null
|
||||
sourceHandleId?: string | null
|
||||
selectable?: boolean
|
||||
updatable?: Updatable
|
||||
updatable?: EdgeUpdatable
|
||||
label?: string | VNode | Component<EdgeTextProps> | Object
|
||||
data?: any
|
||||
events: EdgeEventsOn
|
||||
@@ -156,7 +156,7 @@ const Wrapper: FunctionalComponent<Props> = function (
|
||||
targetHandleId,
|
||||
}),
|
||||
[
|
||||
updatable == 'source' || updatable == true ? [ h(
|
||||
updatable === 'source' || updatable === true ? [ h(
|
||||
'g',
|
||||
{
|
||||
onMousedown: onEdgeUpdaterSourceMouseDown,
|
||||
@@ -170,7 +170,7 @@ const Wrapper: FunctionalComponent<Props> = function (
|
||||
radius: edgeUpdaterRadius,
|
||||
}),
|
||||
)] : null,
|
||||
updatable == 'target' || updatable == true ? [ h(
|
||||
updatable === 'target' || updatable === true ? [ h(
|
||||
'g',
|
||||
{
|
||||
onMousedown: onEdgeUpdaterTargetMouseDown,
|
||||
|
||||
@@ -4,7 +4,7 @@ import EdgeWrapper from '../../components/Edges/Wrapper'
|
||||
import ConnectionLine from '../../components/ConnectionLine/ConnectionLine.vue'
|
||||
import { useEdgeHooks, useHandle, useVueFlow } from '../../composables'
|
||||
import { connectionExists, groupEdgesByZLevel } from '../../utils'
|
||||
import type { EdgeComponent, GraphEdge } from '../../types'
|
||||
import type { EdgeComponent, EdgeUpdatable, GraphEdge } from '../../types'
|
||||
import { Slots } from '../../context'
|
||||
import MarkerDefinitions from './MarkerDefinitions.vue'
|
||||
|
||||
@@ -32,7 +32,7 @@ const {
|
||||
} = $(useVueFlow())
|
||||
|
||||
const selectable = (s?: boolean) => (typeof s === 'undefined' ? elementsSelectable : s)
|
||||
const updatable = (u?: boolean) => (typeof u === 'undefined' ? edgesUpdatable : u)
|
||||
const updatable = (u?: EdgeUpdatable) => (typeof u === 'undefined' ? edgesUpdatable : u)
|
||||
|
||||
const sourceNode = $(
|
||||
controlledComputed($$(connectionNodeId), () => {
|
||||
|
||||
@@ -43,7 +43,7 @@ export interface MarkerProps {
|
||||
|
||||
export type EdgeMarkerType = string | MarkerType | EdgeMarker
|
||||
|
||||
export type Updatable = boolean | 'target' | 'source'
|
||||
export type EdgeUpdatable = boolean | 'target' | 'source'
|
||||
|
||||
export interface Edge<Data = ElementData, CustomEvents extends Record<string, CustomEvent> = any> {
|
||||
/** Unique edge id */
|
||||
@@ -77,7 +77,7 @@ export interface Edge<Data = ElementData, CustomEvents extends Record<string, Cu
|
||||
/** EdgeMarker */
|
||||
markerEnd?: EdgeMarkerType
|
||||
/** Disable/enable updating edge */
|
||||
updatable?: boolean
|
||||
updatable?: EdgeUpdatable
|
||||
/** Disable/enable selecting edge */
|
||||
selectable?: boolean
|
||||
/** Additional class names, can be a string or a callback returning a string (receives current flow element) */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { CSSProperties } from 'vue'
|
||||
import type { KeyFilter } from '@vueuse/core'
|
||||
import type { DefaultEdgeOptions, Edge, GraphEdge } from './edge'
|
||||
import type { DefaultEdgeOptions, Edge, EdgeUpdatable, GraphEdge } from './edge'
|
||||
import type { CoordinateExtent, GraphNode, Node } from './node'
|
||||
import type { ConnectionLineOptions, ConnectionLineType, ConnectionMode, Connector } from './connection'
|
||||
import type { PanOnScrollMode } from './zoom'
|
||||
@@ -98,7 +98,7 @@ export interface FlowProps {
|
||||
snapToGrid?: boolean
|
||||
snapGrid?: SnapGrid
|
||||
onlyRenderVisibleElements?: boolean
|
||||
edgesUpdatable?: boolean
|
||||
edgesUpdatable?: EdgeUpdatable
|
||||
nodesDraggable?: boolean
|
||||
nodesConnectable?: boolean
|
||||
elementsSelectable?: boolean
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { KeyFilter } from '@vueuse/core'
|
||||
import type { Dimensions, Elements, FlowElements, FlowExportObject, FlowOptions, SnapGrid, XYPosition } from './flow'
|
||||
import type { DefaultEdgeTypes, DefaultNodeTypes, EdgeComponent, NodeComponent } from './components'
|
||||
import type { Connection, ConnectionLineOptions, ConnectionLineType, ConnectionMode, Connector } from './connection'
|
||||
import type { DefaultEdgeOptions, Edge, GraphEdge } from './edge'
|
||||
import type { DefaultEdgeOptions, Edge, EdgeUpdatable, GraphEdge } from './edge'
|
||||
import type { CoordinateExtent, GraphNode, Node } from './node'
|
||||
import type { D3Selection, D3Zoom, D3ZoomHandler, PanOnScrollMode, Viewport, ViewportFunctions } from './zoom'
|
||||
import type { FlowHooks, FlowHooksEmit, FlowHooksOn } from './hooks'
|
||||
@@ -79,7 +79,7 @@ export interface State extends Omit<FlowOptions, 'id' | 'modelValue'> {
|
||||
snapGrid: SnapGrid
|
||||
defaultMarkerColor: string
|
||||
|
||||
edgesUpdatable: boolean
|
||||
edgesUpdatable: EdgeUpdatable
|
||||
nodesDraggable: boolean
|
||||
nodesConnectable: boolean
|
||||
|
||||
|
||||
Reference in New Issue
Block a user