feat(examples): add node resizer example
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
"@vue-flow/controls": "workspace:*",
|
"@vue-flow/controls": "workspace:*",
|
||||||
"@vue-flow/core": "workspace:*",
|
"@vue-flow/core": "workspace:*",
|
||||||
"@vue-flow/minimap": "workspace:*",
|
"@vue-flow/minimap": "workspace:*",
|
||||||
|
"@vue-flow/node-resizer": "workspace:*",
|
||||||
"@vue-flow/node-toolbar": "workspace:*"
|
"@vue-flow/node-toolbar": "workspace:*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ export const routes: RouterOptions['routes'] = [
|
|||||||
path: '/snap-handle',
|
path: '/snap-handle',
|
||||||
component: () => import('./src/SnapHandle/SnapHandleExample.vue'),
|
component: () => import('./src/SnapHandle/SnapHandleExample.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/node-resizer',
|
||||||
|
component: () => import('./src/NodeResizer/NodeResizerExample.vue'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/node-toolbar',
|
path: '/node-toolbar',
|
||||||
component: () => import('./src/NodeToolbar/NodeToolbarExample.vue'),
|
component: () => import('./src/NodeToolbar/NodeToolbarExample.vue'),
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { VueFlow } from '@vue-flow/core'
|
||||||
|
import ResizableNode from './ResizableNode.vue'
|
||||||
|
|
||||||
|
const elements = ref([
|
||||||
|
{
|
||||||
|
id: '1',
|
||||||
|
type: 'resizable',
|
||||||
|
label: 'NodeResizer',
|
||||||
|
position: { x: 0, y: 50 },
|
||||||
|
style: { background: '#fff', border: '1px solid black', borderRadius: '15px', fontSize: '12px' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '2',
|
||||||
|
type: 'resizableSelected',
|
||||||
|
label: 'NodeResizer when selected',
|
||||||
|
position: { x: 100, y: 300 },
|
||||||
|
style: { background: '#fff', border: '1px solid black', borderRadius: '15px', fontSize: '12px' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '3',
|
||||||
|
type: 'custom-resizable',
|
||||||
|
label: 'Custom Resize Icon',
|
||||||
|
position: { x: 150, y: 150 },
|
||||||
|
style: {
|
||||||
|
background: '#fff',
|
||||||
|
fontSize: '12px',
|
||||||
|
border: '1px solid black',
|
||||||
|
padding: '5px',
|
||||||
|
borderRadius: '15px',
|
||||||
|
height: '100px',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<VueFlow v-model="elements" fit-view-on-init class="vue-flow-basic-example">
|
||||||
|
<template #node-resizable="resizableNodeProps">
|
||||||
|
<ResizableNode :label="resizableNodeProps.label" />
|
||||||
|
</template>
|
||||||
|
</VueFlow>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { Handle, Position } from '@vue-flow/core'
|
||||||
|
import { NodeResizer } from '@vue-flow/node-resizer'
|
||||||
|
import '@vue-flow/node-resizer/dist/style.css'
|
||||||
|
|
||||||
|
defineProps(['label'])
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<NodeResizer min-width="100" min-height="30" />
|
||||||
|
|
||||||
|
<Handle type="target" :position="Position.Left" />
|
||||||
|
<div style="padding: 10px">{{ label }}</div>
|
||||||
|
<Handle type="source" :position="Position.Right" />
|
||||||
|
</template>
|
||||||
Generated
+10
@@ -144,6 +144,7 @@ importers:
|
|||||||
'@vitejs/plugin-vue': ^3.2.0
|
'@vitejs/plugin-vue': ^3.2.0
|
||||||
'@vue-flow/additional-components': workspace:*
|
'@vue-flow/additional-components': workspace:*
|
||||||
'@vue-flow/core': workspace:*
|
'@vue-flow/core': workspace:*
|
||||||
|
'@vue-flow/node-resizer': workspace:*
|
||||||
dagre: ^0.8.5
|
dagre: ^0.8.5
|
||||||
unplugin-auto-import: ^0.12.0
|
unplugin-auto-import: ^0.12.0
|
||||||
vite: ^3.2.5
|
vite: ^3.2.5
|
||||||
@@ -155,6 +156,7 @@ importers:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@vue-flow/additional-components': link:../../packages/additional-components
|
'@vue-flow/additional-components': link:../../packages/additional-components
|
||||||
'@vue-flow/core': link:../../packages/core
|
'@vue-flow/core': link:../../packages/core
|
||||||
|
'@vue-flow/node-resizer': link:../../packages/node-resizer
|
||||||
vueflow: link:../../packages/vue-flow
|
vueflow: link:../../packages/vue-flow
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@types/dagre': 0.7.48
|
'@types/dagre': 0.7.48
|
||||||
@@ -241,16 +243,24 @@ importers:
|
|||||||
|
|
||||||
packages/node-resizer:
|
packages/node-resizer:
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@types/d3-drag': ^3.0.1
|
||||||
|
'@types/d3-selection': ^3.0.3
|
||||||
'@vitejs/plugin-vue': ^3.2.0
|
'@vitejs/plugin-vue': ^3.2.0
|
||||||
'@vue-flow/core': workspace:*
|
'@vue-flow/core': workspace:*
|
||||||
|
d3-drag: ^3.0.0
|
||||||
|
d3-selection: ^3.0.0
|
||||||
unplugin-auto-import: ^0.12.0
|
unplugin-auto-import: ^0.12.0
|
||||||
vite: ^3.2.5
|
vite: ^3.2.5
|
||||||
vite-plugin-vue-type-imports: 0.2.0
|
vite-plugin-vue-type-imports: 0.2.0
|
||||||
vue: ^3.2.37
|
vue: ^3.2.37
|
||||||
vue-tsc: ^1.0.11
|
vue-tsc: ^1.0.11
|
||||||
dependencies:
|
dependencies:
|
||||||
|
d3-drag: 3.0.0
|
||||||
|
d3-selection: 3.0.0
|
||||||
vue: 3.2.40
|
vue: 3.2.40
|
||||||
devDependencies:
|
devDependencies:
|
||||||
|
'@types/d3-drag': 3.0.1
|
||||||
|
'@types/d3-selection': 3.0.3
|
||||||
'@vitejs/plugin-vue': 3.2.0_vite@3.2.5+vue@3.2.40
|
'@vitejs/plugin-vue': 3.2.0_vite@3.2.5+vue@3.2.40
|
||||||
'@vue-flow/core': link:../core
|
'@vue-flow/core': link:../core
|
||||||
unplugin-auto-import: 0.12.0
|
unplugin-auto-import: 0.12.0
|
||||||
|
|||||||
Reference in New Issue
Block a user