Skip to content

Commit 3b055a4

Browse files
author
Anto Gibson
authored
Sample Files initially comitted.
1 parent 00576c1 commit 3b055a4

17 files changed

+451
-0
lines changed

package.json

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "my-app",
3+
"version": "0.1.0",
4+
"private": true,
5+
"dependencies": {
6+
"@syncfusion/ej2-diagrams": "^25.2.4",
7+
"@syncfusion/ej2-react-diagrams": "^25.2.4",
8+
"@testing-library/jest-dom": "^5.17.0",
9+
"@testing-library/react": "^13.4.0",
10+
"@testing-library/user-event": "^13.5.0",
11+
"@types/jest": "^27.5.2",
12+
"@types/node": "^16.18.97",
13+
"@types/react": "^18.3.2",
14+
"@types/react-dom": "^18.3.0",
15+
"react": "^18.3.1",
16+
"react-dom": "^18.3.1",
17+
"react-scripts": "5.0.1",
18+
"typescript": "^4.9.5",
19+
"web-vitals": "^2.1.4"
20+
},
21+
"scripts": {
22+
"start": "react-scripts start",
23+
"build": "react-scripts build",
24+
"test": "react-scripts test",
25+
"eject": "react-scripts eject"
26+
},
27+
"eslintConfig": {
28+
"extends": [
29+
"react-app",
30+
"react-app/jest"
31+
]
32+
},
33+
"browserslist": {
34+
"production": [
35+
">0.2%",
36+
"not dead",
37+
"not op_mini all"
38+
],
39+
"development": [
40+
"last 1 chrome version",
41+
"last 1 firefox version",
42+
"last 1 safari version"
43+
]
44+
}
45+
}

public/favicon.ico

3.78 KB
Binary file not shown.

public/index.html

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta
9+
name="description"
10+
content="Web site created using create-react-app"
11+
/>
12+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13+
<!--
14+
manifest.json provides metadata used when your web app is installed on a
15+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16+
-->
17+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18+
<!--
19+
Notice the use of %PUBLIC_URL% in the tags above.
20+
It will be replaced with the URL of the `public` folder during the build.
21+
Only files inside the `public` folder can be referenced from the HTML.
22+
23+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24+
work correctly both with client-side routing and a non-root public URL.
25+
Learn how to configure a non-root public URL by running `npm run build`.
26+
-->
27+
<title>React App</title>
28+
</head>
29+
<body>
30+
<noscript>You need to enable JavaScript to run this app.</noscript>
31+
<div id="root"></div>
32+
<!--
33+
This HTML file is a template.
34+
If you open it directly in the browser, you will see an empty page.
35+
36+
You can add webfonts, meta tags, or analytics to this file.
37+
The build step will place the bundled scripts into the <body> tag.
38+
39+
To begin the development, run `npm start` or `yarn start`.
40+
To create a production bundle, use `npm run build` or `yarn build`.
41+
-->
42+
</body>
43+
</html>

public/logo192.png

5.22 KB
Loading

public/logo512.png

9.44 KB
Loading

public/manifest.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"short_name": "React App",
3+
"name": "Create React App Sample",
4+
"icons": [
5+
{
6+
"src": "favicon.ico",
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
9+
},
10+
{
11+
"src": "logo192.png",
12+
"type": "image/png",
13+
"sizes": "192x192"
14+
},
15+
{
16+
"src": "logo512.png",
17+
"type": "image/png",
18+
"sizes": "512x512"
19+
}
20+
],
21+
"start_url": ".",
22+
"display": "standalone",
23+
"theme_color": "#000000",
24+
"background_color": "#ffffff"
25+
}

public/robots.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# https://www.robotstxt.org/robotstxt.html
2+
User-agent: *
3+
Disallow:

src/App.css

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
.App {
2+
text-align: center;
3+
}
4+
5+
.App-logo {
6+
height: 40vmin;
7+
pointer-events: none;
8+
}
9+
10+
@media (prefers-reduced-motion: no-preference) {
11+
.App-logo {
12+
animation: App-logo-spin infinite 20s linear;
13+
}
14+
}
15+
16+
.App-header {
17+
background-color: #282c34;
18+
min-height: 100vh;
19+
display: flex;
20+
flex-direction: column;
21+
align-items: center;
22+
justify-content: center;
23+
font-size: calc(10px + 2vmin);
24+
color: white;
25+
}
26+
27+
.App-link {
28+
color: #61dafb;
29+
}
30+
31+
@keyframes App-logo-spin {
32+
from {
33+
transform: rotate(0deg);
34+
}
35+
to {
36+
transform: rotate(360deg);
37+
}
38+
}
39+
40+
@import "../node_modules/@syncfusion/ej2-diagrams/styles/material.css";
41+
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
42+
@import "../node_modules/@syncfusion/ej2-popups/styles/material.css";
43+
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css";
44+
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";

src/App.test.tsx

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
import { render, screen } from '@testing-library/react';
3+
import App from './App';
4+
5+
test('renders learn react link', () => {
6+
render(<App />);
7+
const linkElement = screen.getByText(/learn react/i);
8+
expect(linkElement).toBeInTheDocument();
9+
});

src/App.tsx

+201
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
import {
2+
DiagramComponent,
3+
DataSourceModel,
4+
LayoutModel,
5+
DataBinding,
6+
HierarchicalTree,
7+
Inject,
8+
NodeModel,
9+
ConnectorModel
10+
} from "@syncfusion/ej2-react-diagrams";
11+
import {DataManager} from "@syncfusion/ej2-data";
12+
function App() {
13+
const diagramItems : object[] = [
14+
{
15+
Id: "parent",
16+
Role: "Project Management",
17+
},
18+
{
19+
Id: 1,
20+
Role: "R&D Team",
21+
Team: "parent",
22+
},
23+
{
24+
Id: 3,
25+
Role: "Philosophy",
26+
Team: "1",
27+
},
28+
{
29+
Id: 4,
30+
Role: "Organization",
31+
Team: "1",
32+
},
33+
{
34+
Id: 5,
35+
Role: "Technology",
36+
Team: "1",
37+
},
38+
{
39+
Id: 7,
40+
Role: "Funding",
41+
Team: "1",
42+
},
43+
{
44+
Id: 8,
45+
Role: "Resource Allocation",
46+
Team: "1",
47+
},
48+
{
49+
Id: 9,
50+
Role: "Targeting",
51+
Team: "1",
52+
},
53+
{
54+
Id: 11,
55+
Role: "Evaluation",
56+
Team: "1",
57+
},
58+
{
59+
Id: 156,
60+
Role: "HR Team",
61+
Team: "parent",
62+
},
63+
{
64+
Id: 13,
65+
Role: "Recruitment",
66+
Team: "156",
67+
},
68+
{
69+
Id: 113,
70+
Role: "Training",
71+
Team: "12",
72+
},
73+
{
74+
Id: 112,
75+
Role: "Employee Relation",
76+
Team: "156",
77+
},
78+
{
79+
Id: 14,
80+
Role: "Record Keeping",
81+
Team: "12",
82+
},
83+
{
84+
Id: 15,
85+
Role: "Compensations & Benefits",
86+
Team: "12",
87+
},
88+
{
89+
Id: 16,
90+
Role: "Compliances",
91+
Team: "12",
92+
},
93+
{
94+
Id: 17,
95+
Role: "Production & Sales Team",
96+
Team: "parent",
97+
},
98+
{
99+
Id: 119,
100+
Role: "Design",
101+
Team: "17",
102+
},
103+
{
104+
Id: 19,
105+
Role: "Operation",
106+
Team: "17",
107+
},
108+
{
109+
Id: 20,
110+
Role: "Support",
111+
Team: "17",
112+
},
113+
{
114+
Id: 21,
115+
Role: "Quality Assurance",
116+
Team: "17",
117+
},
118+
{
119+
Id: 23,
120+
Role: "Customer Interaction",
121+
Team: "17",
122+
},
123+
{
124+
Id: 24,
125+
Role: "Support and Maintenance",
126+
Team: "17",
127+
},
128+
{
129+
Id: 25,
130+
Role: "Task Coordination",
131+
Team: "17",
132+
},
133+
]
134+
const remoteData : DataManager = new DataManager(diagramItems as JSON[]);
135+
const dataSource : DataSourceModel = {
136+
id:"Id",
137+
parentId:"Team",
138+
dataManager :remoteData
139+
}
140+
const diagramLayout : LayoutModel = {
141+
type:"OrganizationalChart",
142+
margin:{top:20},
143+
horizontalSpacing:25,
144+
verticalSpacing:30,
145+
horizontalAlignment:"Left",
146+
verticalAlignment:"Center"
147+
}
148+
const defaultNodeSetting = (defaultNode:NodeModel) =>{
149+
defaultNode.shape = {
150+
type : "Text",
151+
content:(defaultNode.data as {Role:"string"}).Role,
152+
}
153+
defaultNode.style = {
154+
fill:"None",
155+
strokeColor:"None",
156+
bold:true,
157+
color:"white"
158+
}
159+
defaultNode.backgroundColor = "#6BA5D7";
160+
defaultNode.width = 90;
161+
defaultNode.height = 60;
162+
defaultNode.margin= {
163+
left : 5,
164+
right:5,
165+
top:5,
166+
bottom:5
167+
}
168+
return defaultNode;
169+
}
170+
const defaultConnectorSetting = (defaultConnector:ConnectorModel) =>{
171+
defaultConnector.style = {
172+
strokeWidth:2,
173+
strokeColor:"#6BA5D7"
174+
}
175+
if(defaultConnector.targetDecorator?.style){
176+
defaultConnector.targetDecorator.style={
177+
fill:"#6BA5D7",
178+
strokeColor:"#6BA5D7"
179+
}
180+
}
181+
defaultConnector.type = "Orthogonal";
182+
return defaultConnector;
183+
}
184+
return (
185+
<div>
186+
<DiagramComponent
187+
id="container"
188+
width={"100%"}
189+
height={"750px"}
190+
dataSourceSettings={dataSource}
191+
layout={diagramLayout}
192+
getConnectorDefaults={defaultConnectorSetting}
193+
getNodeDefaults={defaultNodeSetting}
194+
>
195+
<Inject services = {[DataBinding, HierarchicalTree]}/>
196+
</DiagramComponent>
197+
</div>
198+
);
199+
}
200+
201+
export default App;

src/index.css

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
body {
2+
margin: 0;
3+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5+
sans-serif;
6+
-webkit-font-smoothing: antialiased;
7+
-moz-osx-font-smoothing: grayscale;
8+
}
9+
10+
code {
11+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12+
monospace;
13+
}

0 commit comments

Comments
 (0)