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.
Files changed (5) hide show
  1. package/index.es.d.ts +21 -6030
  2. package/index.es.js +17502 -2267
  3. package/index.umd.js +248 -60
  4. package/package.json +4 -2
  5. package/readme.md +56 -19
package/package.json CHANGED
@@ -53,6 +53,8 @@
53
53
  "type": "git",
54
54
  "url": "git+https://github.com/BALKANGraph/OrgChartReact-Community.git"
55
55
  },
56
- "dependencies": {},
57
- "version": "9.1.83"
56
+ "dependencies": {
57
+ "balkan-orgchart-js-community": "^9.1.101"
58
+ },
59
+ "version": "9.1.101"
58
60
  }
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 <OrgChart nodeBinding={{ field_0: 'name', field_1: 'title' }} style={{width: '100%', height: '100%'}} enableSearch={false}>
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' assistant={true}></Employee>
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
- </OrgChart>
51
+ </OrgChartReact>
53
52
  }
54
53
 
55
54
  ```
@@ -59,7 +58,7 @@ export const ChartExample = () => {
59
58
 
60
59
  ```js
61
60
 
62
- import {OrgChart} from "../src/OrgChart.tsx";
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 <OrgChart style={{width: '100%', height: '100%'}} data={jsonData} nodeBinding={{ field_0: 'name', field_1: 'title' }} enableSearch={false}></OrgChart>
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
- import { OrgChart, Employee, OrgChartRef } from "../src/OrgChart.tsx";
122
+
123
+ import { OrgChartReact, Employee, OrgChartJS } from "../src/OrgChartReact.tsx";
92
124
 
93
125
  export const ChartExample = () => {
94
- const chartRef = useRef<OrgChartRef>(null);
126
+ const chartRef = useRef<OrgChartJS>(null);
95
127
 
96
- const handleExport = () => {
97
- chartRef.current?.instance?.exportToPDF();
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
- <OrgChart ref={chartRef} nodeBinding={{ field_0: "name", field_1: "title" }} style={{width: '100%', height: '100%'}} enableSearch={false}>
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" assistant />
142
+ <Employee name="Aaliyah Webb" title="Assistant" />
109
143
  </Employee>
110
- </OrgChart>
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