fix!: prop typings
* remove wrapper exports from library Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -17,10 +17,10 @@ interface ConnectionLineProps {
|
|||||||
vf: VFInternals
|
vf: VFInternals
|
||||||
connectionLineType?: ConnectionLineType
|
connectionLineType?: ConnectionLineType
|
||||||
connectionLineStyle?: CSSProperties
|
connectionLineStyle?: CSSProperties
|
||||||
connectionHandleId: ElementId
|
connectionHandleId?: ElementId
|
||||||
connectionNodeId: ElementId
|
connectionNodeId?: ElementId
|
||||||
connectionHandleType: HandleType
|
connectionHandleType?: HandleType
|
||||||
connectionPosition: XYPosition
|
connectionPosition?: XYPosition
|
||||||
connectionMode: ConnectionMode
|
connectionMode: ConnectionMode
|
||||||
transform: Transform
|
transform: Transform
|
||||||
}
|
}
|
||||||
@@ -42,8 +42,8 @@ const sourceY = props.vf.position.y + sourceHandleY
|
|||||||
const isRightOrLeft = sourceHandle?.position === Position.Left || sourceHandle?.position === Position.Right
|
const isRightOrLeft = sourceHandle?.position === Position.Left || sourceHandle?.position === Position.Right
|
||||||
const targetPosition = isRightOrLeft ? Position.Left : Position.Top
|
const targetPosition = isRightOrLeft ? Position.Left : Position.Top
|
||||||
|
|
||||||
const targetX = computed(() => (props.connectionPosition.x - props.transform[0]) / props.transform[2])
|
const targetX = computed(() => (props.connectionPosition?.x || 0 - props.transform[0]) / props.transform[2])
|
||||||
const targetY = computed(() => (props.connectionPosition.y - props.transform[1]) / props.transform[2])
|
const targetY = computed(() => (props.connectionPosition?.y || 0 - props.transform[1]) / props.transform[2])
|
||||||
|
|
||||||
const dAttr = computed(() => {
|
const dAttr = computed(() => {
|
||||||
let path = `M${sourceX},${sourceY} ${targetX.value},${targetY.value}`
|
let path = `M${sourceX},${sourceY} ${targetX.value},${targetY.value}`
|
||||||
|
|||||||
@@ -4,4 +4,3 @@ export { default as SmoothStepEdge } from './SmoothStepEdge.vue'
|
|||||||
export { default as StraightEdge } from './StraightEdge.vue'
|
export { default as StraightEdge } from './StraightEdge.vue'
|
||||||
export { default as EdgeAnchor } from './EdgeAnchor.vue'
|
export { default as EdgeAnchor } from './EdgeAnchor.vue'
|
||||||
export { default as EdgeText } from './EdgeText.vue'
|
export { default as EdgeText } from './EdgeText.vue'
|
||||||
export { default as EdgeWrapper } from './EdgeWrapper.vue'
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
export { default as DefaultNode } from './DefaultNode.vue'
|
export { default as DefaultNode } from './DefaultNode.vue'
|
||||||
export { default as InputNode } from './InputNode.vue'
|
export { default as InputNode } from './InputNode.vue'
|
||||||
export { default as OutputNode } from './OutputNode.vue'
|
export { default as OutputNode } from './OutputNode.vue'
|
||||||
export { default as NodeWrapper } from './NodeWrapper.vue'
|
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ import { onLoadToObject, initialState } from '~/utils'
|
|||||||
|
|
||||||
let id = 0
|
let id = 0
|
||||||
export default (options?: Partial<FlowOptions>, key?: string) => {
|
export default (options?: Partial<FlowOptions>, key?: string) => {
|
||||||
let store = inject(Store, null)
|
let store = inject(Store, undefined)
|
||||||
|
|
||||||
if (!store) {
|
if (!store) {
|
||||||
const withStorage = options?.storageKey ?? key ?? false
|
const withStorage = options?.storageKey ?? key ?? false
|
||||||
if (import.meta.env.DEV) console.warn('store context not found; creating default store')
|
if (import.meta.env.DEV) console.warn('store context not found; creating default store')
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ const props = withDefaults(defineProps<EdgeRendererProps>(), {
|
|||||||
edgeUpdaterRadius: 10,
|
edgeUpdaterRadius: 10,
|
||||||
})
|
})
|
||||||
|
|
||||||
const getType = (type: string) => {
|
const getType = (type?: string) => {
|
||||||
const t = type ?? 'default'
|
const t = type ?? 'default'
|
||||||
let edgeType = props.edgeTypes[t]
|
let edgeType = props.edgeTypes[t]
|
||||||
if (!edgeType) {
|
if (!edgeType) {
|
||||||
@@ -124,10 +124,10 @@ export default {
|
|||||||
</EdgeWrapper>
|
</EdgeWrapper>
|
||||||
<ConnectionLine
|
<ConnectionLine
|
||||||
v-if="connectionLineVisible && sourceNode"
|
v-if="connectionLineVisible && sourceNode"
|
||||||
|
:vf="sourceNode?.__vf"
|
||||||
:connection-line-style="props.connectionLineStyle"
|
:connection-line-style="props.connectionLineStyle"
|
||||||
:connection-line-type="props.connectionLineType"
|
:connection-line-type="props.connectionLineType"
|
||||||
:connection-handle-id="props.connectionHandleId"
|
:connection-handle-id="props.connectionHandleId"
|
||||||
:vf="sourceNode?.__vf"
|
|
||||||
:connection-node-id="props.connectionNodeId"
|
:connection-node-id="props.connectionNodeId"
|
||||||
:connection-handle-type="props.connectionHandleType"
|
:connection-handle-type="props.connectionHandleType"
|
||||||
:connection-position="props.connectionPosition"
|
:connection-position="props.connectionPosition"
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const props = withDefaults(defineProps<NodeRendererProps>(), {
|
|||||||
snapGrid: () => [15, 15],
|
snapGrid: () => [15, 15],
|
||||||
})
|
})
|
||||||
|
|
||||||
const getType = (type: string) => {
|
const getType = (type?: string) => {
|
||||||
const t = type ?? 'default'
|
const t = type ?? 'default'
|
||||||
let nodeType = props.nodeTypes[t]
|
let nodeType = props.nodeTypes[t]
|
||||||
if (!nodeType) {
|
if (!nodeType) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import UserSelection from '../../components/UserSelection/UserSelection.vue'
|
|||||||
|
|
||||||
interface SelectionPaneProps {
|
interface SelectionPaneProps {
|
||||||
edges: Edge[]
|
edges: Edge[]
|
||||||
selectedElements: FlowElements
|
selectedElements?: FlowElements
|
||||||
selectionKeyCode?: KeyCode
|
selectionKeyCode?: KeyCode
|
||||||
deleteKeyCode?: KeyCode
|
deleteKeyCode?: KeyCode
|
||||||
multiSelectionKeyCode?: KeyCode
|
multiSelectionKeyCode?: KeyCode
|
||||||
@@ -20,6 +20,7 @@ const props = withDefaults(defineProps<SelectionPaneProps>(), {
|
|||||||
deleteKeyCode: 'Backspace',
|
deleteKeyCode: 'Backspace',
|
||||||
multiSelectionKeyCode: 'Meta',
|
multiSelectionKeyCode: 'Meta',
|
||||||
elementsSelectable: true,
|
elementsSelectable: true,
|
||||||
|
selectedElements: () => [],
|
||||||
})
|
})
|
||||||
|
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ const transitionName = computed(() => {
|
|||||||
#[`node-${nodeName}`]="nodeProps"
|
#[`node-${nodeName}`]="nodeProps"
|
||||||
:key="`node-${nodeName}-${store.$id}`"
|
:key="`node-${nodeName}-${store.$id}`"
|
||||||
>
|
>
|
||||||
<slot :name="`node-${nodeName}`" v-bind="nodeProps"></slot>
|
<slot :name="`node-${nodeName}`" v-bind="nodeProps" />
|
||||||
</template>
|
</template>
|
||||||
</NodeRenderer>
|
</NodeRenderer>
|
||||||
</slot>
|
</slot>
|
||||||
@@ -253,14 +253,14 @@ const transitionName = computed(() => {
|
|||||||
#[`edge-${edgeName}`]="edgeProps"
|
#[`edge-${edgeName}`]="edgeProps"
|
||||||
:key="`edge-${edgeName}-${store.$id}`"
|
:key="`edge-${edgeName}-${store.$id}`"
|
||||||
>
|
>
|
||||||
<slot :name="`edge-${edgeName}`" v-bind="edgeProps"></slot>
|
<slot :name="`edge-${edgeName}`" v-bind="edgeProps" />
|
||||||
</template>
|
</template>
|
||||||
<template #custom-connection-line="customConnectionLineProps">
|
<template #custom-connection-line="customConnectionLineProps">
|
||||||
<slot
|
<slot
|
||||||
:key="`connection-line-${store.$id}`"
|
:key="`connection-line-${store.$id}`"
|
||||||
name="custom-connection-line"
|
name="custom-connection-line"
|
||||||
v-bind="customConnectionLineProps"
|
v-bind="customConnectionLineProps"
|
||||||
></slot>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</EdgeRenderer>
|
</EdgeRenderer>
|
||||||
</slot>
|
</slot>
|
||||||
|
|||||||
@@ -209,7 +209,11 @@ export default {
|
|||||||
<div ref="zoomPane" class="vue-flow__renderer vue-flow__zoompane">
|
<div ref="zoomPane" class="vue-flow__renderer vue-flow__zoompane">
|
||||||
<slot
|
<slot
|
||||||
v-bind="{
|
v-bind="{
|
||||||
transform,
|
transform: [
|
||||||
|
clamp(transform.x, store.translateExtent[0][0], store.translateExtent[1][0]),
|
||||||
|
clamp(transform.y, store.translateExtent[0][0], store.translateExtent[1][0]),
|
||||||
|
clamp(transform.zoom, store.translateExtent[0][0], store.translateExtent[1][0]),
|
||||||
|
],
|
||||||
dimensions: { width, height },
|
dimensions: { width, height },
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user