balkan-orgchart-react 9.1.86 → 9.1.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.es.d.ts +16 -1
- package/index.es.js +18749 -3511
- package/index.umd.js +301 -113
- package/package.json +2 -2
- package/readme.md +45 -16
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -37,20 +37,18 @@ yarn add balkan-orgchart-react
|
|
|
37
37
|
|
|
38
38
|
```js
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
import { OrgChartReact, Employee } from 'balkan-orgchart-react';
|
|
40
|
+
import {OrgChartReact, Employee} from "../src/OrgChartReact.tsx";
|
|
42
41
|
|
|
43
42
|
export const ChartExample = () => {
|
|
44
|
-
return <OrgChartReact
|
|
45
|
-
<Employee name='Denny Curtis' title='CEO'>
|
|
46
|
-
<Employee name='Lexie Cole' title='QA Lead'></Employee>
|
|
47
|
-
<Employee name='Janae Barrett' title='Technical Director'></Employee>
|
|
48
|
-
<Employee name='Aaliyah Webb' title='Assistant'
|
|
43
|
+
return <OrgChartReact nodeBinding={{ field_0: 'name', field_1: 'title', img_0: 'photo'}} >
|
|
44
|
+
<Employee name='Denny Curtis' title='CEO' photo='https://cdn.balkan.app/shared/a/6.jpg'>
|
|
45
|
+
<Employee name='Lexie Cole' title='QA Lead' photo='https://cdn.balkan.app/shared/a/5.jpg'></Employee>
|
|
46
|
+
<Employee name='Janae Barrett' title='Technical Director' photo='https://cdn.balkan.app/shared/a/4.jpg'></Employee>
|
|
47
|
+
<Employee name='Aaliyah Webb' title='Assistant' photo='https://cdn.balkan.app/shared/a/3.jpg'></Employee>
|
|
49
48
|
</Employee>
|
|
50
49
|
</OrgChartReact>
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
|
|
54
52
|
```
|
|
55
53
|
|
|
56
54
|
|
|
@@ -58,7 +56,7 @@ export const ChartExample = () => {
|
|
|
58
56
|
|
|
59
57
|
```js
|
|
60
58
|
|
|
61
|
-
import {OrgChartReact} from
|
|
59
|
+
import {OrgChartReact} from "../src/OrgChartReact.tsx";
|
|
62
60
|
|
|
63
61
|
export const ChartExample = () => {
|
|
64
62
|
const [jsonData, setJsonData] = useState([]);
|
|
@@ -74,14 +72,43 @@ export const ChartExample = () => {
|
|
|
74
72
|
})
|
|
75
73
|
}, []);
|
|
76
74
|
|
|
77
|
-
return <OrgChartReact
|
|
75
|
+
return <OrgChartReact data={jsonData} nodeBinding={{ field_0: 'name', field_1: 'title' }}></OrgChartReact>
|
|
78
76
|
}
|
|
79
77
|
|
|
80
78
|
|
|
81
|
-
|
|
82
79
|
```
|
|
83
80
|
|
|
81
|
+
## Custom Template
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
import {OrgChartReact, Employee, Template} from "../src/OrgChartReact.tsx";
|
|
85
|
+
|
|
86
|
+
export const ChartExample = () => {
|
|
87
|
+
return <OrgChartReact template='myTemplate1'>
|
|
88
|
+
|
|
89
|
+
<Template name='myTemplate1' nodeWidth={200} nodeHeight={100} baseTemplateName='ana' renderNode={(node, data) => {
|
|
90
|
+
return <>
|
|
91
|
+
<rect x="0" y="0" height={node.h} width={node.w} fill="#fff" stroke="#aeaeae" strokeWidth={1} rx={10} ry={10}> </rect>
|
|
92
|
+
|
|
93
|
+
<text x={node.w ? node.w / 2 : 0} y={node.h ? node.h / 2 + 10: 0} fill="#aeaeae" fontSize="20" textAnchor="middle">
|
|
94
|
+
{data.employeeName}
|
|
95
|
+
</text>
|
|
96
|
+
</>
|
|
97
|
+
}}>
|
|
98
|
+
</Template>
|
|
99
|
+
|
|
100
|
+
<Template name='myTemplate2' nodeWidth={500} nodeHeight={500} baseTemplateName='myTemplate1'></Template>
|
|
101
|
+
|
|
102
|
+
<Employee employeeName='Denny Curtis' >
|
|
103
|
+
<Employee employeeName='Lexie Cole'></Employee>
|
|
104
|
+
<Employee employeeName='Janae Barrett' template='myTemplate2'></Employee>
|
|
105
|
+
<Employee employeeName='Aaliyah Webb'></Employee>
|
|
106
|
+
</Employee>
|
|
107
|
+
</OrgChartReact>
|
|
108
|
+
}
|
|
109
|
+
|
|
84
110
|
|
|
111
|
+
```
|
|
85
112
|
|
|
86
113
|
|
|
87
114
|
## API Call
|
|
@@ -89,7 +116,7 @@ export const ChartExample = () => {
|
|
|
89
116
|
|
|
90
117
|
```js
|
|
91
118
|
|
|
92
|
-
import { OrgChartReact, Employee } from
|
|
119
|
+
import { OrgChartReact, Employee, OrgChartJS } from "../src/OrgChartReact.tsx";
|
|
93
120
|
|
|
94
121
|
export const ChartExample = () => {
|
|
95
122
|
const chartRef = useRef<OrgChartJS>(null);
|
|
@@ -101,14 +128,14 @@ export const ChartExample = () => {
|
|
|
101
128
|
};
|
|
102
129
|
|
|
103
130
|
return (
|
|
104
|
-
<>
|
|
131
|
+
<>
|
|
105
132
|
<button onClick={handleExport} style={{ fontSize: "24px"}}>Export PDF</button>
|
|
106
133
|
|
|
107
|
-
<OrgChartReact
|
|
108
|
-
<Employee name="Denny Curtis" title="CEO">
|
|
134
|
+
<OrgChartReact ref={chartRef} nodeBinding={{ field_0: "name", field_1: "title", img_0: "photo" }} >
|
|
135
|
+
<Employee name="Denny Curtis" title="CEO" photo="https://cdn.balkan.app/shared/a/6.jpg">
|
|
109
136
|
<Employee name="Lexie Cole" title="QA Lead" />
|
|
110
137
|
<Employee name="Janae Barrett" title="Technical Director" />
|
|
111
|
-
<Employee name="Aaliyah Webb" title="Assistant"
|
|
138
|
+
<Employee name="Aaliyah Webb" title="Assistant" />
|
|
112
139
|
</Employee>
|
|
113
140
|
</OrgChartReact>
|
|
114
141
|
</>
|
|
@@ -118,6 +145,8 @@ export const ChartExample = () => {
|
|
|
118
145
|
```
|
|
119
146
|
|
|
120
147
|
|
|
148
|
+
|
|
149
|
+
|
|
121
150
|
You can call any API method from [here](https://balkan.app/OrgChartJS/API/classes/OrgChart)
|
|
122
151
|
|
|
123
152
|
|