Skip to content

Commit 8d50819

Browse files
r-orgchart initial work
0 parents  commit 8d50819

9 files changed

+803
-0
lines changed

.babelrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"presets": ["stage-2", "env"],
3+
"plugins": [
4+
"transform-object-rest-spread",
5+
"transform-react-jsx",
6+
"transform-class-properties"
7+
]
8+
}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/node_modules

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v6.10

README.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# R-orgchart
2+
3+
R-orgchart is simple library for displaying and creating orgcharts in React.
4+
5+
6+
### Installation:
7+
8+
```sh
9+
$ npm install -s r-orgchart
10+
```
11+
12+
### Use:
13+
```javascript
14+
import Rorgchart from 'r-orgchart';
15+
...
16+
<Rorgchart />
17+
```
18+
19+
### Props:
20+
| Prop | Default | Description
21+
| ------ | ------ | ------
22+
| data | array with root object: *[{id: 1, title: 'Root', ParentId: null}]* | Array of objects you wish to display. Each object must contain id, title and ParentId.
23+
| readonly | false | By default, orgchart can be edited and nodes deleted. If you send this props, it will be readonly.
24+
| disableRootEdit | false | Disable edit of root node.
25+
| addNewChild | default function | There is default function for adding new node, but you can send your own if you wish - argument: parentId.
26+
| deleteNode | default function | There is default function for deleting node, but you can send your own if you wish - argument: node.
27+
| editNode | default function | There is default function for editing node, but you can send your own if you wish - argument: node (edited).
28+
| animation | true | Turn on/off animation (visible when there is only a root node).
29+
| nodeStyle | - | Custom style for node box.
30+
| nodeClassName | - | CSS className for node box.
31+
| btnsStyle | - | Custom style for buttons box.
32+
| btnsClassName | - | CSS className for buttons box.
33+
| lineColor | - | Custom color for lines connecting nodes.
34+
35+
36+
### Exporting data:
37+
To get back data array with all changes, you can call function exportData using a ref:
38+
39+
```javascript
40+
...
41+
this.refs.rorgchart.exportData();
42+
...
43+
<Rorgchart ref="rorgchart" />
44+
...
45+
```

package.json

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "r-orgchart",
3+
"version": "0.0.5",
4+
"description": "R-orgchart is a simple library for displaying and creating orgcharts in React.",
5+
"keywords": [
6+
"r-orgchart",
7+
"orgchart",
8+
"org chart",
9+
"react",
10+
"react-orgchart",
11+
"chart",
12+
"tree-view"
13+
],
14+
"author": "Kristina Sičaja <kristina@kodbiro.com> (http://www.kodbiro.com/)",
15+
"license": "MIT",
16+
"main": "build/index.js",
17+
"peerDependencies": {
18+
"react": "^15.5.4"
19+
},
20+
"dependencies": {
21+
"@fortawesome/fontawesome": "^1.1.8",
22+
"@fortawesome/fontawesome-free-solid": "^5.0.13",
23+
"@fortawesome/react-fontawesome": "0.0.18",
24+
"lodash": "^4.17.10",
25+
"react": "^15.5.4",
26+
"react-addons-update": "^15.6.2",
27+
"webpack": "^2.6.1"
28+
},
29+
"scripts": {
30+
"test": "echo \"Error: no test specified\" && exit 1",
31+
"start": "webpack --watch",
32+
"build": "webpack"
33+
},
34+
"devDependencies": {
35+
"babel-cli": "^6.24.1",
36+
"babel-core": "^6.26.3",
37+
"babel-loader": "^7.1.5",
38+
"babel-plugin-transform-class-properties": "^6.24.1",
39+
"babel-plugin-transform-object-rest-spread": "^6.23.0",
40+
"babel-plugin-transform-react-jsx": "^6.24.1",
41+
"babel-preset-env": "^1.7.0",
42+
"babel-preset-stage-2": "^6.24.1",
43+
"css-loader": "^0.28.11",
44+
"style-loader": "^0.20.3"
45+
}
46+
}

0 commit comments

Comments
 (0)