balkan-orgchart-react-community 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/package.json CHANGED
@@ -54,7 +54,7 @@
54
54
  "url": "git+https://github.com/BALKANGraph/OrgChartReact-Community.git"
55
55
  },
56
56
  "dependencies": {
57
- "balkan-orgchart-js-community": "^9.1.86"
57
+ "balkan-orgchart-js-community": "^9.1.101"
58
58
  },
59
- "version": "9.1.86"
59
+ "version": "9.1.101"
60
60
  }
package/readme.md CHANGED
@@ -39,20 +39,18 @@ yarn add balkan-orgchart-react
39
39
 
40
40
  ```js
41
41
 
42
-
43
- import { OrgChartReact, Employee } from 'balkan-orgchart-react-community';
42
+ import {OrgChartReact, Employee} from "../src/OrgChartReact.tsx";
44
43
 
45
44
  export const ChartExample = () => {
46
- return <OrgChartReact 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
51
  </OrgChartReact>
53
52
  }
54
53
 
55
-
56
54
  ```
57
55
 
58
56
 
@@ -60,7 +58,7 @@ export const ChartExample = () => {
60
58
 
61
59
  ```js
62
60
 
63
- import {OrgChartReact} from 'balkan-orgchart-react-community';
61
+ import {OrgChartReact} from "../src/OrgChartReact.tsx";
64
62
 
65
63
  export const ChartExample = () => {
66
64
  const [jsonData, setJsonData] = useState([]);
@@ -76,13 +74,44 @@ export const ChartExample = () => {
76
74
  })
77
75
  }, []);
78
76
 
79
- return <OrgChartReact style={{width: '100%', height: '100%'}} data={jsonData} nodeBinding={{ field_0: 'name', field_1: 'title' }} enableSearch={false}></OrgChartReact>
77
+ return <OrgChartReact data={jsonData} nodeBinding={{ field_0: 'name', field_1: 'title' }}></OrgChartReact>
80
78
  }
81
79
 
82
80
 
81
+
83
82
  ```
84
83
 
84
+ ## Custom Template
85
85
 
86
+ ```js
87
+ import {OrgChartReact, Employee, Template} from "../src/OrgChartReact.tsx";
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
+ ```
86
115
 
87
116
 
88
117
  ## API Call
@@ -90,7 +119,8 @@ export const ChartExample = () => {
90
119
 
91
120
  ```js
92
121
 
93
- import { OrgChartReact, Employee } from 'balkan-orgchart-react-community';
122
+
123
+ import { OrgChartReact, Employee, OrgChartJS } from "../src/OrgChartReact.tsx";
94
124
 
95
125
  export const ChartExample = () => {
96
126
  const chartRef = useRef<OrgChartJS>(null);
@@ -102,14 +132,14 @@ export const ChartExample = () => {
102
132
  };
103
133
 
104
134
  return (
105
- <>
135
+ <>
106
136
  <button onClick={handleExport} style={{ fontSize: "24px"}}>Export PDF</button>
107
137
 
108
- <OrgChartReact ref={chartRef} nodeBinding={{ field_0: "name", field_1: "title" }} style={{width: '100%', height: '100%'}} enableSearch={false}>
109
- <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">
110
140
  <Employee name="Lexie Cole" title="QA Lead" />
111
141
  <Employee name="Janae Barrett" title="Technical Director" />
112
- <Employee name="Aaliyah Webb" title="Assistant" assistant />
142
+ <Employee name="Aaliyah Webb" title="Assistant" />
113
143
  </Employee>
114
144
  </OrgChartReact>
115
145
  </>
@@ -120,6 +150,8 @@ export const ChartExample = () => {
120
150
  ```
121
151
 
122
152
 
153
+
154
+
123
155
  You can call any API method from [here](https://balkan.app/OrgChartJS/API/classes/OrgChart)
124
156
 
125
157