balkan-orgchart-react 9.1.85 → 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 +53 -19
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -37,17 +37,16 @@ yarn add balkan-orgchart-react
|
|
|
37
37
|
|
|
38
38
|
```js
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
import {OrgChart, Employee} from "../src/OrgChart.tsx";
|
|
40
|
+
import {OrgChartReact, Employee} from "../src/OrgChartReact.tsx";
|
|
42
41
|
|
|
43
42
|
export const ChartExample = () => {
|
|
44
|
-
return <
|
|
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
52
|
```
|
|
@@ -57,7 +56,7 @@ export const ChartExample = () => {
|
|
|
57
56
|
|
|
58
57
|
```js
|
|
59
58
|
|
|
60
|
-
import {
|
|
59
|
+
import {OrgChartReact} from "../src/OrgChartReact.tsx";
|
|
61
60
|
|
|
62
61
|
export const ChartExample = () => {
|
|
63
62
|
const [jsonData, setJsonData] = useState([]);
|
|
@@ -73,12 +72,43 @@ export const ChartExample = () => {
|
|
|
73
72
|
})
|
|
74
73
|
}, []);
|
|
75
74
|
|
|
76
|
-
return <
|
|
75
|
+
return <OrgChartReact data={jsonData} nodeBinding={{ field_0: 'name', field_1: 'title' }}></OrgChartReact>
|
|
77
76
|
}
|
|
78
77
|
|
|
78
|
+
|
|
79
79
|
```
|
|
80
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
|
+
|
|
81
110
|
|
|
111
|
+
```
|
|
82
112
|
|
|
83
113
|
|
|
84
114
|
## API Call
|
|
@@ -86,26 +116,28 @@ export const ChartExample = () => {
|
|
|
86
116
|
|
|
87
117
|
```js
|
|
88
118
|
|
|
89
|
-
import {
|
|
119
|
+
import { OrgChartReact, Employee, OrgChartJS } from "../src/OrgChartReact.tsx";
|
|
90
120
|
|
|
91
121
|
export const ChartExample = () => {
|
|
92
|
-
const chartRef = useRef<
|
|
122
|
+
const chartRef = useRef<OrgChartJS>(null);
|
|
93
123
|
|
|
94
|
-
const handleExport = () => {
|
|
95
|
-
chartRef.current
|
|
124
|
+
const handleExport = () => {
|
|
125
|
+
if (chartRef.current) {
|
|
126
|
+
chartRef.current.exportToPDF();
|
|
127
|
+
}
|
|
96
128
|
};
|
|
97
129
|
|
|
98
130
|
return (
|
|
99
|
-
<>
|
|
131
|
+
<>
|
|
100
132
|
<button onClick={handleExport} style={{ fontSize: "24px"}}>Export PDF</button>
|
|
101
133
|
|
|
102
|
-
<
|
|
103
|
-
<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">
|
|
104
136
|
<Employee name="Lexie Cole" title="QA Lead" />
|
|
105
137
|
<Employee name="Janae Barrett" title="Technical Director" />
|
|
106
|
-
<Employee name="Aaliyah Webb" title="Assistant"
|
|
138
|
+
<Employee name="Aaliyah Webb" title="Assistant" />
|
|
107
139
|
</Employee>
|
|
108
|
-
</
|
|
140
|
+
</OrgChartReact>
|
|
109
141
|
</>
|
|
110
142
|
);
|
|
111
143
|
};
|
|
@@ -113,6 +145,8 @@ export const ChartExample = () => {
|
|
|
113
145
|
```
|
|
114
146
|
|
|
115
147
|
|
|
148
|
+
|
|
149
|
+
|
|
116
150
|
You can call any API method from [here](https://balkan.app/OrgChartJS/API/classes/OrgChart)
|
|
117
151
|
|
|
118
152
|
|