forked from BasicPrimitives/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCaseInactiveFamilyItemsSelection.html
More file actions
205 lines (186 loc) · 9.37 KB
/
Copy pathCaseInactiveFamilyItemsSelection.html
File metadata and controls
205 lines (186 loc) · 9.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Inactive items in family chart layout</title>
<script type="text/javascript" src="../../primitives.js"></script>
<link href="../../css/primitives.css" media="screen" rel="stylesheet" type="text/css" />
<script type='text/javascript'>
var control;
document.addEventListener('DOMContentLoaded', function () {
var options = new primitives.FamConfig();
var items = [
new primitives.FamItemConfig({
id: 2000,
parents: null,
title: "James Smith",
description: "Co-CEO",
image: "../images/photos/a.png"
}),
new primitives.FamItemConfig({
id: 2100,
parents: null,
title: "James Smith 2",
description: "Co-CEO",
image: "../images/photos/a.png"
}),
new primitives.FamItemConfig({ id: 2001, parents: [2000, 2100], hasSelectorCheckbox: false, templateName: "DepartmentTitleTemplate", title: "Finance", itemTitleColor: "Green" }),
new primitives.FamItemConfig({
id: 1000,
parents: null,
title: "James Smith",
description: "Co-CEO",
image: "../images/photos/a.png"
}),
new primitives.FamItemConfig({
id: 1100,
parents: null,
title: "James Smith 2",
description: "Co-CEO",
image: "../images/photos/a.png"
}),
new primitives.FamItemConfig({ id: 1001, parents: [1000, 1100], hasSelectorCheckbox: false, templateName: "DepartmentTitleTemplate", title: "Finance", itemTitleColor: "Green" }),
new primitives.FamItemConfig({
id: 0,
parents: null,
title: "James Smith",
description: "Co-CEO",
image: "../images/photos/a.png"
}),
new primitives.FamItemConfig({
id: 100,
parents: null,
title: "James Smith 2",
description: "Co-CEO",
image: "../images/photos/a.png"
}),
new primitives.FamItemConfig({ id: 1, parents: [0, 100], hasSelectorCheckbox: false, templateName: "DepartmentTitleTemplate", title: "Finance", itemTitleColor: "Green" }),
new primitives.FamItemConfig({
id: 2,
parents: [1],
title: "Ted Lucas",
description: "VP, Human Resources",
image: "../images/photos/b.png"
}),
new primitives.FamItemConfig({ id: 3, parents: [0, 100], hasSelectorCheckbox: false, templateName: "DepartmentTitleTemplate", title: "Sales", itemTitleColor: "Navy" }),
new primitives.FamItemConfig({
id: 4,
parents: [3],
title: "Fritz Stuger",
description: "VP, Human Resources",
image: "../images/photos/b.png"
}),
new primitives.FamItemConfig({ id: 5, parents: [0, 100], hasSelectorCheckbox: false, templateName: "DepartmentTitleTemplate", title: "Operations", itemTitleColor: "Magenta" }),
new primitives.FamItemConfig({
id: 6,
parents: [5],
title: "Brad Whitt",
description: "VP, Human Resources",
image: "../images/photos/b.png"
}),
new primitives.FamItemConfig({ id: 7, parents: [0, 100], hasSelectorCheckbox: false, templateName: "DepartmentTitleTemplate", title: "IT", itemTitleColor: "Orange" }),
new primitives.FamItemConfig({
id: 8,
parents: [7],
title: "Ted Whitt",
description: "VP, Human Resources",
image: "../images/photos/b.png"
}),
new primitives.FamItemConfig({
id: 18,
parents: [7],
title: "Ted Whitt 2",
description: "VP, Human Resources",
image: "../images/photos/b.png"
}),
{ id: 19, parents: [2], isVisible: true, description: "VP, Security Technology Unit (STU)", email: "robemorg@name.com", groupTitleColor: "#4169e1", image: "../images/photos/y.png", itemTitleColor: "#4b0082", phone: "308-532-6548", title: "Robert Morgan" },
{ id: 20, parents: [2], isVisible: true, description: "GM, Software Serviceability", email: "idabene@name.com", groupTitleColor: "#4169e1", image: "../images/photos/a.png", itemTitleColor: "#4b0082", phone: "765-723-1327", title: "Ida Benefield" },
{ id: 21, parents: [4], isVisible: true, description: "GM, Core Operating System Test", email: "vadaduho@name.com", groupTitleColor: "#4169e1", image: "../images/photos/d.png", itemTitleColor: "#4b0082", phone: "303-333-9215", title: "Vada Duhon" },
{ id: 22, parents: [4], isVisible: true, description: "GM, Global Platform Technologies and Services", email: "willloyd@name.com", groupTitleColor: "#4169e1", image: "../images/photos/f.png", itemTitleColor: "#4b0082", phone: "585-309-6253", title: "William Loyd" },
{ id: 23, parents: [6], isVisible: true, description: "Sr. VP, NAME & Personal Services Division", email: "craiblue@name.com", groupTitleColor: "#4169e1", image: "../images/photos/g.png", itemTitleColor: "#4b0082", phone: "915-355-4705", title: "Craig Blue" },
{ id: 24, parents: [6], isVisible: true, description: "VP, NAME Communications Services and Member Platform", email: "joelcraw@name.com", groupTitleColor: "#4169e1", image: "../images/photos/h.png", itemTitleColor: "#4b0082", phone: "650-623-3302", title: "Joel Crawford" },
{ id: 25, parents: [8], isVisible: true, description: "VP & CFO, NAME", email: "barblang@name.com", groupTitleColor: "#4169e1", image: "../images/photos/o.png", itemTitleColor: "#4b0082", phone: "618-822-7345", title: "Barbara Lang" },
{ id: 26, parents: [8], isVisible: true, description: "VP, NAME Operations", email: "barbfaul@name.com", groupTitleColor: "#4169e1", image: "../images/photos/d.png", itemTitleColor: "#4b0082", phone: "641-678-7646", title: "Barbara Faulk" },
{ id: 27, parents: [18], isVisible: true, description: "VP, NAME Global Sales & Marketing", email: "stewwill@name.com", groupTitleColor: "#4169e1", image: "../images/photos/z.png", itemTitleColor: "#4b0082", phone: "803-746-8733", title: "Stewart Williams" },
{ id: 28, parents: [18], isVisible: true, description: "Sr. VP, NAME Information Services & Merchant Platform", email: "robelemi@name.com", groupTitleColor: "#4169e1", image: "../images/photos/y.png", itemTitleColor: "#4b0082", phone: "425-590-4308", title: "Robert Lemieux" }
];
options.items = items;
options.cursorItem = 0;
options.selectionPathMode = primitives.SelectionPathMode.FullStack;
options.neighboursSelectionMode = primitives.NeighboursSelectionMode.ParentsChildrenSiblingsAndSpouses;
options.templates = [getDepartmentTitleTemplate()];
options.onItemRender = onTemplateRender;
options.hasSelectorCheckbox = primitives.Enabled.True;
options.normalLevelShift = 20;
options.dotLevelShift = 20;
options.lineLevelShift = 10;
options.normalItemsInterval = 10;
options.dotItemsInterval = 10;
options.lineItemsInterval = 4;
control = primitives.FamDiagram(document.getElementById("basicdiagram"), options);
});
function onTemplateRender(event, data) {
switch (data.renderingMode) {
case primitives.RenderingMode.Create:
/* Initialize template content here */
break;
case primitives.RenderingMode.Update:
/* Update template content here */
break;
}
var itemConfig = data.context;
var element = data.element;
if (data.templateName == "DepartmentTitleTemplate") {
element.firstChild.style.backgroundColor = itemConfig.itemTitleColor || primitives.Colors.RoyalBlue;
element.firstChild.firstChild.textContent = itemConfig.title;
}
}
function getDepartmentTitleTemplate() {
var result = new primitives.TemplateConfig();
result.name = "DepartmentTitleTemplate";
result.isActive = false;
result.itemSize = new primitives.Size(200, 30);
result.minimizedItemSize = new primitives.Size(3, 3);
/* the following example demonstrates JSONML template see http://http://www.jsonml.org/ for details: */
result.itemTemplate = ["div",
{
"style": {
width: result.itemSize.width + "px",
height: result.itemSize.height + "px"
},
"class": ["bp-item", "bp-corner-all", "bt-item-frame"]
},
["div",
{
"name": "titleBackground",
"style": {
top: "2px",
left: "2px",
width: "196px",
height: "25px"
},
"class": ["bp-item", "bp-corner-all", "bt-title-frame"]
},
["div",
{
name: "title",
"class": ["bp-item", "bp-title"],
style: {
top: "3px",
left: "6px",
width: "188px",
height: "23px",
textAlign: "center"
}
}
]
]
];
return result;
}
</script>
</head>
<body>
<div id="basicdiagram" style="width: 640px; height: 480px; border-style: dotted; border-width: 1px;"></div>
</body>
</html>