2.1.5 • Published 12 months ago

@meghdad/mindmap v2.1.5

Weekly downloads
-
License
ISC
Repository
github
Last release
12 months ago

Mind map Vue2 component npm npm

A mind map Vue component inspired by MindNode, based on d3.js
The currently implemented functions include basic editing, dragging, zooming, undoing, context menu, folding...

recent update

The project will basically no longer be maintained
Currently developing Vue3, d3v6 version mind map component, welcome to support

Install

npm install @hellowuxin/mindmap

PROPS

NameTypeDefaultDescription
v-modelArrayundefinedSet mind map data
widthNumber100%Set component width
heightNumberundefinedSet component height
xSpacingNumber80Set the horizontal interval of nodes
ySpacingNumber20Set the vertical interval of nodes
strokeWidthNumber4Set the width of the line
draggableBooleantrueSet whether the node can be dragged
gpsBooleantrueWhether to display the center button
fitViewBooleantrueWhether to show the zoom button
showNodeAddBooleantrueWhether to display the add node button
keyboardBooleantrueWhether to respond to keyboard events
contextMenuBooleantrueWhether to respond to the right-click menu
zoomableBooleantrueCan zoom and drag
showUndoBooleantrueWhether to display the undo redo button
downloadBooleantrueWhether to display the download button

EVENTS

NameargumentsDescription
updateNodeNamedata, idWhen updating the node name, pass in the node data and node id
clickdata, idWhen a node is clicked, the node data and node id are passed in

Example

<template>
  <mindmap v-model="data"></mindmap>
</template>

<script>
import mindmap from '@hellowuxin/mindmap'

export default {
  components: { mindmap },
  data: () => ({
    data: [{
      "name":"How to learn D3",
      "children": [
        {
          "name":"Preliminary knowledge",
          "children": [
            { "name":"HTML & CSS" },
            { "name":"JavaScript" },
            ...
          ]
        },
        {
          "name":"Install",
          "_children": [
            { "name": "collapse node" }
          ]
        },
        {
          "name":"Advanced",
          "left": true
        },
        ...
      ]
    }]
  })
}
</script>

Keyboard Events

⇥ tab⏎ enter⌫ backspace⌘ cmd+z⌘ cmd+y

Interactive Logic

Mouse:space + left Click to move, right click Menu, ctrl + scroll wheel to zoom, left click to Select

Touchpad:Two-finger scrolling, two-finger menu, two-finger pinch-to-zoom, one-finger selection

to be solved

  • Export to multiple formats
  • Set the width and height of the node
  • multiple root nodes
  • ...