balkan-orgchart-react 9.1.86 → 9.1.102

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 +16 -1
  2. package/index.es.js +18749 -3511
  3. package/index.umd.js +301 -113
  4. package/package.json +2 -2
  5. package/readme.md +45 -16
package/package.json CHANGED
@@ -54,7 +54,7 @@
54
54
  "url": "git+https://github.com/BALKANGraph/OrgChartReact.git"
55
55
  },
56
56
  "dependencies": {
57
- "balkan-orgchart-js": "^9.1.86"
57
+ "balkan-orgchart-js": "^9.1.102"
58
58
  },
59
- "version": "9.1.86"
59
+ "version": "9.1.102"
60
60
  }
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 "balkan-orgchart-react";
42
41
 
43
42
  export const ChartExample = () => {
44
- return <OrgChartReact nodeBinding={{ field_0: 'name', field_1: 'title' }} style={{width: '100%', height: '100%'}} enableSearch={false}>
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' assistant={true}></Employee>
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 'balkan-orgchart-react';
59
+ import {OrgChartReact} from "balkan-orgchart-react";
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 style={{width: '100%', height: '100%'}} data={jsonData} nodeBinding={{ field_0: 'name', field_1: 'title' }} enableSearch={false}></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 "balkan-orgchart-react";
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 'balkan-orgchart-react';
119
+ import { OrgChartReact, Employee, OrgChartJS } from "balkan-orgchart-react";
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 ref={chartRef} nodeBinding={{ field_0: "name", field_1: "title" }} style={{width: '100%', height: '100%'}} enableSearch={false}>
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" 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