diff --git a/packages/nc-gui/components/erd/Flow.vue b/packages/nc-gui/components/erd/Flow.vue index bca1db9966..8a75272030 100644 --- a/packages/nc-gui/components/erd/Flow.vue +++ b/packages/nc-gui/components/erd/Flow.vue @@ -19,7 +19,7 @@ const { $destroy, fitView, onPaneReady, viewport, onNodeDoubleClick } = useVueFl const { layout, elements } = useErdElements(tables, config) -const showSkeleton = computed(() => viewport.value.zoom < 0.25) +const showSkeleton = computed(() => viewport.value.zoom < 0.2) function init() { layout(showSkeleton.value) @@ -29,10 +29,16 @@ function init() { } function zoomIn(nodeId?: string) { - fitView({ nodes: nodeId ? [nodeId] : undefined, duration: 300, minZoom: 0.4 }) + fitView({ nodes: nodeId ? [nodeId] : undefined, duration: 300, minZoom: 0.3 }) } -onPaneReady(init) +onPaneReady(() => { + layout(showSkeleton.value) + + setTimeout(() => { + fitView({ duration: 250, padding: 0.5 }) + }, 100) +}) onNodeDoubleClick(({ node }) => { if (showSkeleton.value) zoomIn() diff --git a/packages/nc-gui/components/erd/RelationEdge.vue b/packages/nc-gui/components/erd/RelationEdge.vue index bc847c0a98..e81009d0bb 100644 --- a/packages/nc-gui/components/erd/RelationEdge.vue +++ b/packages/nc-gui/components/erd/RelationEdge.vue @@ -2,9 +2,10 @@ import type { EdgeProps, Position } from '@vue-flow/core' import { EdgeText, getBezierPath } from '@vue-flow/core' import type { CSSProperties } from '@vue/runtime-dom' +import type { EdgeData } from './utils' import { computed, toRef } from '#imports' -interface RelationEdgeProps extends EdgeProps { +interface RelationEdgeProps extends EdgeProps { id: string sourceX: number sourceY: number @@ -12,12 +13,7 @@ interface RelationEdgeProps extends EdgeProps { targetY: number sourcePosition: Position targetPosition: Position - data: { - isManyToMany: boolean - isSelfRelation: boolean - label: string - color: string - } + data: EdgeData style: CSSProperties selected?: boolean showSkeleton: boolean diff --git a/packages/nc-gui/components/erd/TableNode.vue b/packages/nc-gui/components/erd/TableNode.vue index 99b08acbcd..f0ec6a09a9 100644 --- a/packages/nc-gui/components/erd/TableNode.vue +++ b/packages/nc-gui/components/erd/TableNode.vue @@ -1,19 +1,11 @@