docs: add node resizer example
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -78,6 +78,7 @@ onMounted(async () => {
|
||||
'@vue-flow/controls': `${location.origin}/vue-flow-controls.mjs`,
|
||||
'@vue-flow/minimap': `${location.origin}/vue-flow-minimap.mjs`,
|
||||
'@vue-flow/core': `${location.origin}/vue-flow-core.mjs`,
|
||||
'@vue-flow/node-resizer': `${location.origin}/vue-flow-node-resizer.mjs`,
|
||||
'@vue-flow/node-toolbar': `${location.origin}/vue-flow-node-toolbar.mjs`,
|
||||
...additionalImports,
|
||||
},
|
||||
|
||||
@@ -18,6 +18,7 @@ import { TeleportApp, TeleportCSS, TeleportSidebar, TeleportableNode, Teleportab
|
||||
import { TransitionApp, TransitionCSS, TransitionEdge } from './transition'
|
||||
import { IntersectionApp, IntersectionCSS, IntersectionElements } from './intersection'
|
||||
import { SnapToHandleApp, SnappableConnectionLine } from './snap-to-handle'
|
||||
import { NodeResizerApp, ResizableNode } from './node-resizer'
|
||||
import { ToolbarApp, ToolbarNode } from './node-toolbar'
|
||||
|
||||
export const exampleImports = {
|
||||
@@ -120,6 +121,10 @@ export const exampleImports = {
|
||||
'App.vue': SnapToHandleApp,
|
||||
'SnappableConnectionLine.vue': SnappableConnectionLine,
|
||||
},
|
||||
resizable: {
|
||||
'App.vue': NodeResizerApp,
|
||||
'SnappableConnectionLine.vue': ResizableNode,
|
||||
},
|
||||
toolbar: {
|
||||
'App.vue': ToolbarApp,
|
||||
'ToolbarNode.vue': ToolbarNode,
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<script lang="ts" setup>
|
||||
import { VueFlow } from '@vue-flow/core'
|
||||
import { ref } from 'vue'
|
||||
import ResizableNode from './ResizableNode.vue'
|
||||
|
||||
const elements = ref([
|
||||
{
|
||||
id: '1',
|
||||
type: 'resizable',
|
||||
label: 'NodeResizer',
|
||||
position: { x: 0, y: 0 },
|
||||
style: { background: '#fff', border: '2px solid black' },
|
||||
},
|
||||
])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VueFlow v-model="elements" fit-view-on-init>
|
||||
<template #node-resizable="resizableNodeProps">
|
||||
<ResizableNode :label="resizableNodeProps.label" />
|
||||
</template>
|
||||
</VueFlow>
|
||||
</template>
|
||||
@@ -0,0 +1,15 @@
|
||||
<script 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>
|
||||
@@ -0,0 +1,2 @@
|
||||
export { default as NodeResizerApp } from './App.vue?raw'
|
||||
export { default as ResizableNode } from './ResizableNode.vue?raw'
|
||||
@@ -0,0 +1 @@
|
||||
@import 'https://cdn.jsdelivr.net/npm/@vue-flow/node-resizer@latest/dist/style.css';
|
||||
@@ -20,6 +20,7 @@
|
||||
"@vue-flow/controls": "workspace:*",
|
||||
"@vue-flow/core": "workspace:*",
|
||||
"@vue-flow/minimap": "workspace:*",
|
||||
"@vue-flow/node-resizer": "workspace:*",
|
||||
"@vue-flow/node-toolbar": "workspace:*",
|
||||
"@vue/repl": "1.1.2",
|
||||
"blobity": "^0.2.1",
|
||||
|
||||
@@ -211,6 +211,7 @@ export default defineConfigWithTheme<DefaultTheme.Config>({
|
||||
{ text: 'Custom Node', link: '/examples/nodes/' },
|
||||
{ text: 'Update Node', link: '/examples/nodes/update-node' },
|
||||
{ text: 'Nested Nodes', link: '/examples/nodes/nesting' },
|
||||
{ text: 'Node Resizer', link: '/examples/nodes/node-resizer' },
|
||||
{ text: 'Node Toolbar', link: '/examples/nodes/node-toolbar' },
|
||||
],
|
||||
},
|
||||
|
||||
@@ -20,6 +20,10 @@ export function copyVueFlowPlugin(): Plugin {
|
||||
path: '../../../node_modules/@vue-flow/minimap/dist/',
|
||||
pkgName: 'vue-flow-minimap.mjs',
|
||||
},
|
||||
{
|
||||
path: '../../../node_modules/@vue-flow/node-resizer/dist/',
|
||||
pkgName: 'vue-flow-node-resizer.mjs',
|
||||
},
|
||||
{
|
||||
path: '../../../node_modules/@vue-flow/node-toolbar/dist/',
|
||||
pkgName: 'vue-flow-node-toolbar.mjs',
|
||||
|
||||
Vendored
+1
@@ -31,6 +31,7 @@ declare module '@vue/runtime-core' {
|
||||
Output: typeof import('./../components/home/nodes/Output.vue')['default']
|
||||
PiniaExample: typeof import('./../components/examples/pinia/PiniaExample.vue')['default']
|
||||
Repl: typeof import('./../components/Repl.vue')['default']
|
||||
ResizableNode: typeof import('./../components/examples/node-resizer/ResizableNode.vue')['default']
|
||||
RGB: typeof import('./../components/home/flows/RGB.vue')['default']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# Node Resizer
|
||||
|
||||
The node resizer is a component that can be used to resize a node.
|
||||
|
||||
<div class="mt-6">
|
||||
<Repl example="resizable"></Repl>
|
||||
</div>
|
||||
Generated
+2
@@ -40,6 +40,7 @@ importers:
|
||||
'@vercel/analytics': ^0.1.5
|
||||
'@vue-flow/additional-components': workspace:*
|
||||
'@vue-flow/core': workspace:*
|
||||
'@vue-flow/node-resizer': workspace:*
|
||||
'@vue/repl': 1.1.2
|
||||
'@windicss/plugin-scrollbar': ^1.2.3
|
||||
blobity: ^0.2.1
|
||||
@@ -66,6 +67,7 @@ importers:
|
||||
'@vercel/analytics': 0.1.5_react@18.2.0
|
||||
'@vue-flow/additional-components': link:../packages/additional-components
|
||||
'@vue-flow/core': link:../packages/core
|
||||
'@vue-flow/node-resizer': link:../packages/node-resizer
|
||||
'@vue/repl': 1.1.2_vue@3.2.37
|
||||
blobity: 0.2.1_react@18.2.0+vue@3.2.37
|
||||
canvas-confetti: 1.6.0
|
||||
|
||||
Reference in New Issue
Block a user