Skip to content

Commit da289e9

Browse files
Added levels and level annotations to org editor demo
1 parent 9add97d commit da289e9

File tree

9 files changed

+411
-5637
lines changed

9 files changed

+411
-5637
lines changed

client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"@testing-library/react": "^11.1.0",
1616
"@testing-library/user-event": "^12.1.10",
1717
"axios": "^0.21.0",
18-
"basicprimitives": "^6.1.0",
19-
"basicprimitivesreact": "^6.1.1",
18+
"basicprimitives": "^6.1.1",
19+
"basicprimitivesreact": "^6.1.2",
2020
"blob-stream": "^0.1.3",
2121
"clsx": "^1.1.1",
2222
"codemirror": "^5.58.2",

client/src/redux/modules/demos/orgeditor.js

Lines changed: 91 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { OrgConfig, TemplateConfig, Size, Thickness, PageFitMode,
1+
import {AnnotationType, OrgConfig, TemplateConfig, Size, Thickness, PageFitMode,
22
Enabled, LineType, OrientationType, VerticalAlignmentType, HorizontalAlignmentType,
33
ChildrenPlacementType, Visibility, SelectionPathMode, Colors,
44
TextOrientationType, GroupByType, ConnectorType,
@@ -79,6 +79,92 @@ const config = {
7979
}
8080
],
8181
items: [],
82+
annotations: [
83+
{
84+
annotationType: AnnotationType.Level,
85+
levels: [0],
86+
title: "CEO",
87+
titleColor: Colors.RoyalBlue,
88+
offset: new Thickness(0, 0, 0, -5),
89+
lineWidth: new Thickness(0, 0, 0, 0),
90+
opacity: 0,
91+
borderColor: Colors.Gray,
92+
fillColor: Colors.Gray,
93+
lineType: LineType.Dotted
94+
},
95+
{
96+
annotationType: AnnotationType.Level,
97+
levels: [1],
98+
title: "Management",
99+
titleColor: Colors.RoyalBlue,
100+
offset: new Thickness(0, 4, 0, -15),
101+
lineWidth: new Thickness(0, 0, 0, 0),
102+
opacity: 0.08,
103+
borderColor: Colors.Gray,
104+
fillColor: Colors.Gray,
105+
lineType: LineType.Dotted
106+
},
107+
{
108+
annotationType: AnnotationType.Level,
109+
levels: [2],
110+
title: "Grade 1",
111+
titleColor: Colors.RoyalBlue,
112+
offset: new Thickness(0, 14, 0, -1),
113+
lineWidth: new Thickness(0, 0, 0, 0),
114+
opacity: 0,
115+
borderColor: Colors.Gray,
116+
fillColor: Colors.Gray,
117+
lineType: LineType.Dotted
118+
},
119+
{
120+
annotationType: AnnotationType.Level,
121+
levels: [3],
122+
title: "Grade 2",
123+
titleColor: Colors.RoyalBlue,
124+
offset: new Thickness(0, 0, 0, -1),
125+
lineWidth: new Thickness(0, 0, 0, 0),
126+
opacity: 0.08,
127+
borderColor: Colors.Gray,
128+
fillColor: Colors.Gray,
129+
lineType: LineType.Dotted
130+
},
131+
{
132+
annotationType: AnnotationType.Level,
133+
levels: [4],
134+
title: "Grade 3",
135+
titleColor: Colors.RoyalBlue,
136+
offset: new Thickness(0, 0, 0, -1),
137+
lineWidth: new Thickness(0, 0, 0, 0),
138+
opacity: 0,
139+
borderColor: Colors.Gray,
140+
fillColor: Colors.Gray,
141+
lineType: LineType.Dotted
142+
},
143+
{
144+
annotationType: AnnotationType.Level,
145+
levels: [5],
146+
title: "Grade 4",
147+
titleColor: Colors.RoyalBlue,
148+
offset: new Thickness(0, 0, 0, -1),
149+
lineWidth: new Thickness(0, 0, 0, 0),
150+
opacity: 0.08,
151+
borderColor: Colors.Gray,
152+
fillColor: Colors.Gray,
153+
lineType: LineType.Dotted
154+
},
155+
{
156+
annotationType: AnnotationType.Level,
157+
levels: [6],
158+
title: "Regular Members",
159+
titleColor: Colors.RoyalBlue,
160+
offset: new Thickness(0, 0, 0, -1),
161+
lineWidth: new Thickness(0, 0, 0, 0),
162+
opacity: 0,
163+
borderColor: Colors.Gray,
164+
fillColor: Colors.Gray,
165+
lineType: LineType.Dotted
166+
}
167+
],
82168
onSave: null,
83169
editMode: true,
84170
navigationMode: NavigationMode.Default,
@@ -88,7 +174,7 @@ const config = {
88174
showExtraArrows: false,
89175
extraArrowsMinimumSpace: 30,
90176
horizontalAlignment: HorizontalAlignmentType.Center,
91-
connectorType: ConnectorType.Angular,
177+
connectorType: ConnectorType.Squared,
92178
bevelSize: 4,
93179
elbowType: ElbowType.None,
94180
elbowDotSize: 4,
@@ -129,14 +215,14 @@ const config = {
129215
groupTitleFontStyle: 'normal',
130216
scale: 1,
131217
normalLevelShift: 20,
132-
dotLevelShift: 10,
218+
dotLevelShift: 16,
133219
lineLevelShift: 10,
134220
normalItemsInterval: 20,
135-
dotItemsInterval: 10,
221+
dotItemsInterval: 20,
136222
lineItemsInterval: 5,
137223
cousinsIntervalMultiplier: 5,
138224
showLabels: Enabled.Auto,
139-
labelSize: new Size(10, 24),
225+
labelSize: new Size(20, 14),
140226
labelOffset: 1,
141227
labelOrientation: TextOrientationType.Horizontal,
142228
labelPlacement: PlacementType.Top,

client/src/redux/modules/demos/verticallayoutorganizationalchart.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const initialState = {
129129

130130
/* Labels */
131131
showLabels: Enabled.Auto,
132-
labelSize: new Size(10, 14),
132+
labelSize: new Size(14, 14),
133133
labelOrientation: TextOrientationType.Horizontal,
134134
labelPlacement: PlacementType.Bottom,
135135
labelOffset: 3,
@@ -277,6 +277,7 @@ export default function reducer(state = initialState, action = {}) {
277277
const { items } = newConfig;
278278
newConfig["horizontalAlignment"] = isLTR ? HorizontalAlignmentType.Right : HorizontalAlignmentType.Left;
279279
newConfig["groupTitlePlacementType"] = isLTR ? AdviserPlacementType.Right : AdviserPlacementType.Left;
280+
newConfig["levelTitlePlacementType"] = isLTR ? AdviserPlacementType.Right : AdviserPlacementType.Left;
280281
newConfig["groupTitleOrientation"] = isLTR ? TextOrientationType.RotateLeft : TextOrientationType.RotateRight;
281282

282283
newConfig.items = items.map(item => {

client/yarn.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2862,17 +2862,17 @@ base@^0.11.1:
28622862
mixin-deep "^1.2.0"
28632863
pascalcase "^0.1.1"
28642864

2865-
basicprimitives@6.1.0, basicprimitives@^6.1.0:
2866-
version "6.1.0"
2867-
resolved "https://registry.yarnpkg.com/basicprimitives/-/basicprimitives-6.1.0.tgz#1c3c036f25b27b053b5e886e7e771ff05550361f"
2868-
integrity sha512-tsxBraeJrGjb0mA177H2f+8ykhrTroFZ2XBLCBb+WHcvR6KsN2s+UR1OptyusvnCZAQkx907U9xhhDqMAF1tNA==
2869-
2870-
basicprimitivesreact@^6.1.1:
2865+
basicprimitives@6.1.1, basicprimitives@^6.1.1:
28712866
version "6.1.1"
2872-
resolved "https://registry.yarnpkg.com/basicprimitivesreact/-/basicprimitivesreact-6.1.1.tgz#82e3f9c1762eaee42f7112dda5366f76f3ca2119"
2873-
integrity sha512-FQkH3aaMbMRBzrRnctP5uCfyPr4fVL6b8urCc9S8TfAtgvRjWw4gYT68NHm9F6iNJJbsoIjDVHY4XqcxfkrYBQ==
2867+
resolved "https://registry.yarnpkg.com/basicprimitives/-/basicprimitives-6.1.1.tgz#a467f0020b338a6d6ccebed2429a0719c4506a6e"
2868+
integrity sha512-ePiZ7xa7cwUcdjyV8MnQBOnVN/Ks5CMW8zKbqFaMdBqiyQ/sTyLLMG6DC6PXV/L7bu0M1Ibfkjj1gnqw/KGUSw==
2869+
2870+
basicprimitivesreact@^6.1.2:
2871+
version "6.1.2"
2872+
resolved "https://registry.yarnpkg.com/basicprimitivesreact/-/basicprimitivesreact-6.1.2.tgz#8757bb866e2be925ce07d4027c161d202f429162"
2873+
integrity sha512-9u5DjUkokISfIAuQEUcX2svS4VUBzTw3sho7mIOr543LtgTNJ8X6Xx0RC5ve1uIOGOkbG1ADcAM4nAzGqHb/Xg==
28742874
dependencies:
2875-
basicprimitives "6.1.0"
2875+
basicprimitives "6.1.1"
28762876
resize-observer-polyfill "^1.5.1"
28772877

28782878
batch@0.6.1:

server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"@feathersjs/rest-client": "^1.3.2",
2828
"@feathersjs/socketio": "^3.0.1",
2929
"@feathersjs/socketio-client": "^1.0.1",
30-
"basicprimitives": "6.1.0",
30+
"basicprimitives": "6.1.1",
3131
"compression": "^1.6.2",
3232
"cookie-parser": "^1.4.3",
3333
"cookies-js": "^1.2.3",

0 commit comments

Comments
 (0)