# vue-tree-diagram

> A simple component for render tree diagram for Vue.js

Latest version **0.1.1** (published 2019-12-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install vue-tree-diagram
pnpm add vue-tree-diagram
yarn add vue-tree-diagram
bun add vue-tree-diagram
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2019-12-14 |
| First published | 2019-12-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 297.4 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 6 |
| Author | guisturdy |
| Maintainers | guisturdy |
| Keywords | vue, vue-tree, tree-diagram |

## Links

- npm: https://www.npmjs.com/package/vue-tree-diagram
- Repository: https://github.com/guisturdy/vue-tree-diagram
- Homepage: https://github.com/guisturdy/vue-tree-diagram#readme
- Issues: https://github.com/guisturdy/vue-tree-diagram/issues
- npm.io page: https://npm.io/package/vue-tree-diagram

## Dependencies (3)

- [vue](https://npm.io/package/vue.md) ^2.6.10
- [@vue/cli-service](https://npm.io/package/@vue/cli-service.md) ^4.1.1
- [vue-template-compiler](https://npm.io/package/vue-template-compiler.md) ^2.6.10

## Recent versions

- 0.1.1 (latest) — 2019-12-14
- 0.1.0 — 2019-12-14

## README

# vue-tree-diagram

A simple component for render tree diagram for Vue.js

## Preview

![Preview](./img/preview.png)

> [view preview code](./doc/preview.vue)

## Install
  
  `npm install vue-tree-diagram`

## Example

<details>
  <summary><b>Example</b> (click to show)</summary>

  ```html
  <template>
    <tree-diagram :data="data" @node-click="handleNodeClick">
      <template v-slot:type-root="{value}">
        <div class="type-root">
          <h1>{{value.title}}</h1>
        </div>
      </template>
      <template v-slot:type-a="{value}">
        <div class="type-a">
          <h1>{{value.title}}</h1>
        </div>
      </template>
      <template v-slot:default="{value}">
        <div class="type-b">
          <h1>{{value.title}}</h1>
          <h2>{{value.subtitle}}</h2>
        </div>
      </template>
    </tree-diagram>
  </template>

  <script>
    import TreeDiagram from "vue-tree-diagram"
    export default {
      data() {
        return {
          components: { TreeDiagram },
          data: [
            {
              id: 1,
              type: "type-root",
              value: { title: "ROOT" },
              children: [{
                id: 2,
                type: "type-a",
                value: { title: "NodeA" },
                children: [{
                  id: 3,
                  type: "type-b",
                  value: { title: "NodeB", subtitle: "NodeB subtitle" }
                }]
              }]
            }
          ]
        }
      },
      methods: {
        handleNodeClick(node) { 
          console.log(node)
        }
      }
    }
  </script>
  ```

</details>

## API

### Attributes

  | Attribute	| Description |	Type | Accepted Values | Default |
  | -	| - |	- | - | - |
  | data	| tree data |	Array | - | - |
  | nodePad	| space of node to node |	Number | - | 1 |
  | levelPad	| space of row to row |	Number | - | 10 |
  | direction	| tree direction |	String | 't-b', 'l-r' | 't-b' |
  | align	| node align in each row |	String | 'start', 'center', 'end' | 'start' |

### Events

  | Event Name	| Description | Parameters |
  | -	| - |	- |
  | node-click	| triggers when a node is clicked	| (node, event) |
  | before-render-tree | triggers when start render tree | - |
  | after-render-tree	| triggers when tree render finished | - |

---
_Source: https://npm.io/package/vue-tree-diagram · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
