feat: Add resize-rotate-node pkg
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<script lang="ts" setup>
|
||||
import type { Connection, Edge, Elements, FlowInstance } from '@braks/vue-flow'
|
||||
import { Background, Controls, MiniMap, VueFlow, addEdge } from '@braks/vue-flow'
|
||||
import initialElements from './elements'
|
||||
import { ResizeRotateNode } from '~/index'
|
||||
|
||||
const elements = ref<Elements>(initialElements)
|
||||
const rfInstance = ref<FlowInstance | null>(null)
|
||||
const onConnect = (params: Edge | Connection) => (elements.value = addEdge(params, elements.value))
|
||||
const onLoad = (flowInstance: FlowInstance) => {
|
||||
flowInstance.fitView({ padding: 1 })
|
||||
rfInstance.value = flowInstance
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div style="height: 100%">
|
||||
<VueFlow v-model="elements" class="vue-flow-basic-example" @connect="onConnect" @pane-ready="onLoad">
|
||||
<template #node-resize-rotate="props">
|
||||
<ResizeRotateNode v-bind="props" />
|
||||
</template>
|
||||
<Controls />
|
||||
<MiniMap />
|
||||
<Background color="#aaa" :gap="8" />
|
||||
</VueFlow>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
@import '../node_modules/@braks/vue-flow/dist/style.css';
|
||||
@import '../node_modules/@braks/vue-flow/dist/theme-default.css';
|
||||
|
||||
html,
|
||||
body,
|
||||
#root {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,16 @@
|
||||
import type { Elements } from '@braks/vue-flow'
|
||||
import { MarkerType } from '@braks/vue-flow'
|
||||
|
||||
// const markerEnd = MarkerType.Arrow
|
||||
|
||||
export default [
|
||||
{
|
||||
id: '1',
|
||||
label: 'Node 1',
|
||||
type: 'resize-rotate',
|
||||
position: {
|
||||
x: 430,
|
||||
y: 0,
|
||||
},
|
||||
},
|
||||
] as Elements
|
||||
@@ -0,0 +1,7 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
app.config.performance = true
|
||||
app.mount('#root')
|
||||
Reference in New Issue
Block a user