npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@c42/vue-orgchart

v0.2.0

Published

A Vue component that wraps orgchart.js and supports scoped slots to customize nodes in chart

Downloads

6

Readme

vue-orgchart

A Vue component that wraps orgchart.js and supports scoped slots to customize nodes in chart.

<ul> support and ajax support are dropped since now you can just fetch data with your favorite ajax library like axios, fetch etc. and then pass data to this component. It will automatically repaint on data change.

install

npm i @c42/vue-orgchart

usage

props

  {
    data: { type: Object, required: true }, // Data to build structure of orgchart. see below.
    vue: { type: Function, required: true }, // Vue constructor used to render nodes.
    nodeId: { type: String, default: 'id' }, // It sets one property of data as unique identifier of every orgchart node.
    direction: { type: String, default: 't2b' }, // The available values are t2b(implies "top to bottom", it's default value), b2t(implies "bottom to top"), l2r(implies "left to right"), r2l(implies "right to left").
    depth: { type: Number, default: 999 }, // It indicates the level that at the very beginning orgchart is expanded to.
    verticalDepth: { type: Number, default: 999 }, // Users can make use of this option to align the nodes vertically from the specified depth.
    exportButton: { type: Boolean, default: true }, // It enable the export button for orgchart.
    exportFilename: { type: String, default: 'OrgChart' }, // It's filename when you export current orgchart as a picture.
    htmlToCanvas: { type: Function, default: () => () => {} }, // html2canvas to convert html to picture for export.

    toggleSiblingsResp: { type: Boolean, default: true }, // Once enable this option, users can show/hide left/right sibling nodes respectively by clicking left/right arrow.
    pan: { type: Boolean, default: true }, // Users could pan the orgchart by mouse drag&drop if they enable this option.
    zoom: { type: Boolean, default: true }, // Users could zoomin/zoomout the orgchart by mouse wheel if they enable this option.
    draggable: { type: Boolean, default: true }, // Users can drag & drop the nodes of orgchart if they enable this option. **Note**: this feature doesn't work on IE due to its poor support for HTML5 drag & drop API.
    dropCriteria: { type: Function, default: () => () => true }, // Users can construct their own criteria to limit the relationships between dragged node and drop zone. Furtherly, this function accept three arguments(draggedNode, dragZone, dropZone) and just only return boolen values.

    // css classes
    containerClass: { type: String, default: '' },
    chartClass: { type: String, default: '' },
    spinnertClass: { type: String, default: '' },
    exportBtnClass: { type: String, default: '' },
    leftArrowClass: { type: String, default: '' },
    rightArrowClass: { type: String, default: '' },
    upArrowClass: { type: String, default: '' },
    downArrowClass: { type: String, default: '' },
    commonClass: { type: String, default: '' }, // Typically `fa` if using font-awesome
    parentNodeSymbolClass: { type: String, default: '' }, // Class of icon to imply that the node has child nodes.
  }

events

@drag:

onDrag = ({ targetId, sourceId, destinationId }) => {
  // targetId: id of the node being dragged
  // sourceId: id of the orignial parent node of the dragged node
  // destinationId: id of the node that the dragged node is dropped to
}

add/remove/move nodes

Just modify the data, and the orgchart will update. See src/App.vue for a complete example.