0.0.6 • Published 6 years ago

r-orgchart v0.0.6

Weekly downloads
19
License
MIT
Repository
github
Last release
6 years ago

R-orgchart

R-orgchart is simple library for displaying and creating orgcharts in React.

Installation:

$ npm install -s r-orgchart

Use:

import Rorgchart from 'r-orgchart';
...
<Rorgchart />

Props:

PropDefaultDescription
dataarray with root object: {id: 1, title: 'Root', ParentId: null}Array of objects you wish to display. Each object must contain id, title and ParentId.
readonlyfalseBy default, orgchart can be edited and nodes deleted. If you send this props, it will be readonly.
disableRootEditfalseDisable edit of root node.
addNewChilddefault functionThere is default function for adding new node, but you can send your own if you wish - argument: parentId.
deleteNodedefault functionThere is default function for deleting node, but you can send your own if you wish - argument: node.
editNodedefault functionThere is default function for editing node, but you can send your own if you wish - argument: node (edited).
animationtrueTurn on/off animation (visible when there is only a root node).
nodeStyle-Custom style for node box.
nodeClassName-CSS className for node box.
btnsStyle-Custom style for buttons box.
btnsClassName-CSS className for buttons box.
lineColor-Custom color for lines connecting nodes.

Exporting data:

To get back data array with all changes, you can call function exportData using a ref:

    ...
    this.refs.rorgchart.exportData();
    ...
    <Rorgchart ref="rorgchart" />
    ...