balkan-orgchart-react-community 9.1.83 → 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 +21 -6030
- package/index.es.js +17502 -2267
- package/index.umd.js +248 -60
- package/package.json +4 -2
- package/readme.md +56 -19
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -39,17 +39,16 @@ yarn add balkan-orgchart-react
|
|
|
39
39
|
|
|
40
40
|
```js
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
import {OrgChart, Employee} from "../src/OrgChart.tsx";
|
|
42
|
+
import {OrgChartReact, Employee} from "../src/OrgChartReact.tsx";
|
|
44
43
|
|
|
45
44
|
export const ChartExample = () => {
|
|
46
|
-
return <
|
|
47
|
-
<Employee name='Denny Curtis' title='CEO'>
|
|
48
|
-
<Employee name='Lexie Cole' title='QA Lead'></Employee>
|
|
49
|
-
<Employee name='Janae Barrett' title='Technical Director'></Employee>
|
|
50
|
-
<Employee name='Aaliyah Webb' title='Assistant'
|
|
45
|
+
return <OrgChartReact nodeBinding={{ field_0: 'name', field_1: 'title', img_0: 'photo'}} >
|
|
46
|
+
<Employee name='Denny Curtis' title='CEO' photo='https://cdn.balkan.app/shared/a/6.jpg'>
|
|
47
|
+
<Employee name='Lexie Cole' title='QA Lead' photo='https://cdn.balkan.app/shared/a/5.jpg'></Employee>
|
|
48
|
+
<Employee name='Janae Barrett' title='Technical Director' photo='https://cdn.balkan.app/shared/a/4.jpg'></Employee>
|
|
49
|
+
<Employee name='Aaliyah Webb' title='Assistant' photo='https://cdn.balkan.app/shared/a/3.jpg'></Employee>
|
|
51
50
|
</Employee>
|
|
52
|
-
</
|
|
51
|
+
</OrgChartReact>
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
```
|
|
@@ -59,7 +58,7 @@ export const ChartExample = () => {
|
|
|
59
58
|
|
|
60
59
|
```js
|
|
61
60
|
|
|
62
|
-
import {
|
|
61
|
+
import {OrgChartReact} from "../src/OrgChartReact.tsx";
|
|
63
62
|
|
|
64
63
|
export const ChartExample = () => {
|
|
65
64
|
const [jsonData, setJsonData] = useState([]);
|
|
@@ -75,12 +74,44 @@ export const ChartExample = () => {
|
|
|
75
74
|
})
|
|
76
75
|
}, []);
|
|
77
76
|
|
|
78
|
-
return <
|
|
77
|
+
return <OrgChartReact data={jsonData} nodeBinding={{ field_0: 'name', field_1: 'title' }}></OrgChartReact>
|
|
79
78
|
}
|
|
80
79
|
|
|
80
|
+
|
|
81
|
+
|
|
81
82
|
```
|
|
82
83
|
|
|
84
|
+
## Custom Template
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
import {OrgChartReact, Employee, Template} from "../src/OrgChartReact.tsx";
|
|
83
88
|
|
|
89
|
+
export const ChartExample = () => {
|
|
90
|
+
return <OrgChartReact template='myTemplate1'>
|
|
91
|
+
|
|
92
|
+
<Template name='myTemplate1' nodeWidth={200} nodeHeight={100} baseTemplateName='ana' renderNode={(node, data) => {
|
|
93
|
+
return <>
|
|
94
|
+
<rect x="0" y="0" height={node.h} width={node.w} fill="#fff" stroke="#aeaeae" strokeWidth={1} rx={10} ry={10}> </rect>
|
|
95
|
+
|
|
96
|
+
<text x={node.w ? node.w / 2 : 0} y={node.h ? node.h / 2 + 10: 0} fill="#aeaeae" fontSize="20" textAnchor="middle">
|
|
97
|
+
{data.employeeName}
|
|
98
|
+
</text>
|
|
99
|
+
</>
|
|
100
|
+
}}>
|
|
101
|
+
</Template>
|
|
102
|
+
|
|
103
|
+
<Template name='myTemplate2' nodeWidth={500} nodeHeight={500} baseTemplateName='myTemplate1'></Template>
|
|
104
|
+
|
|
105
|
+
<Employee employeeName='Denny Curtis' >
|
|
106
|
+
<Employee employeeName='Lexie Cole'></Employee>
|
|
107
|
+
<Employee employeeName='Janae Barrett' template='myTemplate2'></Employee>
|
|
108
|
+
<Employee employeeName='Aaliyah Webb'></Employee>
|
|
109
|
+
</Employee>
|
|
110
|
+
</OrgChartReact>
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
```
|
|
84
115
|
|
|
85
116
|
|
|
86
117
|
## API Call
|
|
@@ -88,33 +119,39 @@ export const ChartExample = () => {
|
|
|
88
119
|
|
|
89
120
|
```js
|
|
90
121
|
|
|
91
|
-
|
|
122
|
+
|
|
123
|
+
import { OrgChartReact, Employee, OrgChartJS } from "../src/OrgChartReact.tsx";
|
|
92
124
|
|
|
93
125
|
export const ChartExample = () => {
|
|
94
|
-
const chartRef = useRef<
|
|
126
|
+
const chartRef = useRef<OrgChartJS>(null);
|
|
95
127
|
|
|
96
|
-
const handleExport = () => {
|
|
97
|
-
chartRef.current
|
|
128
|
+
const handleExport = () => {
|
|
129
|
+
if (chartRef.current) {
|
|
130
|
+
chartRef.current.exportToPDF();
|
|
131
|
+
}
|
|
98
132
|
};
|
|
99
133
|
|
|
100
134
|
return (
|
|
101
|
-
<>
|
|
135
|
+
<>
|
|
102
136
|
<button onClick={handleExport} style={{ fontSize: "24px"}}>Export PDF</button>
|
|
103
137
|
|
|
104
|
-
<
|
|
105
|
-
<Employee name="Denny Curtis" title="CEO">
|
|
138
|
+
<OrgChartReact ref={chartRef} nodeBinding={{ field_0: "name", field_1: "title", img_0: "photo" }} >
|
|
139
|
+
<Employee name="Denny Curtis" title="CEO" photo="https://cdn.balkan.app/shared/a/6.jpg">
|
|
106
140
|
<Employee name="Lexie Cole" title="QA Lead" />
|
|
107
141
|
<Employee name="Janae Barrett" title="Technical Director" />
|
|
108
|
-
<Employee name="Aaliyah Webb" title="Assistant"
|
|
142
|
+
<Employee name="Aaliyah Webb" title="Assistant" />
|
|
109
143
|
</Employee>
|
|
110
|
-
</
|
|
144
|
+
</OrgChartReact>
|
|
111
145
|
</>
|
|
112
146
|
);
|
|
113
147
|
};
|
|
114
148
|
|
|
149
|
+
|
|
115
150
|
```
|
|
116
151
|
|
|
117
152
|
|
|
153
|
+
|
|
154
|
+
|
|
118
155
|
You can call any API method from [here](https://balkan.app/OrgChartJS/API/classes/OrgChart)
|
|
119
156
|
|
|
120
157
|
|