refactore(store)!: Remove transition and loading.transition property
* Tranisitions break testing and are superflous Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -54,7 +54,7 @@ const updateElements = () => {
|
|||||||
<template>
|
<template>
|
||||||
<VueFlow
|
<VueFlow
|
||||||
v-model="elements"
|
v-model="elements"
|
||||||
:loading="{ label: 'Loading...', transition: { name: 'fade', mode: 'out-in' } }"
|
loading="One moment please..."
|
||||||
@load="onLoad"
|
@load="onLoad"
|
||||||
@elementsRemove="onElementsRemove"
|
@elementsRemove="onElementsRemove"
|
||||||
@connect="onConnect"
|
@connect="onConnect"
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import {
|
|||||||
NodeExtent,
|
NodeExtent,
|
||||||
NodeTypes,
|
NodeTypes,
|
||||||
EdgeTypes,
|
EdgeTypes,
|
||||||
Loading,
|
|
||||||
FlowOptions,
|
FlowOptions,
|
||||||
} from '../../types'
|
} from '../../types'
|
||||||
import Renderer from '../Renderer/Renderer.vue'
|
import Renderer from '../Renderer/Renderer.vue'
|
||||||
@@ -59,7 +58,7 @@ interface FlowProps extends FlowOptions {
|
|||||||
zoomOnDoubleClick?: boolean
|
zoomOnDoubleClick?: boolean
|
||||||
edgeUpdaterRadius?: number
|
edgeUpdaterRadius?: number
|
||||||
storageKey?: string
|
storageKey?: string
|
||||||
loading?: Loading
|
loading?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<FlowProps>(), {
|
const props = withDefaults(defineProps<FlowProps>(), {
|
||||||
@@ -102,7 +101,6 @@ const props = withDefaults(defineProps<FlowProps>(), {
|
|||||||
panOnScrollMode: PanOnScrollMode.Free,
|
panOnScrollMode: PanOnScrollMode.Free,
|
||||||
paneMoveable: true,
|
paneMoveable: true,
|
||||||
edgeUpdaterRadius: 10,
|
edgeUpdaterRadius: 10,
|
||||||
loading: false,
|
|
||||||
})
|
})
|
||||||
const emit = defineEmits([...Object.keys(createHooks()), 'update:modelValue'])
|
const emit = defineEmits([...Object.keys(createHooks()), 'update:modelValue'])
|
||||||
const store = initFlow(emit, props.id)
|
const store = initFlow(emit, props.id)
|
||||||
@@ -136,15 +134,6 @@ until(() => store.isReady)
|
|||||||
{ flush: 'post', deep: true },
|
{ flush: 'post', deep: true },
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
const transitionName = computed(() => {
|
|
||||||
let name = ''
|
|
||||||
if (typeof store.loading === 'object' && store.loading.transition) {
|
|
||||||
if (typeof store.loading.transition === 'string') name = store.loading.transition
|
|
||||||
else name = store.loading.transition.name
|
|
||||||
}
|
|
||||||
return name
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
@@ -153,7 +142,6 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="vue-flow">
|
<div class="vue-flow">
|
||||||
<Transition :name="transitionName">
|
|
||||||
<Suspense timeout="0">
|
<Suspense timeout="0">
|
||||||
<template #default>
|
<template #default>
|
||||||
<Renderer :key="`renderer-${store.id}`" :elements="elements">
|
<Renderer :key="`renderer-${store.id}`" :elements="elements">
|
||||||
@@ -243,15 +231,14 @@ export default {
|
|||||||
</ZoomPane>
|
</ZoomPane>
|
||||||
</Renderer>
|
</Renderer>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="store.loading" #fallback>
|
<template #fallback>
|
||||||
<slot :key="`loading-indicator-${store.id}`" name="loading-indicator">
|
<slot name="loading-indicator">
|
||||||
<LoadingIndicator :key="`default-loading-indicator-${store.id}`" v-bind="store.loading">
|
<LoadingIndicator :label="store.loading">
|
||||||
<slot name="loading-label" />
|
<slot name="loading-label" />
|
||||||
</LoadingIndicator>
|
</LoadingIndicator>
|
||||||
</slot>
|
</slot>
|
||||||
</template>
|
</template>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
</Transition>
|
|
||||||
<slot v-bind="store"></slot>
|
<slot v-bind="store"></slot>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
+1
-15
@@ -88,20 +88,6 @@ export type FitViewFunc = (fitViewOptions?: FitViewParams) => void
|
|||||||
export type ProjectFunc = (position: XYPosition) => XYPosition
|
export type ProjectFunc = (position: XYPosition) => XYPosition
|
||||||
export type ToObjectFunc<T = any> = () => FlowExportObject<T>
|
export type ToObjectFunc<T = any> = () => FlowExportObject<T>
|
||||||
|
|
||||||
export type Loading =
|
|
||||||
| {
|
|
||||||
label: string
|
|
||||||
transition?:
|
|
||||||
| string
|
|
||||||
| {
|
|
||||||
name: string
|
|
||||||
mode: string
|
|
||||||
}
|
|
||||||
style: CSSProperties
|
|
||||||
class: string
|
|
||||||
}
|
|
||||||
| boolean
|
|
||||||
|
|
||||||
export type FlowInstance<T = any> = {
|
export type FlowInstance<T = any> = {
|
||||||
zoomIn: () => void
|
zoomIn: () => void
|
||||||
zoomOut: () => void
|
zoomOut: () => void
|
||||||
@@ -151,5 +137,5 @@ export interface FlowOptions {
|
|||||||
preventScrolling?: boolean
|
preventScrolling?: boolean
|
||||||
edgeUpdaterRadius?: number
|
edgeUpdaterRadius?: number
|
||||||
storageKey?: string
|
storageKey?: string
|
||||||
loading?: Loading
|
loading?: string
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -93,7 +93,7 @@ export const initialState = (): FlowState => ({
|
|||||||
zoomActivationKeyCode: undefined,
|
zoomActivationKeyCode: undefined,
|
||||||
|
|
||||||
hooks: createHooks(),
|
hooks: createHooks(),
|
||||||
loading: false,
|
loading: undefined,
|
||||||
|
|
||||||
markerEndId: undefined,
|
markerEndId: undefined,
|
||||||
storageKey: undefined,
|
storageKey: undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user