orgchart 3.1.1 → 3.1.2
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/README.md +57 -0
- package/demo/get-related-nodes.html +149 -0
- package/demo/index.html +1 -0
- package/dist/js/jquery.orgchart.js +11 -2
- package/dist/js/jquery.orgchart.min.js +1 -1
- package/dist/js/jquery.orgchart.min.js.map +1 -1
- package/package.json +3 -2
- package/src/js/jquery.orgchart.js +11 -2
- package/test/unit/tests.js +33 -1
package/README.md
CHANGED
|
@@ -685,6 +685,63 @@ This method returns you the nodes related to the specified node.
|
|
|
685
685
|
</tr>
|
|
686
686
|
</table>
|
|
687
687
|
|
|
688
|
+
#### getParent($node)
|
|
689
|
+
This method returns you the parent node of the specified node.
|
|
690
|
+
<table>
|
|
691
|
+
<tr>
|
|
692
|
+
<th>Name</th>
|
|
693
|
+
<th>Type</th>
|
|
694
|
+
<th>Required</th>
|
|
695
|
+
<th>Default</th>
|
|
696
|
+
<th>Description</th>
|
|
697
|
+
</tr>
|
|
698
|
+
<tr>
|
|
699
|
+
<td>$node</td>
|
|
700
|
+
<td>JQuery Object</td>
|
|
701
|
+
<td>Yes</td>
|
|
702
|
+
<td></td>
|
|
703
|
+
<td>It's the desired JQuery Object to know its parent node</td>
|
|
704
|
+
</tr>
|
|
705
|
+
</table>
|
|
706
|
+
|
|
707
|
+
#### getSiblings($node)
|
|
708
|
+
This method returns you the sibling nodes of the specified node.
|
|
709
|
+
<table>
|
|
710
|
+
<tr>
|
|
711
|
+
<th>Name</th>
|
|
712
|
+
<th>Type</th>
|
|
713
|
+
<th>Required</th>
|
|
714
|
+
<th>Default</th>
|
|
715
|
+
<th>Description</th>
|
|
716
|
+
</tr>
|
|
717
|
+
<tr>
|
|
718
|
+
<td>$node</td>
|
|
719
|
+
<td>JQuery Object</td>
|
|
720
|
+
<td>Yes</td>
|
|
721
|
+
<td></td>
|
|
722
|
+
<td>It's the desired JQuery Object to know its sibling nodes</td>
|
|
723
|
+
</tr>
|
|
724
|
+
</table>
|
|
725
|
+
|
|
726
|
+
#### getChildren($node)
|
|
727
|
+
This method returns you the child nodes of the specified node.
|
|
728
|
+
<table>
|
|
729
|
+
<tr>
|
|
730
|
+
<th>Name</th>
|
|
731
|
+
<th>Type</th>
|
|
732
|
+
<th>Required</th>
|
|
733
|
+
<th>Default</th>
|
|
734
|
+
<th>Description</th>
|
|
735
|
+
</tr>
|
|
736
|
+
<tr>
|
|
737
|
+
<td>$node</td>
|
|
738
|
+
<td>JQuery Object</td>
|
|
739
|
+
<td>Yes</td>
|
|
740
|
+
<td></td>
|
|
741
|
+
<td>It's the desired JQuery Object to know its child nodes</td>
|
|
742
|
+
</tr>
|
|
743
|
+
</table>
|
|
744
|
+
|
|
688
745
|
#### setChartScale($chart, newScale)
|
|
689
746
|
This method helps you set the specified chart with new scale.
|
|
690
747
|
<table>
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Organization Chart Plugin</title>
|
|
6
|
+
<link rel="icon" href="img/logo.png">
|
|
7
|
+
<link rel="stylesheet" href="css/jquery.orgchart.css">
|
|
8
|
+
<link rel="stylesheet" href="css/style.css">
|
|
9
|
+
<style type="text/css">
|
|
10
|
+
#chart-container { height: 620px; }
|
|
11
|
+
.orgchart { background: white; }
|
|
12
|
+
.orgchart .node.highlight-parent .title, .chart-legend__item__color.highlight-parent {
|
|
13
|
+
background-color: blue;
|
|
14
|
+
}
|
|
15
|
+
.orgchart .node.highlight-parent .content {
|
|
16
|
+
border: 1px solid blue;
|
|
17
|
+
}
|
|
18
|
+
.orgchart .node.highlight-siblings .title, .chart-legend__item__color.highlight-siblings {
|
|
19
|
+
background-color: green;
|
|
20
|
+
}
|
|
21
|
+
.orgchart .node.highlight-siblings .content {
|
|
22
|
+
border: 1px solid green;
|
|
23
|
+
}
|
|
24
|
+
.orgchart .node.highlight-children .title, .chart-legend__item__color.highlight-children {
|
|
25
|
+
background-color: #aeaeae;
|
|
26
|
+
}
|
|
27
|
+
.orgchart .node.highlight-children .content {
|
|
28
|
+
border: 1px solid #aeaeae;
|
|
29
|
+
}
|
|
30
|
+
#chart-legend {
|
|
31
|
+
padding: 10px;
|
|
32
|
+
width: 300px;
|
|
33
|
+
margin: 0 auto;
|
|
34
|
+
margin-top: 10px;
|
|
35
|
+
border: 2px dashed #aaa;
|
|
36
|
+
}
|
|
37
|
+
#chart-legend__title {
|
|
38
|
+
margin-bottom: 10px;
|
|
39
|
+
font-weight: bold;
|
|
40
|
+
}
|
|
41
|
+
.chart-legend__item {
|
|
42
|
+
margin-bottom: 5px;
|
|
43
|
+
padding: 5px 10px;
|
|
44
|
+
}
|
|
45
|
+
.chart-legend__item__color,
|
|
46
|
+
.chart-legend__item__title {
|
|
47
|
+
vertical-align: middle;
|
|
48
|
+
line-height: 20px;
|
|
49
|
+
}
|
|
50
|
+
.chart-legend__item__color {
|
|
51
|
+
width: 20px;
|
|
52
|
+
height: 20px;
|
|
53
|
+
border-radius: 20px;
|
|
54
|
+
}
|
|
55
|
+
.chart-legend__item div {
|
|
56
|
+
display: inline-block;
|
|
57
|
+
}
|
|
58
|
+
</style>
|
|
59
|
+
</head>
|
|
60
|
+
<body>
|
|
61
|
+
<div id="chart-legend">
|
|
62
|
+
<div id="chart-legend__title">Legend</div>
|
|
63
|
+
<div class="chart-legend__item">
|
|
64
|
+
<div class="chart-legend__item__color highlight-parent"></div>
|
|
65
|
+
<div class="chart-legend__item__title">Parent</div>
|
|
66
|
+
</div>
|
|
67
|
+
<div class="chart-legend__item">
|
|
68
|
+
<div class="chart-legend__item__color highlight-children"></div>
|
|
69
|
+
<div class="chart-legend__item__title">Children</div>
|
|
70
|
+
</div>
|
|
71
|
+
<div class="chart-legend__item">
|
|
72
|
+
<div class="chart-legend__item__color highlight-siblings"></div>
|
|
73
|
+
<div class="chart-legend__item__title">Siblings</div>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
<div id="chart-container"></div>
|
|
77
|
+
|
|
78
|
+
<script type="text/javascript" src="js/jquery.min.js"></script>
|
|
79
|
+
<script type="text/javascript" src="js/jquery.orgchart.js"></script>
|
|
80
|
+
<script type="text/javascript">
|
|
81
|
+
$(function() {
|
|
82
|
+
|
|
83
|
+
var datasource = {
|
|
84
|
+
'name': 'Lao Lao',
|
|
85
|
+
'title': 'general manager',
|
|
86
|
+
'children': [
|
|
87
|
+
{ 'name': 'Bo Miao', 'title': 'department manager' },
|
|
88
|
+
{ 'name': 'Su Miao', 'title': 'department manager',
|
|
89
|
+
'children': [
|
|
90
|
+
{ 'name': 'Tie Hua', 'title': 'senior engineer' },
|
|
91
|
+
{ 'name': 'Hei Hei', 'title': 'senior engineer',
|
|
92
|
+
'children': [
|
|
93
|
+
{ 'name': 'Pang Pang', 'title': 'engineer' },
|
|
94
|
+
{ 'name': 'Dan Dan', 'title': 'UE engineer' ,
|
|
95
|
+
'children': [
|
|
96
|
+
{ 'name': 'Er Dan', 'title': 'engineer' },
|
|
97
|
+
{ 'name': 'San Dan', 'title': 'engineer',
|
|
98
|
+
'children': [
|
|
99
|
+
{ 'name': 'Si Dan', 'title': 'intern' },
|
|
100
|
+
{ 'name': 'Wu Dan', 'title': 'intern' }
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
]}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
{ 'name': 'Hong Miao', 'title': 'department manager' },
|
|
109
|
+
{ 'name': 'Chun Miao', 'title': 'department manager',
|
|
110
|
+
'children': [
|
|
111
|
+
{ 'name': 'Bing Qin', 'title': 'senior engineer',
|
|
112
|
+
'children': [
|
|
113
|
+
{ 'name': 'John', 'title': 'engineer' },
|
|
114
|
+
{ 'name': 'Do', 'title': 'UE engineer' }
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
{ 'name': 'Yue Yue', 'title': 'senior engineer',
|
|
118
|
+
'children': [
|
|
119
|
+
{ 'name': 'Er Yue', 'title': 'engineer' },
|
|
120
|
+
{ 'name': 'San Yue', 'title': 'UE engineer' }
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
var oc = $('#chart-container').orgchart({
|
|
129
|
+
'data' : datasource,
|
|
130
|
+
'nodeContent': 'title',
|
|
131
|
+
'verticalLevel': 4,
|
|
132
|
+
'visibleLevel': 6
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
oc.$chart.find('.node')
|
|
136
|
+
.on('mouseenter', function() {
|
|
137
|
+
oc.getParent($(this)).addClass('highlight-parent');
|
|
138
|
+
oc.getSiblings($(this)).addClass('highlight-siblings');
|
|
139
|
+
oc.getChildren($(this)).addClass('highlight-children');
|
|
140
|
+
})
|
|
141
|
+
.on('mouseleave', function () {
|
|
142
|
+
oc.$chart.find('.highlight-parent, .highlight-siblings, .highlight-children')
|
|
143
|
+
.removeClass('highlight-parent highlight-siblings highlight-children');
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
});
|
|
147
|
+
</script>
|
|
148
|
+
</body>
|
|
149
|
+
</html>
|
package/demo/index.html
CHANGED
|
@@ -140,6 +140,7 @@
|
|
|
140
140
|
<li><a href="vertical-level.html" target="_blank">hybrid(horizontal + vertical) chart</a></li>
|
|
141
141
|
<li><a href="responsive-design.html" target="_blank">responsive design</a></li>
|
|
142
142
|
<li><a href="custom-template.html" target="_blank">template for internal structure of node</a></li>
|
|
143
|
+
<li><a href="get-related-nodes.html" target="_blank">Highlight related nodes</a></li>
|
|
143
144
|
</ol>
|
|
144
145
|
</section>
|
|
145
146
|
</body>
|
|
@@ -471,6 +471,15 @@
|
|
|
471
471
|
}
|
|
472
472
|
return { 'exist': false, 'visible': false };
|
|
473
473
|
},
|
|
474
|
+
getParent: function ($node) {
|
|
475
|
+
return this.getRelatedNodes($node, 'parent');
|
|
476
|
+
},
|
|
477
|
+
getChildren: function ($node) {
|
|
478
|
+
return this.getRelatedNodes($node, 'children');
|
|
479
|
+
},
|
|
480
|
+
getSiblings: function ($node) {
|
|
481
|
+
return this.getRelatedNodes($node, 'siblings');
|
|
482
|
+
},
|
|
474
483
|
// find the related nodes
|
|
475
484
|
getRelatedNodes: function ($node, relation) {
|
|
476
485
|
if (!$node || !($node instanceof $) || !$node.is('.node')) {
|
|
@@ -1041,7 +1050,7 @@
|
|
|
1041
1050
|
event.originalEvent.dataTransfer.dropEffect = 'none';
|
|
1042
1051
|
} else {
|
|
1043
1052
|
// default action for drag-and-drop of div is not to drop, so preventing default action for nodes which have allowedDrop class
|
|
1044
|
-
//to fix drag and drop on IE and Edge
|
|
1053
|
+
//to fix drag and drop on IE and Edge
|
|
1045
1054
|
event.preventDefault();
|
|
1046
1055
|
}
|
|
1047
1056
|
},
|
|
@@ -1059,7 +1068,7 @@
|
|
|
1059
1068
|
this.$chart.triggerHandler({ 'type': 'otherdropped.orgchart', 'draggedItem': $dragged, 'dropZone': $dropZone });
|
|
1060
1069
|
return;
|
|
1061
1070
|
}
|
|
1062
|
-
|
|
1071
|
+
|
|
1063
1072
|
if (!$dropZone.hasClass('allowedDrop')) {
|
|
1064
1073
|
// We are trying to drop a node into a node which isn't allowed
|
|
1065
1074
|
// IE/Edge have a habit of allowing this, so we need our own double-check
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";!function(e){"object"==typeof module&&"object"==typeof module.exports?e(require("jquery"),window,document):e(jQuery,window,document)}(function(p,u,f,d){function t(e,t){this.$chartContainer=p(e),this.opts=t,this.defaultOptions={nodeTitle:"name",nodeId:"id",toggleSiblingsResp:!1,visibleLevel:999,chartClass:"",exportButton:!1,exportButtonName:"Export",exportFilename:"OrgChart",exportFileextension:"png",parentNodeSymbol:"oci-leader",draggable:!1,direction:"t2b",pan:!1,zoom:!1,zoominLimit:7,zoomoutLimit:.5}}t.prototype={init:function(e){var n=this;this.options=p.extend({},this.defaultOptions,this.opts,e);var t=this.$chartContainer;this.$chart&&this.$chart.remove();var i=this.options.data,s=this.$chart=p("<div>",{data:{options:this.options},class:"orgchart"+(""!==this.options.chartClass?" "+this.options.chartClass:"")+("t2b"!==this.options.direction?" "+this.options.direction:""),click:function(e){p(e.target).closest(".node").length||s.find(".node.focused").removeClass("focused")}});"undefined"!=typeof MutationObserver&&this.triggerInitEvent();var o=s.append(p('<ul class="nodes"><li class="hierarchy"></li></ul>')).find(".hierarchy");return"object"===p.type(i)?i instanceof p?this.buildHierarchy(o,this.buildJsonDS(i.children()),0,this.options):this.buildHierarchy(o,this.options.ajaxURL?i:this.attachRel(i,"00")):(s.append('<i class="oci oci-spinner spinner"></i>'),p.ajax({url:i,dataType:"json"}).done(function(e,t,i){n.buildHierarchy(o,n.options.ajaxURL?e:n.attachRel(e,"00"),0,n.options)}).fail(function(e,t,i){console.log(i)}).always(function(){s.children(".spinner").remove()})),t.append(s),this.options.exportButton&&!p(".oc-export-btn").length&&this.attachExportButton(),this.options.pan&&this.bindPan(),this.options.zoom&&this.bindZoom(),this},triggerInitEvent:function(){var s=this,o=new MutationObserver(function(e){o.disconnect();e:for(var t=0;t<e.length;t++)for(var i=0;i<e[t].addedNodes.length;i++)if(e[t].addedNodes[i].classList.contains("orgchart")){s.options.initCompleted&&"function"==typeof s.options.initCompleted&&s.options.initCompleted(s.$chart);var n=p.Event("init.orgchart");s.$chart.trigger(n);break e}});o.observe(this.$chartContainer[0],{childList:!0})},triggerLoadEvent:function(e,t){var i=p.Event("load-"+t+".orgchart");e.trigger(i)},triggerShowEvent:function(e,t){var i=p.Event("show-"+t+".orgchart");e.trigger(i)},triggerHideEvent:function(e,t){var i=p.Event("hide-"+t+".orgchart");e.trigger(i)},attachExportButton:function(){var t=this,e=p("<button>",{class:"oc-export-btn",text:this.options.exportButtonName,click:function(e){e.preventDefault(),t.export()}});this.$chartContainer.after(e)},setOptions:function(e,t){return"string"==typeof e&&("pan"===e&&(t?this.bindPan():this.unbindPan()),"zoom"===e&&(t?this.bindZoom():this.unbindZoom())),"object"==typeof e&&(e.data?this.init(e):(void 0!==e.pan&&(e.pan?this.bindPan():this.unbindPan()),void 0!==e.zoom&&(e.zoom?this.bindZoom():this.unbindZoom()))),this},panStartHandler:function(e){var o=p(e.delegateTarget);if(p(e.target).closest(".node").length||e.touches&&1<e.touches.length)o.data("panning",!1);else{o.css("cursor","move").data("panning",!0);var t=0,i=0,n=o.css("transform");if("none"!==n){var s=n.split(",");i=-1===n.indexOf("3d")?(t=parseInt(s[4]),parseInt(s[5])):(t=parseInt(s[12]),parseInt(s[13]))}var a=0,r=0;if(e.targetTouches){if(1===e.targetTouches.length)a=e.targetTouches[0].pageX-t,r=e.targetTouches[0].pageY-i;else if(1<e.targetTouches.length)return}else a=e.pageX-t,r=e.pageY-i;o.on("mousemove touchmove",function(e){if(o.data("panning")){var t=0,i=0;if(e.targetTouches){if(1===e.targetTouches.length)t=e.targetTouches[0].pageX-a,i=e.targetTouches[0].pageY-r;else if(1<e.targetTouches.length)return}else t=e.pageX-a,i=e.pageY-r;var n=o.css("transform");if("none"===n)-1===n.indexOf("3d")?o.css("transform","matrix(1, 0, 0, 1, "+t+", "+i+")"):o.css("transform","matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, "+t+", "+i+", 0, 1)");else{var s=n.split(",");-1===n.indexOf("3d")?(s[4]=" "+t,s[5]=" "+i+")"):(s[12]=" "+t,s[13]=" "+i),o.css("transform",s.join(","))}}})}},panEndHandler:function(e){e.data.chart.data("panning")&&e.data.chart.data("panning",!1).css("cursor","default").off("mousemove")},bindPan:function(){this.$chartContainer.css("overflow","hidden"),this.$chart.on("mousedown touchstart",this.panStartHandler),p(f).on("mouseup touchend",{chart:this.$chart},this.panEndHandler)},unbindPan:function(){this.$chartContainer.css("overflow","auto"),this.$chart.off("mousedown touchstart",this.panStartHandler),p(f).off("mouseup touchend",this.panEndHandler)},zoomWheelHandler:function(e){var t=e.data.oc;e.preventDefault();var i=1+(0<e.originalEvent.deltaY?-.2:.2);t.setChartScale(t.$chart,i)},zoomStartHandler:function(e){if(e.touches&&2===e.touches.length){var t=e.data.oc;t.$chart.data("pinching",!0);var i=t.getPinchDist(e);t.$chart.data("pinchDistStart",i)}},zoomingHandler:function(e){var t=e.data.oc;if(t.$chart.data("pinching")){var i=t.getPinchDist(e);t.$chart.data("pinchDistEnd",i)}},zoomEndHandler:function(e){var t=e.data.oc;if(t.$chart.data("pinching")){t.$chart.data("pinching",!1);var i=t.$chart.data("pinchDistEnd")-t.$chart.data("pinchDistStart");0<i?t.setChartScale(t.$chart,1.2):i<0&&t.setChartScale(t.$chart,.8)}},bindZoom:function(){this.$chartContainer.on("wheel",{oc:this},this.zoomWheelHandler),this.$chartContainer.on("touchstart",{oc:this},this.zoomStartHandler),p(f).on("touchmove",{oc:this},this.zoomingHandler),p(f).on("touchend",{oc:this},this.zoomEndHandler)},unbindZoom:function(){this.$chartContainer.off("wheel",this.zoomWheelHandler),this.$chartContainer.off("touchstart",this.zoomStartHandler),p(f).off("touchmove",this.zoomingHandler),p(f).off("touchend",this.zoomEndHandler)},getPinchDist:function(e){return Math.sqrt((e.touches[0].clientX-e.touches[1].clientX)*(e.touches[0].clientX-e.touches[1].clientX)+(e.touches[0].clientY-e.touches[1].clientY)*(e.touches[0].clientY-e.touches[1].clientY))},setChartScale:function(e,t){var i=e.data("options"),n=e.css("transform"),s="",o=1;"none"===n?e.css("transform","scale("+t+","+t+")"):(s=n.split(","),-1===n.indexOf("3d")?(o=Math.abs(u.parseFloat(s[3])*t))>i.zoomoutLimit&&o<i.zoominLimit&&e.css("transform",n+" scale("+t+","+t+")"):(o=Math.abs(u.parseFloat(s[1])*t))>i.zoomoutLimit&&o<i.zoominLimit&&e.css("transform",n+" scale3d("+t+","+t+", 1)"))},buildJsonDS:function(e){var t=this,i={name:e.contents().eq(0).text().trim(),relationship:(e.parent().parent().is("li")?"1":"0")+(e.siblings("li").length?1:0)+(e.children("ul").length?1:0)};return p.each(e.data(),function(e,t){i[e]=t}),e.children("ul").children().each(function(){i.children||(i.children=[]),i.children.push(t.buildJsonDS(p(this)))}),i},attachRel:function(t,e){var i=this;return t.relationship=e+(t.children&&0<t.children.length?1:0),t.children&&t.children.forEach(function(e){i.attachRel(e,"1"+(1<t.children.length?1:0))}),t},loopChart:function(e,t){t=null!==t&&t!==d&&t;var i=this,n=e.find(".node:first"),s={id:n[0].id};return t&&p.each(n.data("nodeData"),function(e,t){s[e]=t}),n.siblings(".nodes").children().each(function(){s.children||(s.children=[]),s.children.push(i.loopChart(p(this),t))}),s},getHierarchy:function(e){if(e=null!==e&&e!==d&&e,void 0===this.$chart)return"Error: orgchart does not exist";if(!this.$chart.find(".node").length)return"Error: nodes do not exist";var t=!0;return this.$chart.find(".node").each(function(){if(!this.id)return t=!1}),t?this.loopChart(this.$chart,e):"Error: All nodes of orghcart to be exported must have data-id attribute!"},getNodeState:function(e,t){var i={},n=!!e.closest("vertical").length;if("parent"===(t=t||"self")){if(n?(i=e.closest("ul").parents("ul")).length||(i=e.closest(".nodes")).length||(i=e.closest(".vertical").siblings(":first")):i=e.closest(".nodes").siblings(".node"),i.length)return i.is(".hidden")||!i.is(".hidden")&&i.closest(".nodes").is(".hidden")||!i.is(".hidden")&&i.closest(".vertical").is(".hidden")?{exist:!0,visible:!1}:{exist:!0,visible:!0}}else if("children"===t){if((i=n?e.parent().children("ul"):e.siblings(".nodes")).length)return i.is(".hidden")?{exist:!0,visible:!1}:{exist:!0,visible:!0}}else if("siblings"===t){if((i=n?e.closest("ul"):e.parent().siblings()).length&&(!n||1<i.children("li").length))return i.is(".hidden")||i.parent().is(".hidden")||n&&i.closest(".vertical").is(".hidden")?{exist:!0,visible:!1}:{exist:!0,visible:!0}}else if((i=e).length)return i.closest(".nodes").length&&i.closest(".nodes").is(".hidden")||i.closest(".hierarchy").length&&i.closest(".hierarchy").is(".hidden")||i.closest(".vertical").length&&(i.closest(".nodes").is(".hidden")||i.closest(".vertical").is(".hidden"))?{exist:!0,visible:!1}:{exist:!0,visible:!0};return{exist:!1,visible:!1}},getRelatedNodes:function(e,t){return e&&e instanceof p&&e.is(".node")?"parent"===t?e.closest(".nodes").siblings(".node"):"children"===t?e.siblings(".nodes").children(".hierarchy").find(".node:first"):"siblings"===t?e.closest(".hierarchy").siblings().find(".node:first"):p():p()},hideParentEnd:function(e){p(e.target).removeClass("sliding"),e.data.parent.addClass("hidden")},hideParent:function(e){var t=e.closest(".nodes").siblings(".node");t.find(".spinner").length&&e.closest(".orgchart").data("inAjax",!1),this.getNodeState(e,"siblings").visible&&this.hideSiblings(e),e.parent().addClass("isAncestorsCollapsed"),this.getNodeState(t).visible&&t.addClass("sliding slide-down").one("transitionend",{parent:t},this.hideParentEnd),this.getNodeState(t,"parent").visible&&this.hideParent(t)},showParentEnd:function(e){var t=e.data.node;p(e.target).removeClass("sliding"),this.isInAction(t)&&this.switchVerticalArrow(t.children(".topEdge"))},showParent:function(e){var t=e.closest(".nodes").siblings(".node").removeClass("hidden");e.closest(".hierarchy").removeClass("isAncestorsCollapsed"),this.repaint(t[0]),t.addClass("sliding").removeClass("slide-down").one("transitionend",{node:e},this.showParentEnd.bind(this))},stopAjax:function(e){e.find(".spinner").length&&e.closest(".orgchart").data("inAjax",!1)},isVisibleNode:function(e,t){return this.getNodeState(p(t)).visible},hideChildrenEnd:function(e){var t=e.data.node;e.data.animatedNodes.removeClass("sliding"),e.data.animatedNodes.closest(".nodes").addClass("hidden"),this.isInAction(t)&&this.switchVerticalArrow(t.children(".bottomEdge"))},hideChildren:function(e){e.closest(".hierarchy").addClass("isChildrenCollapsed");var t=e.siblings(".nodes");this.stopAjax(t);var i=t.find(".node").filter(this.isVisibleNode.bind(this));t.is(".vertical")||i.closest(".hierarchy").addClass("isCollapsedDescendant"),(t.is(".vertical")||t.find(".vertical").length)&&i.find(".oci-minus-square").removeClass("oci-minus-square").addClass("oci-plus-square"),this.repaint(i.get(0)),i.addClass("sliding slide-up").eq(0).one("transitionend",{animatedNodes:i,lowerLevel:t,node:e},this.hideChildrenEnd.bind(this))},showChildrenEnd:function(e){var t=e.data.node;e.data.animatedNodes.removeClass("sliding"),this.isInAction(t)&&this.switchVerticalArrow(t.children(".bottomEdge"))},showChildren:function(e){e.closest(".hierarchy").removeClass("isChildrenCollapsed");var t=e.siblings(".nodes"),i=t.is(".vertical"),n=i?t.removeClass("hidden").find(".node").filter(this.isVisibleNode.bind(this)):t.removeClass("hidden").children(".hierarchy").find(".node:first").filter(this.isVisibleNode.bind(this));i||(n.filter(":not(:only-child)").closest(".hierarchy").addClass("isChildrenCollapsed"),n.closest(".hierarchy").removeClass("isCollapsedDescendant")),this.repaint(n.get(0)),n.addClass("sliding").removeClass("slide-up").eq(0).one("transitionend",{node:e,animatedNodes:n},this.showChildrenEnd.bind(this))},hideSiblingsEnd:function(e){var t=e.data.node,i=e.data.nodeContainer,n=e.data.direction,s=n?"left"===n?i.prevAll(":not(.hidden)"):i.nextAll(":not(.hidden)"):i.siblings();e.data.animatedNodes.removeClass("sliding"),s.find(".node:gt(0)").filter(this.isVisibleNode.bind(this)).removeClass("slide-left slide-right").addClass("slide-up"),s.find(".nodes, .vertical").addClass("hidden").end().addClass("hidden"),this.isInAction(t)&&this.switchHorizontalArrow(t)},hideSiblings:function(e,t){var i=e.closest(".hierarchy").addClass("isSiblingsCollapsed");i.siblings().find(".spinner").length&&e.closest(".orgchart").data("inAjax",!1),t?"left"===t?i.addClass("left-sibs").prevAll(".isSiblingsCollapsed").removeClass("isSiblingsCollapsed left-sibs").end().prevAll().addClass("isCollapsedSibling isChildrenCollapsed").find(".node").filter(this.isVisibleNode.bind(this)).addClass("sliding slide-right"):i.addClass("right-sibs").nextAll(".isSiblingsCollapsed").removeClass("isSiblingsCollapsed right-sibs").end().nextAll().addClass("isCollapsedSibling isChildrenCollapsed").find(".node").filter(this.isVisibleNode.bind(this)).addClass("sliding slide-left"):(i.prevAll().find(".node").filter(this.isVisibleNode.bind(this)).addClass("sliding slide-right"),i.nextAll().find(".node").filter(this.isVisibleNode.bind(this)).addClass("sliding slide-left"),i.siblings().addClass("isCollapsedSibling isChildrenCollapsed"));var n=i.siblings().find(".sliding");n.eq(0).one("transitionend",{node:e,nodeContainer:i,direction:t,animatedNodes:n},this.hideSiblingsEnd.bind(this))},showSiblingsEnd:function(e){var t=e.data.node;e.data.visibleNodes.removeClass("sliding"),this.isInAction(t)&&(this.switchHorizontalArrow(t),t.children(".topEdge").removeClass("oci-chevron-up").addClass("oci-chevron-down"))},showRelatedParentEnd:function(e){p(e.target).removeClass("sliding")},showSiblings:function(e,t){var i=p(),n=e.closest(".hierarchy");i=t?"left"===t?n.prevAll().removeClass("hidden"):n.nextAll().removeClass("hidden"):e.closest(".hierarchy").siblings().removeClass("hidden");var s=e.closest(".nodes").siblings(".node");t?(n.removeClass(t+"-sibs"),n.is("[class*=-sibs]")||n.removeClass("isSiblingsCollapsed"),i.removeClass("isCollapsedSibling "+t+"-sibs")):(e.closest(".hierarchy").removeClass("isSiblingsCollapsed"),i.removeClass("isCollapsedSibling")),this.getNodeState(e,"parent").visible||(e.closest(".hierarchy").removeClass("isAncestorsCollapsed"),s.removeClass("hidden"),this.repaint(s[0]),s.addClass("sliding").removeClass("slide-down").one("transitionend",this.showRelatedParentEnd));var o=i.find(".node").filter(this.isVisibleNode.bind(this));this.repaint(o.get(0)),o.addClass("sliding").removeClass("slide-left slide-right"),o.eq(0).one("transitionend",{node:e,visibleNodes:o},this.showSiblingsEnd.bind(this))},startLoading:function(e){var t=this.$chart;return(void 0===t.data("inAjax")||!0!==t.data("inAjax"))&&(e.addClass("hidden"),e.parent().append('<i class="oci oci-spinner spinner"></i>').children().not(".spinner").css("opacity",.2),t.data("inAjax",!0),p(".oc-export-btn").prop("disabled",!0),!0)},endLoading:function(e){var t=e.parent();e.removeClass("hidden"),t.find(".spinner").remove(),t.children().removeAttr("style"),this.$chart.data("inAjax",!1),p(".oc-export-btn").prop("disabled",!1)},isInAction:function(e){return-1<e.children(".edge").attr("class").indexOf("oci-")},switchVerticalArrow:function(e){e.toggleClass("oci-chevron-up").toggleClass("oci-chevron-down")},switchHorizontalArrow:function(e){var t=this.options;if(t.toggleSiblingsResp&&(void 0===t.ajaxURL||e.closest(".nodes").data("siblingsLoaded"))){var i=e.parent().prev();i.length&&(i.is(".hidden")?e.children(".leftEdge").addClass("oci-chevron-left").removeClass("oci-chevron-right"):e.children(".leftEdge").addClass("oci-chevron-right").removeClass("oci-chevron-left"));var n=e.parent().next();n.length&&(n.is(".hidden")?e.children(".rightEdge").addClass("oci-chevron-right").removeClass("oci-chevron-left"):e.children(".rightEdge").addClass("oci-chevron-left").removeClass("oci-chevron-right"))}else{var s=e.parent().siblings(),o=!!s.length&&!s.is(".hidden");e.children(".leftEdge").toggleClass("oci-chevron-right",o).toggleClass("oci-chevron-left",!o),e.children(".rightEdge").toggleClass("oci-chevron-left",o).toggleClass("oci-chevron-right",!o)}},repaint:function(e){e&&(e.style.offsetWidth=e.offsetWidth)},nodeEnterLeaveHandler:function(e){var t=p(e.delegateTarget),i=!1;if(t.closest(".nodes.vertical").length){var n=t.children(".toggleBtn");"mouseenter"===e.type?t.children(".toggleBtn").length&&(i=this.getNodeState(t,"children").visible,n.toggleClass("oci-plus-square",!i).toggleClass("oci-minus-square",i)):n.removeClass("oci-plus-square oci-minus-square")}else{var s=t.children(".topEdge"),o=(t.children(".rightEdge"),t.children(".bottomEdge")),a=t.children(".leftEdge");"mouseenter"===e.type?(s.length&&(i=this.getNodeState(t,"parent").visible,s.toggleClass("oci-chevron-up",!i).toggleClass("oci-chevron-down",i)),o.length&&(i=this.getNodeState(t,"children").visible,o.toggleClass("oci-chevron-down",!i).toggleClass("oci-chevron-up",i)),a.length&&this.switchHorizontalArrow(t)):t.children(".edge").removeClass("oci-chevron-up oci-chevron-down oci-chevron-right oci-chevron-left")}},nodeClickHandler:function(e){this.$chart.find(".focused").removeClass("focused"),p(e.delegateTarget).addClass("focused")},loadNodes:function(t,e,i){var n=this;this.options;p.ajax({url:e,dataType:"json"}).done(function(e){n.$chart.data("inAjax")&&("parent"===t?p.isEmptyObject(e)||n.addParent(i.parent(),e):"children"===t?e.children.length&&n.addChildren(i.parent(),e[t]):n.addSiblings(i.parent(),e.siblings?e.siblings:e),n.triggerLoadEvent(i.parent(),t))}).fail(function(){console.log("Failed to get "+t+" data")}).always(function(){n.endLoading(i)})},HideFirstParentEnd:function(e){var t=e.data.topEdge,i=t.parent();this.isInAction(i)&&(this.switchVerticalArrow(t),this.switchHorizontalArrow(i))},topEdgeClickHandler:function(e){e.stopPropagation();var t=p(e.target),i=p(e.delegateTarget),n=this.getNodeState(i,"parent");if(n.exist){var s=i.closest(".nodes").siblings(".node");if(s.is(".sliding"))return;n.visible?(this.hideParent(i),s.one("transitionend",{topEdge:t},this.HideFirstParentEnd.bind(this)),this.triggerHideEvent(i,"parent")):(this.showParent(i),this.triggerShowEvent(i,"parent"))}else if(this.startLoading(t)){var o=this.options,a=p.isFunction(o.ajaxURL.parent)?o.ajaxURL.parent(i.data("nodeData")):o.ajaxURL.parent+i[0].id;this.loadNodes("parent",a,t)}},bottomEdgeClickHandler:function(e){e.stopPropagation();var t=p(e.target),i=p(e.delegateTarget),n=this.getNodeState(i,"children");if(n.exist){if(i.siblings(".nodes").children().children(".node").is(".sliding"))return;n.visible?(this.hideChildren(i),this.triggerHideEvent(i,"children")):(this.showChildren(i),this.triggerShowEvent(i,"children"))}else if(this.startLoading(t)){var s=this.options,o=p.isFunction(s.ajaxURL.children)?s.ajaxURL.children(i.data("nodeData")):s.ajaxURL.children+i[0].id;this.loadNodes("children",o,t)}},hEdgeClickHandler:function(e){e.stopPropagation();var t=p(e.target),i=p(e.delegateTarget),n=this.options,s=this.getNodeState(i,"siblings");if(s.exist){if(i.closest(".hierarchy").siblings().find(".sliding").length)return;if(n.toggleSiblingsResp){var o=i.closest(".hierarchy").prev(),a=i.closest(".hierarchy").next();t.is(".leftEdge")?o.is(".hidden")?(this.showSiblings(i,"left"),this.triggerShowEvent(i,"siblings")):(this.hideSiblings(i,"left"),this.triggerHideEvent(i,"siblings")):a.is(".hidden")?(this.showSiblings(i,"right"),this.triggerShowEvent(i,"siblings")):(this.hideSiblings(i,"right"),this.triggerHideEvent(i,"siblings"))}else s.visible?(this.hideSiblings(i),this.triggerHideEvent(i,"siblings")):(this.showSiblings(i),this.triggerShowEvent(i,"siblings"))}else if(this.startLoading(t)){var r=i[0].id,d=this.getNodeState(i,"parent").exist?p.isFunction(n.ajaxURL.siblings)?n.ajaxURL.siblings(i.data("nodeData")):n.ajaxURL.siblings+r:p.isFunction(n.ajaxURL.families)?n.ajaxURL.families(i.data("nodeData")):n.ajaxURL.families+r;this.loadNodes("siblings",d,t)}},expandVNodesEnd:function(e){e.data.vNodes.removeClass("sliding")},collapseVNodesEnd:function(e){e.data.vNodes.removeClass("sliding").closest("ul").addClass("hidden")},toggleVNodes:function(e){var t=p(e.target),i=t.parent().next(),n=i.find(".node"),s=i.children().children(".node");s.is(".sliding")||(t.toggleClass("oci-plus-square oci-minus-square"),n.eq(0).is(".slide-up")?(i.removeClass("hidden"),this.repaint(s.get(0)),s.addClass("sliding").removeClass("slide-up").eq(0).one("transitionend",{vNodes:s},this.expandVNodesEnd)):(n.addClass("sliding slide-up").eq(0).one("transitionend",{vNodes:n},this.collapseVNodesEnd),n.find(".toggleBtn").removeClass("oci-minus-square").addClass("oci-plus-square")))},createGhostNode:function(e){var t,i,n=p(e.target),s=this.options,o=e.originalEvent,a=/firefox/.test(u.navigator.userAgent.toLowerCase());if(f.querySelector(".ghost-node"))t=n.closest(".orgchart").children(".ghost-node").get(0),i=p(t).children().get(0);else{if(!(t=f.createElementNS("http://www.w3.org/2000/svg","svg")).classList)return;t.classList.add("ghost-node"),i=f.createElementNS("http://www.w3.org/2000/svg","rect"),t.appendChild(i),n.closest(".orgchart").append(t)}var r=n.closest(".orgchart").css("transform").split(","),d="t2b"===s.direction||"b2t"===s.direction,l=Math.abs(u.parseFloat(d?r[0].slice(r[0].indexOf("(")+1):r[1]));t.setAttribute("width",d?n.outerWidth(!1):n.outerHeight(!1)),t.setAttribute("height",d?n.outerHeight(!1):n.outerWidth(!1)),i.setAttribute("x",5*l),i.setAttribute("y",5*l),i.setAttribute("width",120*l),i.setAttribute("height",40*l),i.setAttribute("rx",4*l),i.setAttribute("ry",4*l),i.setAttribute("stroke-width",1*l);var h=o.offsetX*l,c=o.offsetY*l;if("l2r"===s.direction?(h=o.offsetY*l,c=o.offsetX*l):"r2l"===s.direction?(h=n.outerWidth(!1)-o.offsetY*l,c=o.offsetX*l):"b2t"===s.direction&&(h=n.outerWidth(!1)-o.offsetX*l,c=n.outerHeight(!1)-o.offsetY*l),a){i.setAttribute("fill","rgb(255, 255, 255)"),i.setAttribute("stroke","rgb(191, 0, 0)");var g=f.createElement("img");g.src="data:image/svg+xml;utf8,"+(new XMLSerializer).serializeToString(t),o.dataTransfer.setDragImage(g,h,c)}else o.dataTransfer.setDragImage&&o.dataTransfer.setDragImage(t,h,c)},filterAllowedDropNodes:function(i){var n=this.options,s=i.closest("[draggable]").hasClass("node"),o=i.closest(".nodes").siblings(".node"),a=i.closest(".hierarchy").find(".node");this.$chart.data("dragged",i).find(".node").each(function(e,t){s&&-1!==a.index(t)||(n.dropCriteria?n.dropCriteria(i,o,p(t))&&p(t).addClass("allowedDrop"):p(t).addClass("allowedDrop"))})},dragstartHandler:function(e){e.originalEvent.dataTransfer.setData("text/html","hack for firefox"),"none"!==this.$chart.css("transform")&&this.createGhostNode(e),this.filterAllowedDropNodes(p(e.target))},dragoverHandler:function(e){p(e.delegateTarget).is(".allowedDrop")?e.preventDefault():e.originalEvent.dataTransfer.dropEffect="none"},dragendHandler:function(e){this.$chart.find(".allowedDrop").removeClass("allowedDrop")},dropHandler:function(e){var t=p(e.delegateTarget),i=this.$chart.data("dragged");if(i.hasClass("node")){if(t.hasClass("allowedDrop")){var n=i.closest(".nodes").siblings(".node"),s=p.Event("nodedrop.orgchart");if(this.$chart.trigger(s,{draggedNode:i,dragZone:n,dropZone:t}),!s.isDefaultPrevented()){if(t.siblings(".nodes").length){var o='<i class="edge horizontalEdge rightEdge oci"></i><i class="edge horizontalEdge leftEdge oci"></i>';i.find(".horizontalEdge").length||i.append(o),t.siblings(".nodes").append(i.closest(".hierarchy"));var a=i.closest(".hierarchy").siblings().find(".node:first");1===a.length&&a.append(o)}else t.append('<i class="edge verticalEdge bottomEdge oci"></i>').after('<ul class="nodes"></ul>').siblings(".nodes").append(i.find(".horizontalEdge").remove().end().closest(".hierarchy")),t.children(".title").length&&t.children(".title").prepend('<i class="oci '+this.$chart.data("options").parentNodeSymbol+' symbol"></i>');1===n.siblings(".nodes").children(".hierarchy").length?n.siblings(".nodes").children(".hierarchy").find(".node:first").find(".horizontalEdge").remove():0===n.siblings(".nodes").children(".hierarchy").length&&n.find(".bottomEdge, .symbol").remove().end().siblings(".nodes").remove()}}}else this.$chart.triggerHandler({type:"otherdropped.orgchart",draggedItem:i,dropZone:t})},touchstartHandler:function(e){this.touchHandled||e.touches&&1<e.touches.length||(this.touchHandled=!0,this.touchMoved=!1,e.preventDefault())},touchmoveHandler:function(e){if(this.touchHandled&&!(e.touches&&1<e.touches.length)){e.preventDefault(),this.touchMoved||(this.filterAllowedDropNodes(p(e.currentTarget)),this.touchDragImage=this.createDragImage(e,this.$chart.data("dragged")[0])),this.touchMoved=!0,this.moveDragImage(e,this.touchDragImage);var t=p(f.elementFromPoint(e.touches[0].clientX,e.touches[0].clientY)).closest("div.node");if(0<t.length){var i=t[0];t.is(".allowedDrop")?this.touchTargetNode=i:this.touchTargetNode=null}else this.touchTargetNode=null}},touchendHandler:function(e){if(this.touchHandled){if(this.destroyDragImage(),this.touchMoved){if(this.touchTargetNode){var t={delegateTarget:this.touchTargetNode};this.dropHandler(t),this.touchTargetNode=null}this.dragendHandler(e)}else{var i=e.changedTouches[0],n=f.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,u,1,i.screenX,i.screenY,i.clientX,i.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,0,null),e.target.dispatchEvent(n)}this.touchHandled=!1}},createDragImage:function(e,t){var i=t.cloneNode(!0);this.copyStyle(t,i),i.style.top=i.style.left="-9999px";var n=t.getBoundingClientRect(),s=this.getTouchPoint(e);return this.touchDragImageOffset={x:s.x-n.left,y:s.y-n.top},i.style.opacity="0.5",f.body.appendChild(i),i},destroyDragImage:function(){this.touchDragImage&&this.touchDragImage.parentElement&&this.touchDragImage.parentElement.removeChild(this.touchDragImage),this.touchDragImageOffset=null,this.touchDragImage=null},copyStyle:function(e,t){if(["id","class","style","draggable"].forEach(function(e){t.removeAttribute(e)}),e instanceof HTMLCanvasElement){var i=e,n=t;n.width=i.width,n.height=i.height,n.getContext("2d").drawImage(i,0,0)}for(var s=getComputedStyle(e),o=0;o<s.length;o++){var a=s[o];a.indexOf("transition")<0&&(t.style[a]=s[a])}t.style.pointerEvents="none";for(o=0;o<e.children.length;o++)this.copyStyle(e.children[o],t.children[o])},getTouchPoint:function(e){return e&&e.touches&&(e=e.touches[0]),{x:e.clientX,y:e.clientY}},moveDragImage:function(i,n){if(i&&n){var s=this;requestAnimationFrame(function(){var e=s.getTouchPoint(i),t=n.style;t.position="absolute",t.pointerEvents="none",t.zIndex="999999",s.touchDragImageOffset&&(t.left=Math.round(e.x-s.touchDragImageOffset.x)+"px",t.top=Math.round(e.y-s.touchDragImageOffset.y)+"px")})}},bindDragDrop:function(e){e.on("dragstart",this.dragstartHandler.bind(this)).on("dragover",this.dragoverHandler.bind(this)).on("dragend",this.dragendHandler.bind(this)).on("drop",this.dropHandler.bind(this)).on("touchstart",this.touchstartHandler.bind(this)).on("touchmove",this.touchmoveHandler.bind(this)).on("touchend",this.touchendHandler.bind(this))},createNode:function(i){var n=this.options,e=i.level;i.children&&i[n.nodeId]&&p.each(i.children,function(e,t){t.parentId=i[n.nodeId]});var t=p("<div"+(n.draggable?' draggable="true"':"")+(i[n.nodeId]?' id="'+i[n.nodeId]+'"':"")+(i.parentId?' data-parent="'+i.parentId+'"':"")+">").addClass("node "+(i.className||"")+(e>n.visibleLevel?" slide-up":""));n.nodeTemplate?t.append(n.nodeTemplate(i)):t.append('<div class="title">'+i[n.nodeTitle]+"</div>").append(void 0!==n.nodeContent?'<div class="content">'+(i[n.nodeContent]||"")+"</div>":"");var s=p.extend({},i);delete s.children,t.data("nodeData",s);var o=i.relationship||"";return n.verticalLevel&&e>=n.verticalLevel?e+1>n.verticalLevel&&Number(o.substr(2,1))&&t.append('<i class="toggleBtn oci"></i>').children(".title").prepend('<i class="oci '+n.parentNodeSymbol+' symbol"></i>'):(Number(o.substr(0,1))&&t.append('<i class="edge verticalEdge topEdge oci"></i>'),Number(o.substr(1,1))&&t.append('<i class="edge horizontalEdge rightEdge oci"></i><i class="edge horizontalEdge leftEdge oci"></i>'),Number(o.substr(2,1))&&t.append('<i class="edge verticalEdge bottomEdge oci"></i>').children(".title").prepend('<i class="oci '+n.parentNodeSymbol+' symbol"></i>')),t.on("mouseenter mouseleave",this.nodeEnterLeaveHandler.bind(this)),t.on("click",this.nodeClickHandler.bind(this)),t.on("click",".topEdge",this.topEdgeClickHandler.bind(this)),t.on("click",".bottomEdge",this.bottomEdgeClickHandler.bind(this)),t.on("click",".leftEdge, .rightEdge",this.hEdgeClickHandler.bind(this)),t.on("click",".toggleBtn",this.toggleVNodes.bind(this)),n.draggable&&(this.bindDragDrop(t),this.touchHandled=!1,this.touchMoved=!1,this.touchTargetNode=null),n.createNode&&n.createNode(t,i),t},buildHierarchy:function(e,t){var i=this,n=this.options,s=0;if(s=t.level?t.level:t.level=e.parentsUntil(".orgchart",".nodes").length,2<Object.keys(t).length){var o=this.createNode(t);n.verticalLevel&&n.verticalLevel,e.append(o)}if(t.children&&t.children.length){var a,r=s+1>n.visibleLevel||t.collapsed!==d&&t.collapsed;n.verticalLevel&&s+1>=n.verticalLevel?(a=p('<ul class="nodes">'),r&&s+1>=n.verticalLevel&&a.addClass("hidden"),s+1===n.verticalLevel?e.addClass("hybrid").append(a.addClass("vertical")):e.append(a)):(a=p('<ul class="nodes'+(r?" hidden":"")+'">'),2===Object.keys(t).length||r&&e.addClass("isChildrenCollapsed"),e.append(a)),p.each(t.children,function(){var e=p('<li class="hierarchy">');a.append(e),this.level=s+1,i.buildHierarchy(e,this)})}},buildChildNode:function(e,t){this.buildHierarchy(e,{children:t})},addChildren:function(e,t){this.buildChildNode(e.closest(".hierarchy"),t),e.find(".symbol").length||e.children(".title").prepend('<i class="oci '+this.options.parentNodeSymbol+' symbol"></i>'),e.closest(".nodes.vertical").length?e.children(".toggleBtn").length||e.append('<i class="toggleBtn oci"></i>'):e.children(".bottomEdge").length||e.append('<i class="edge verticalEdge bottomEdge oci"></i>'),this.isInAction(e)&&this.switchVerticalArrow(e.children(".bottomEdge"))},buildParentNode:function(e,t){t.relationship=t.relationship||"001";var i=p('<ul class="nodes"><li class="hierarchy"></li></ul>').find(".hierarchy").append(this.createNode(t)).end();this.$chart.prepend(i).find(".hierarchy:first").append(e.closest("ul").addClass("nodes"))},addParent:function(e,t){this.buildParentNode(e,t),e.children(".topEdge").length||e.children(".title").after('<i class="edge verticalEdge topEdge oci"></i>'),this.isInAction(e)&&this.switchVerticalArrow(e.children(".topEdge"))},buildSiblingNode:function(e,t){var i=p.isArray(t)?t.length:t.children.length,n=e.parent().is(".nodes")?e.siblings().length+1:1,s=n+i,o=1<s?Math.floor(s/2-1):0;if(e.closest(".nodes").parent().is(".hierarchy")){this.buildChildNode(e.parent().closest(".hierarchy"),t);var a=e.parent().closest(".hierarchy").children(".nodes:last").children(".hierarchy");1<n?a.eq(0).before(e.siblings().addBack().unwrap()):a.eq(o).after(e.unwrap())}else this.buildHierarchy(e.parent().prepend(p('<li class="hierarchy">')).children(".hierarchy:first"),t),e.prevAll(".hierarchy").children(".nodes").children().eq(o).after(e)},addSiblings:function(e,t){this.buildSiblingNode(e.closest(".hierarchy"),t),e.closest(".nodes").data("siblingsLoaded",!0),e.children(".leftEdge").length||e.children(".topEdge").after('<i class="edge horizontalEdge rightEdge oci"></i><i class="edge horizontalEdge leftEdge oci"></i>'),this.isInAction(e)&&(this.switchHorizontalArrow(e),e.children(".topEdge").removeClass("oci-chevron-up").addClass("oci-chevron-down"))},removeNodes:function(e){var t=e.closest(".hierarchy").parent();t.parent().is(".hierarchy")?this.getNodeState(e,"siblings").exist?(e.closest(".hierarchy").remove(),1===t.children().length&&t.find(".node:first .horizontalEdge").remove()):t.siblings(".node").find(".bottomEdge").remove().end().end().remove():t.closest(".orgchart").remove()},hideDropZones:function(){this.$chart.find(".allowedDrop").removeClass("allowedDrop")},showDropZones:function(e){this.$chart.find(".node").each(function(e,t){p(t).addClass("allowedDrop")}),this.$chart.data("dragged",p(e))},processExternalDrop:function(e,t){t&&this.$chart.data("dragged",p(t)),e.closest(".node").triggerHandler({type:"drop"})},exportPDF:function(e,t){var i={},n=Math.floor(e.width),s=Math.floor(e.height);u.jsPDF||(u.jsPDF=u.jspdf.jsPDF),(i=s<n?new jsPDF({orientation:"landscape",unit:"px",format:[n,s]}):new jsPDF({orientation:"portrait",unit:"px",format:[s,n]})).addImage(e.toDataURL(),"png",0,0),i.save(t+".pdf")},exportPNG:function(e,t){var i="WebkitAppearance"in f.documentElement.style,n=!!u.sidebar,s="Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&-1<navigator.appVersion.indexOf("Edge"),o=this.$chartContainer;if(!i&&!n||s)u.navigator.msSaveBlob(e.msToBlob(),t+".png");else{var a=".oci-download-btn"+(""!==this.options.chartClass?"."+this.options.chartClass:"");o.find(a).length||o.append('<a class="oci-download-btn'+(""!==this.options.chartClass?" "+this.options.chartClass:"")+'" download="'+t+'.png"></a>'),o.find(a).attr("href",e.toDataURL())[0].click()}},export:function(t,i){var n=this;if(t=void 0!==t?t:this.options.exportFilename,i=void 0!==i?i:this.options.exportFileextension,p(this).children(".spinner").length)return!1;var s=this.$chartContainer,e=s.find(".mask");e.length?e.removeClass("hidden"):s.append('<div class="mask"><i class="oci oci-spinner spinner"></i></div>');var o=s.addClass("canvasContainer").find('.orgchart:not(".hidden")').get(0),a="l2r"===n.options.direction||"r2l"===n.options.direction;html2canvas(o,{width:a?o.clientHeight:o.clientWidth,height:a?o.clientWidth:o.clientHeight,onclone:function(e){p(e).find(".canvasContainer").css("overflow","visible").find('.orgchart:not(".hidden"):first').css("transform","")}}).then(function(e){s.find(".mask").addClass("hidden"),"pdf"===i.toLowerCase()?n.exportPDF(e,t):n.exportPNG(e,t),s.removeClass("canvasContainer")},function(){s.removeClass("canvasContainer")})}},p.fn.orgchart=function(e){return new t(this,e).init()}});
|
|
1
|
+
"use strict";!function(e){"object"==typeof module&&"object"==typeof module.exports?e(require("jquery"),window,document):e(jQuery,window,document)}(function(p,u,f,d){function t(e,t){this.$chartContainer=p(e),this.opts=t,this.defaultOptions={nodeTitle:"name",nodeId:"id",toggleSiblingsResp:!1,visibleLevel:999,chartClass:"",exportButton:!1,exportButtonName:"Export",exportFilename:"OrgChart",exportFileextension:"png",parentNodeSymbol:"oci-leader",draggable:!1,direction:"t2b",pan:!1,zoom:!1,zoominLimit:7,zoomoutLimit:.5}}t.prototype={init:function(e){var n=this;this.options=p.extend({},this.defaultOptions,this.opts,e);var t=this.$chartContainer;this.$chart&&this.$chart.remove();var i=this.options.data,s=this.$chart=p("<div>",{data:{options:this.options},class:"orgchart"+(""!==this.options.chartClass?" "+this.options.chartClass:"")+("t2b"!==this.options.direction?" "+this.options.direction:""),click:function(e){p(e.target).closest(".node").length||s.find(".node.focused").removeClass("focused")}});"undefined"!=typeof MutationObserver&&this.triggerInitEvent();var o=s.append(p('<ul class="nodes"><li class="hierarchy"></li></ul>')).find(".hierarchy");return"object"===p.type(i)?i instanceof p?this.buildHierarchy(o,this.buildJsonDS(i.children()),0,this.options):this.buildHierarchy(o,this.options.ajaxURL?i:this.attachRel(i,"00")):(s.append('<i class="oci oci-spinner spinner"></i>'),p.ajax({url:i,dataType:"json"}).done(function(e,t,i){n.buildHierarchy(o,n.options.ajaxURL?e:n.attachRel(e,"00"),0,n.options)}).fail(function(e,t,i){console.log(i)}).always(function(){s.children(".spinner").remove()})),t.append(s),this.options.exportButton&&!p(".oc-export-btn").length&&this.attachExportButton(),this.options.pan&&this.bindPan(),this.options.zoom&&this.bindZoom(),this},triggerInitEvent:function(){var s=this,o=new MutationObserver(function(e){o.disconnect();e:for(var t=0;t<e.length;t++)for(var i=0;i<e[t].addedNodes.length;i++)if(e[t].addedNodes[i].classList.contains("orgchart")){s.options.initCompleted&&"function"==typeof s.options.initCompleted&&s.options.initCompleted(s.$chart);var n=p.Event("init.orgchart");s.$chart.trigger(n);break e}});o.observe(this.$chartContainer[0],{childList:!0})},triggerLoadEvent:function(e,t){var i=p.Event("load-"+t+".orgchart");e.trigger(i)},triggerShowEvent:function(e,t){var i=p.Event("show-"+t+".orgchart");e.trigger(i)},triggerHideEvent:function(e,t){var i=p.Event("hide-"+t+".orgchart");e.trigger(i)},attachExportButton:function(){var t=this,e=p("<button>",{class:"oc-export-btn",text:this.options.exportButtonName,click:function(e){e.preventDefault(),t.export()}});this.$chartContainer.after(e)},setOptions:function(e,t){return"string"==typeof e&&("pan"===e&&(t?this.bindPan():this.unbindPan()),"zoom"===e&&(t?this.bindZoom():this.unbindZoom())),"object"==typeof e&&(e.data?this.init(e):(void 0!==e.pan&&(e.pan?this.bindPan():this.unbindPan()),void 0!==e.zoom&&(e.zoom?this.bindZoom():this.unbindZoom()))),this},panStartHandler:function(e){var o=p(e.delegateTarget);if(p(e.target).closest(".node").length||e.touches&&1<e.touches.length)o.data("panning",!1);else{o.css("cursor","move").data("panning",!0);var t=0,i=0,n=o.css("transform");if("none"!==n){var s=n.split(",");i=-1===n.indexOf("3d")?(t=parseInt(s[4]),parseInt(s[5])):(t=parseInt(s[12]),parseInt(s[13]))}var a=0,r=0;if(e.targetTouches){if(1===e.targetTouches.length)a=e.targetTouches[0].pageX-t,r=e.targetTouches[0].pageY-i;else if(1<e.targetTouches.length)return}else a=e.pageX-t,r=e.pageY-i;o.on("mousemove touchmove",function(e){if(o.data("panning")){var t=0,i=0;if(e.targetTouches){if(1===e.targetTouches.length)t=e.targetTouches[0].pageX-a,i=e.targetTouches[0].pageY-r;else if(1<e.targetTouches.length)return}else t=e.pageX-a,i=e.pageY-r;var n=o.css("transform");if("none"===n)-1===n.indexOf("3d")?o.css("transform","matrix(1, 0, 0, 1, "+t+", "+i+")"):o.css("transform","matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, "+t+", "+i+", 0, 1)");else{var s=n.split(",");-1===n.indexOf("3d")?(s[4]=" "+t,s[5]=" "+i+")"):(s[12]=" "+t,s[13]=" "+i),o.css("transform",s.join(","))}}})}},panEndHandler:function(e){e.data.chart.data("panning")&&e.data.chart.data("panning",!1).css("cursor","default").off("mousemove")},bindPan:function(){this.$chartContainer.css("overflow","hidden"),this.$chart.on("mousedown touchstart",this.panStartHandler),p(f).on("mouseup touchend",{chart:this.$chart},this.panEndHandler)},unbindPan:function(){this.$chartContainer.css("overflow","auto"),this.$chart.off("mousedown touchstart",this.panStartHandler),p(f).off("mouseup touchend",this.panEndHandler)},zoomWheelHandler:function(e){var t=e.data.oc;e.preventDefault();var i=1+(0<e.originalEvent.deltaY?-.2:.2);t.setChartScale(t.$chart,i)},zoomStartHandler:function(e){if(e.touches&&2===e.touches.length){var t=e.data.oc;t.$chart.data("pinching",!0);var i=t.getPinchDist(e);t.$chart.data("pinchDistStart",i)}},zoomingHandler:function(e){var t=e.data.oc;if(t.$chart.data("pinching")){var i=t.getPinchDist(e);t.$chart.data("pinchDistEnd",i)}},zoomEndHandler:function(e){var t=e.data.oc;if(t.$chart.data("pinching")){t.$chart.data("pinching",!1);var i=t.$chart.data("pinchDistEnd")-t.$chart.data("pinchDistStart");0<i?t.setChartScale(t.$chart,1.2):i<0&&t.setChartScale(t.$chart,.8)}},bindZoom:function(){this.$chartContainer.on("wheel",{oc:this},this.zoomWheelHandler),this.$chartContainer.on("touchstart",{oc:this},this.zoomStartHandler),p(f).on("touchmove",{oc:this},this.zoomingHandler),p(f).on("touchend",{oc:this},this.zoomEndHandler)},unbindZoom:function(){this.$chartContainer.off("wheel",this.zoomWheelHandler),this.$chartContainer.off("touchstart",this.zoomStartHandler),p(f).off("touchmove",this.zoomingHandler),p(f).off("touchend",this.zoomEndHandler)},getPinchDist:function(e){return Math.sqrt((e.touches[0].clientX-e.touches[1].clientX)*(e.touches[0].clientX-e.touches[1].clientX)+(e.touches[0].clientY-e.touches[1].clientY)*(e.touches[0].clientY-e.touches[1].clientY))},setChartScale:function(e,t){var i=e.data("options"),n=e.css("transform"),s="",o=1;"none"===n?e.css("transform","scale("+t+","+t+")"):(s=n.split(","),-1===n.indexOf("3d")?(o=Math.abs(u.parseFloat(s[3])*t))>i.zoomoutLimit&&o<i.zoominLimit&&e.css("transform",n+" scale("+t+","+t+")"):(o=Math.abs(u.parseFloat(s[1])*t))>i.zoomoutLimit&&o<i.zoominLimit&&e.css("transform",n+" scale3d("+t+","+t+", 1)"))},buildJsonDS:function(e){var t=this,i={name:e.contents().eq(0).text().trim(),relationship:(e.parent().parent().is("li")?"1":"0")+(e.siblings("li").length?1:0)+(e.children("ul").length?1:0)};return p.each(e.data(),function(e,t){i[e]=t}),e.children("ul").children().each(function(){i.children||(i.children=[]),i.children.push(t.buildJsonDS(p(this)))}),i},attachRel:function(t,e){var i=this;return t.relationship=e+(t.children&&0<t.children.length?1:0),t.children&&t.children.forEach(function(e){i.attachRel(e,"1"+(1<t.children.length?1:0))}),t},loopChart:function(e,t){t=null!==t&&t!==d&&t;var i=this,n=e.find(".node:first"),s={id:n[0].id};return t&&p.each(n.data("nodeData"),function(e,t){s[e]=t}),n.siblings(".nodes").children().each(function(){s.children||(s.children=[]),s.children.push(i.loopChart(p(this),t))}),s},getHierarchy:function(e){if(e=null!==e&&e!==d&&e,void 0===this.$chart)return"Error: orgchart does not exist";if(!this.$chart.find(".node").length)return"Error: nodes do not exist";var t=!0;return this.$chart.find(".node").each(function(){if(!this.id)return t=!1}),t?this.loopChart(this.$chart,e):"Error: All nodes of orghcart to be exported must have data-id attribute!"},getNodeState:function(e,t){var i={},n=!!e.closest("vertical").length;if("parent"===(t=t||"self")){if(n?(i=e.closest("ul").parents("ul")).length||(i=e.closest(".nodes")).length||(i=e.closest(".vertical").siblings(":first")):i=e.closest(".nodes").siblings(".node"),i.length)return i.is(".hidden")||!i.is(".hidden")&&i.closest(".nodes").is(".hidden")||!i.is(".hidden")&&i.closest(".vertical").is(".hidden")?{exist:!0,visible:!1}:{exist:!0,visible:!0}}else if("children"===t){if((i=n?e.parent().children("ul"):e.siblings(".nodes")).length)return i.is(".hidden")?{exist:!0,visible:!1}:{exist:!0,visible:!0}}else if("siblings"===t){if((i=n?e.closest("ul"):e.parent().siblings()).length&&(!n||1<i.children("li").length))return i.is(".hidden")||i.parent().is(".hidden")||n&&i.closest(".vertical").is(".hidden")?{exist:!0,visible:!1}:{exist:!0,visible:!0}}else if((i=e).length)return i.closest(".nodes").length&&i.closest(".nodes").is(".hidden")||i.closest(".hierarchy").length&&i.closest(".hierarchy").is(".hidden")||i.closest(".vertical").length&&(i.closest(".nodes").is(".hidden")||i.closest(".vertical").is(".hidden"))?{exist:!0,visible:!1}:{exist:!0,visible:!0};return{exist:!1,visible:!1}},getParent:function(e){return this.getRelatedNodes(e,"parent")},getChildren:function(e){return this.getRelatedNodes(e,"children")},getSiblings:function(e){return this.getRelatedNodes(e,"siblings")},getRelatedNodes:function(e,t){return e&&e instanceof p&&e.is(".node")?"parent"===t?e.closest(".nodes").siblings(".node"):"children"===t?e.siblings(".nodes").children(".hierarchy").find(".node:first"):"siblings"===t?e.closest(".hierarchy").siblings().find(".node:first"):p():p()},hideParentEnd:function(e){p(e.target).removeClass("sliding"),e.data.parent.addClass("hidden")},hideParent:function(e){var t=e.closest(".nodes").siblings(".node");t.find(".spinner").length&&e.closest(".orgchart").data("inAjax",!1),this.getNodeState(e,"siblings").visible&&this.hideSiblings(e),e.parent().addClass("isAncestorsCollapsed"),this.getNodeState(t).visible&&t.addClass("sliding slide-down").one("transitionend",{parent:t},this.hideParentEnd),this.getNodeState(t,"parent").visible&&this.hideParent(t)},showParentEnd:function(e){var t=e.data.node;p(e.target).removeClass("sliding"),this.isInAction(t)&&this.switchVerticalArrow(t.children(".topEdge"))},showParent:function(e){var t=e.closest(".nodes").siblings(".node").removeClass("hidden");e.closest(".hierarchy").removeClass("isAncestorsCollapsed"),this.repaint(t[0]),t.addClass("sliding").removeClass("slide-down").one("transitionend",{node:e},this.showParentEnd.bind(this))},stopAjax:function(e){e.find(".spinner").length&&e.closest(".orgchart").data("inAjax",!1)},isVisibleNode:function(e,t){return this.getNodeState(p(t)).visible},hideChildrenEnd:function(e){var t=e.data.node;e.data.animatedNodes.removeClass("sliding"),e.data.animatedNodes.closest(".nodes").addClass("hidden"),this.isInAction(t)&&this.switchVerticalArrow(t.children(".bottomEdge"))},hideChildren:function(e){e.closest(".hierarchy").addClass("isChildrenCollapsed");var t=e.siblings(".nodes");this.stopAjax(t);var i=t.find(".node").filter(this.isVisibleNode.bind(this));t.is(".vertical")||i.closest(".hierarchy").addClass("isCollapsedDescendant"),(t.is(".vertical")||t.find(".vertical").length)&&i.find(".oci-minus-square").removeClass("oci-minus-square").addClass("oci-plus-square"),this.repaint(i.get(0)),i.addClass("sliding slide-up").eq(0).one("transitionend",{animatedNodes:i,lowerLevel:t,node:e},this.hideChildrenEnd.bind(this))},showChildrenEnd:function(e){var t=e.data.node;e.data.animatedNodes.removeClass("sliding"),this.isInAction(t)&&this.switchVerticalArrow(t.children(".bottomEdge"))},showChildren:function(e){e.closest(".hierarchy").removeClass("isChildrenCollapsed");var t=e.siblings(".nodes"),i=t.is(".vertical"),n=i?t.removeClass("hidden").find(".node").filter(this.isVisibleNode.bind(this)):t.removeClass("hidden").children(".hierarchy").find(".node:first").filter(this.isVisibleNode.bind(this));i||(n.filter(":not(:only-child)").closest(".hierarchy").addClass("isChildrenCollapsed"),n.closest(".hierarchy").removeClass("isCollapsedDescendant")),this.repaint(n.get(0)),n.addClass("sliding").removeClass("slide-up").eq(0).one("transitionend",{node:e,animatedNodes:n},this.showChildrenEnd.bind(this))},hideSiblingsEnd:function(e){var t=e.data.node,i=e.data.nodeContainer,n=e.data.direction,s=n?"left"===n?i.prevAll(":not(.hidden)"):i.nextAll(":not(.hidden)"):i.siblings();e.data.animatedNodes.removeClass("sliding"),s.find(".node:gt(0)").filter(this.isVisibleNode.bind(this)).removeClass("slide-left slide-right").addClass("slide-up"),s.find(".nodes, .vertical").addClass("hidden").end().addClass("hidden"),this.isInAction(t)&&this.switchHorizontalArrow(t)},hideSiblings:function(e,t){var i=e.closest(".hierarchy").addClass("isSiblingsCollapsed");i.siblings().find(".spinner").length&&e.closest(".orgchart").data("inAjax",!1),t?"left"===t?i.addClass("left-sibs").prevAll(".isSiblingsCollapsed").removeClass("isSiblingsCollapsed left-sibs").end().prevAll().addClass("isCollapsedSibling isChildrenCollapsed").find(".node").filter(this.isVisibleNode.bind(this)).addClass("sliding slide-right"):i.addClass("right-sibs").nextAll(".isSiblingsCollapsed").removeClass("isSiblingsCollapsed right-sibs").end().nextAll().addClass("isCollapsedSibling isChildrenCollapsed").find(".node").filter(this.isVisibleNode.bind(this)).addClass("sliding slide-left"):(i.prevAll().find(".node").filter(this.isVisibleNode.bind(this)).addClass("sliding slide-right"),i.nextAll().find(".node").filter(this.isVisibleNode.bind(this)).addClass("sliding slide-left"),i.siblings().addClass("isCollapsedSibling isChildrenCollapsed"));var n=i.siblings().find(".sliding");n.eq(0).one("transitionend",{node:e,nodeContainer:i,direction:t,animatedNodes:n},this.hideSiblingsEnd.bind(this))},showSiblingsEnd:function(e){var t=e.data.node;e.data.visibleNodes.removeClass("sliding"),this.isInAction(t)&&(this.switchHorizontalArrow(t),t.children(".topEdge").removeClass("oci-chevron-up").addClass("oci-chevron-down"))},showRelatedParentEnd:function(e){p(e.target).removeClass("sliding")},showSiblings:function(e,t){var i=p(),n=e.closest(".hierarchy");i=t?"left"===t?n.prevAll().removeClass("hidden"):n.nextAll().removeClass("hidden"):e.closest(".hierarchy").siblings().removeClass("hidden");var s=e.closest(".nodes").siblings(".node");t?(n.removeClass(t+"-sibs"),n.is("[class*=-sibs]")||n.removeClass("isSiblingsCollapsed"),i.removeClass("isCollapsedSibling "+t+"-sibs")):(e.closest(".hierarchy").removeClass("isSiblingsCollapsed"),i.removeClass("isCollapsedSibling")),this.getNodeState(e,"parent").visible||(e.closest(".hierarchy").removeClass("isAncestorsCollapsed"),s.removeClass("hidden"),this.repaint(s[0]),s.addClass("sliding").removeClass("slide-down").one("transitionend",this.showRelatedParentEnd));var o=i.find(".node").filter(this.isVisibleNode.bind(this));this.repaint(o.get(0)),o.addClass("sliding").removeClass("slide-left slide-right"),o.eq(0).one("transitionend",{node:e,visibleNodes:o},this.showSiblingsEnd.bind(this))},startLoading:function(e){var t=this.$chart;return(void 0===t.data("inAjax")||!0!==t.data("inAjax"))&&(e.addClass("hidden"),e.parent().append('<i class="oci oci-spinner spinner"></i>').children().not(".spinner").css("opacity",.2),t.data("inAjax",!0),p(".oc-export-btn").prop("disabled",!0),!0)},endLoading:function(e){var t=e.parent();e.removeClass("hidden"),t.find(".spinner").remove(),t.children().removeAttr("style"),this.$chart.data("inAjax",!1),p(".oc-export-btn").prop("disabled",!1)},isInAction:function(e){return-1<e.children(".edge").attr("class").indexOf("oci-")},switchVerticalArrow:function(e){e.toggleClass("oci-chevron-up").toggleClass("oci-chevron-down")},switchHorizontalArrow:function(e){var t=this.options;if(t.toggleSiblingsResp&&(void 0===t.ajaxURL||e.closest(".nodes").data("siblingsLoaded"))){var i=e.parent().prev();i.length&&(i.is(".hidden")?e.children(".leftEdge").addClass("oci-chevron-left").removeClass("oci-chevron-right"):e.children(".leftEdge").addClass("oci-chevron-right").removeClass("oci-chevron-left"));var n=e.parent().next();n.length&&(n.is(".hidden")?e.children(".rightEdge").addClass("oci-chevron-right").removeClass("oci-chevron-left"):e.children(".rightEdge").addClass("oci-chevron-left").removeClass("oci-chevron-right"))}else{var s=e.parent().siblings(),o=!!s.length&&!s.is(".hidden");e.children(".leftEdge").toggleClass("oci-chevron-right",o).toggleClass("oci-chevron-left",!o),e.children(".rightEdge").toggleClass("oci-chevron-left",o).toggleClass("oci-chevron-right",!o)}},repaint:function(e){e&&(e.style.offsetWidth=e.offsetWidth)},nodeEnterLeaveHandler:function(e){var t=p(e.delegateTarget),i=!1;if(t.closest(".nodes.vertical").length){var n=t.children(".toggleBtn");"mouseenter"===e.type?t.children(".toggleBtn").length&&(i=this.getNodeState(t,"children").visible,n.toggleClass("oci-plus-square",!i).toggleClass("oci-minus-square",i)):n.removeClass("oci-plus-square oci-minus-square")}else{var s=t.children(".topEdge"),o=(t.children(".rightEdge"),t.children(".bottomEdge")),a=t.children(".leftEdge");"mouseenter"===e.type?(s.length&&(i=this.getNodeState(t,"parent").visible,s.toggleClass("oci-chevron-up",!i).toggleClass("oci-chevron-down",i)),o.length&&(i=this.getNodeState(t,"children").visible,o.toggleClass("oci-chevron-down",!i).toggleClass("oci-chevron-up",i)),a.length&&this.switchHorizontalArrow(t)):t.children(".edge").removeClass("oci-chevron-up oci-chevron-down oci-chevron-right oci-chevron-left")}},nodeClickHandler:function(e){this.$chart.find(".focused").removeClass("focused"),p(e.delegateTarget).addClass("focused")},loadNodes:function(t,e,i){var n=this;this.options;p.ajax({url:e,dataType:"json"}).done(function(e){n.$chart.data("inAjax")&&("parent"===t?p.isEmptyObject(e)||n.addParent(i.parent(),e):"children"===t?e.children.length&&n.addChildren(i.parent(),e[t]):n.addSiblings(i.parent(),e.siblings?e.siblings:e),n.triggerLoadEvent(i.parent(),t))}).fail(function(){console.log("Failed to get "+t+" data")}).always(function(){n.endLoading(i)})},HideFirstParentEnd:function(e){var t=e.data.topEdge,i=t.parent();this.isInAction(i)&&(this.switchVerticalArrow(t),this.switchHorizontalArrow(i))},topEdgeClickHandler:function(e){e.stopPropagation();var t=p(e.target),i=p(e.delegateTarget),n=this.getNodeState(i,"parent");if(n.exist){var s=i.closest(".nodes").siblings(".node");if(s.is(".sliding"))return;n.visible?(this.hideParent(i),s.one("transitionend",{topEdge:t},this.HideFirstParentEnd.bind(this)),this.triggerHideEvent(i,"parent")):(this.showParent(i),this.triggerShowEvent(i,"parent"))}else if(this.startLoading(t)){var o=this.options,a=p.isFunction(o.ajaxURL.parent)?o.ajaxURL.parent(i.data("nodeData")):o.ajaxURL.parent+i[0].id;this.loadNodes("parent",a,t)}},bottomEdgeClickHandler:function(e){e.stopPropagation();var t=p(e.target),i=p(e.delegateTarget),n=this.getNodeState(i,"children");if(n.exist){if(i.siblings(".nodes").children().children(".node").is(".sliding"))return;n.visible?(this.hideChildren(i),this.triggerHideEvent(i,"children")):(this.showChildren(i),this.triggerShowEvent(i,"children"))}else if(this.startLoading(t)){var s=this.options,o=p.isFunction(s.ajaxURL.children)?s.ajaxURL.children(i.data("nodeData")):s.ajaxURL.children+i[0].id;this.loadNodes("children",o,t)}},hEdgeClickHandler:function(e){e.stopPropagation();var t=p(e.target),i=p(e.delegateTarget),n=this.options,s=this.getNodeState(i,"siblings");if(s.exist){if(i.closest(".hierarchy").siblings().find(".sliding").length)return;if(n.toggleSiblingsResp){var o=i.closest(".hierarchy").prev(),a=i.closest(".hierarchy").next();t.is(".leftEdge")?o.is(".hidden")?(this.showSiblings(i,"left"),this.triggerShowEvent(i,"siblings")):(this.hideSiblings(i,"left"),this.triggerHideEvent(i,"siblings")):a.is(".hidden")?(this.showSiblings(i,"right"),this.triggerShowEvent(i,"siblings")):(this.hideSiblings(i,"right"),this.triggerHideEvent(i,"siblings"))}else s.visible?(this.hideSiblings(i),this.triggerHideEvent(i,"siblings")):(this.showSiblings(i),this.triggerShowEvent(i,"siblings"))}else if(this.startLoading(t)){var r=i[0].id,d=this.getNodeState(i,"parent").exist?p.isFunction(n.ajaxURL.siblings)?n.ajaxURL.siblings(i.data("nodeData")):n.ajaxURL.siblings+r:p.isFunction(n.ajaxURL.families)?n.ajaxURL.families(i.data("nodeData")):n.ajaxURL.families+r;this.loadNodes("siblings",d,t)}},expandVNodesEnd:function(e){e.data.vNodes.removeClass("sliding")},collapseVNodesEnd:function(e){e.data.vNodes.removeClass("sliding").closest("ul").addClass("hidden")},toggleVNodes:function(e){var t=p(e.target),i=t.parent().next(),n=i.find(".node"),s=i.children().children(".node");s.is(".sliding")||(t.toggleClass("oci-plus-square oci-minus-square"),n.eq(0).is(".slide-up")?(i.removeClass("hidden"),this.repaint(s.get(0)),s.addClass("sliding").removeClass("slide-up").eq(0).one("transitionend",{vNodes:s},this.expandVNodesEnd)):(n.addClass("sliding slide-up").eq(0).one("transitionend",{vNodes:n},this.collapseVNodesEnd),n.find(".toggleBtn").removeClass("oci-minus-square").addClass("oci-plus-square")))},createGhostNode:function(e){var t,i,n=p(e.target),s=this.options,o=e.originalEvent,a=/firefox/.test(u.navigator.userAgent.toLowerCase());if(f.querySelector(".ghost-node"))t=n.closest(".orgchart").children(".ghost-node").get(0),i=p(t).children().get(0);else{if(!(t=f.createElementNS("http://www.w3.org/2000/svg","svg")).classList)return;t.classList.add("ghost-node"),i=f.createElementNS("http://www.w3.org/2000/svg","rect"),t.appendChild(i),n.closest(".orgchart").append(t)}var r=n.closest(".orgchart").css("transform").split(","),d="t2b"===s.direction||"b2t"===s.direction,l=Math.abs(u.parseFloat(d?r[0].slice(r[0].indexOf("(")+1):r[1]));t.setAttribute("width",d?n.outerWidth(!1):n.outerHeight(!1)),t.setAttribute("height",d?n.outerHeight(!1):n.outerWidth(!1)),i.setAttribute("x",5*l),i.setAttribute("y",5*l),i.setAttribute("width",120*l),i.setAttribute("height",40*l),i.setAttribute("rx",4*l),i.setAttribute("ry",4*l),i.setAttribute("stroke-width",1*l);var h=o.offsetX*l,c=o.offsetY*l;if("l2r"===s.direction?(h=o.offsetY*l,c=o.offsetX*l):"r2l"===s.direction?(h=n.outerWidth(!1)-o.offsetY*l,c=o.offsetX*l):"b2t"===s.direction&&(h=n.outerWidth(!1)-o.offsetX*l,c=n.outerHeight(!1)-o.offsetY*l),a){i.setAttribute("fill","rgb(255, 255, 255)"),i.setAttribute("stroke","rgb(191, 0, 0)");var g=f.createElement("img");g.src="data:image/svg+xml;utf8,"+(new XMLSerializer).serializeToString(t),o.dataTransfer.setDragImage(g,h,c)}else o.dataTransfer.setDragImage&&o.dataTransfer.setDragImage(t,h,c)},filterAllowedDropNodes:function(i){var n=this.options,s=i.closest("[draggable]").hasClass("node"),o=i.closest(".nodes").siblings(".node"),a=i.closest(".hierarchy").find(".node");this.$chart.data("dragged",i).find(".node").each(function(e,t){s&&-1!==a.index(t)||(n.dropCriteria?n.dropCriteria(i,o,p(t))&&p(t).addClass("allowedDrop"):p(t).addClass("allowedDrop"))})},dragstartHandler:function(e){e.originalEvent.dataTransfer.setData("text/html","hack for firefox"),"none"!==this.$chart.css("transform")&&this.createGhostNode(e),this.filterAllowedDropNodes(p(e.target))},dragoverHandler:function(e){p(e.delegateTarget).is(".allowedDrop")?e.preventDefault():e.originalEvent.dataTransfer.dropEffect="none"},dragendHandler:function(e){this.$chart.find(".allowedDrop").removeClass("allowedDrop")},dropHandler:function(e){var t=p(e.delegateTarget),i=this.$chart.data("dragged");if(i.hasClass("node")){if(t.hasClass("allowedDrop")){var n=i.closest(".nodes").siblings(".node"),s=p.Event("nodedrop.orgchart");if(this.$chart.trigger(s,{draggedNode:i,dragZone:n,dropZone:t}),!s.isDefaultPrevented()){if(t.siblings(".nodes").length){var o='<i class="edge horizontalEdge rightEdge oci"></i><i class="edge horizontalEdge leftEdge oci"></i>';i.find(".horizontalEdge").length||i.append(o),t.siblings(".nodes").append(i.closest(".hierarchy"));var a=i.closest(".hierarchy").siblings().find(".node:first");1===a.length&&a.append(o)}else t.append('<i class="edge verticalEdge bottomEdge oci"></i>').after('<ul class="nodes"></ul>').siblings(".nodes").append(i.find(".horizontalEdge").remove().end().closest(".hierarchy")),t.children(".title").length&&t.children(".title").prepend('<i class="oci '+this.$chart.data("options").parentNodeSymbol+' symbol"></i>');1===n.siblings(".nodes").children(".hierarchy").length?n.siblings(".nodes").children(".hierarchy").find(".node:first").find(".horizontalEdge").remove():0===n.siblings(".nodes").children(".hierarchy").length&&n.find(".bottomEdge, .symbol").remove().end().siblings(".nodes").remove()}}}else this.$chart.triggerHandler({type:"otherdropped.orgchart",draggedItem:i,dropZone:t})},touchstartHandler:function(e){this.touchHandled||e.touches&&1<e.touches.length||(this.touchHandled=!0,this.touchMoved=!1,e.preventDefault())},touchmoveHandler:function(e){if(this.touchHandled&&!(e.touches&&1<e.touches.length)){e.preventDefault(),this.touchMoved||(this.filterAllowedDropNodes(p(e.currentTarget)),this.touchDragImage=this.createDragImage(e,this.$chart.data("dragged")[0])),this.touchMoved=!0,this.moveDragImage(e,this.touchDragImage);var t=p(f.elementFromPoint(e.touches[0].clientX,e.touches[0].clientY)).closest("div.node");if(0<t.length){var i=t[0];t.is(".allowedDrop")?this.touchTargetNode=i:this.touchTargetNode=null}else this.touchTargetNode=null}},touchendHandler:function(e){if(this.touchHandled){if(this.destroyDragImage(),this.touchMoved){if(this.touchTargetNode){var t={delegateTarget:this.touchTargetNode};this.dropHandler(t),this.touchTargetNode=null}this.dragendHandler(e)}else{var i=e.changedTouches[0],n=f.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,u,1,i.screenX,i.screenY,i.clientX,i.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,0,null),e.target.dispatchEvent(n)}this.touchHandled=!1}},createDragImage:function(e,t){var i=t.cloneNode(!0);this.copyStyle(t,i),i.style.top=i.style.left="-9999px";var n=t.getBoundingClientRect(),s=this.getTouchPoint(e);return this.touchDragImageOffset={x:s.x-n.left,y:s.y-n.top},i.style.opacity="0.5",f.body.appendChild(i),i},destroyDragImage:function(){this.touchDragImage&&this.touchDragImage.parentElement&&this.touchDragImage.parentElement.removeChild(this.touchDragImage),this.touchDragImageOffset=null,this.touchDragImage=null},copyStyle:function(e,t){if(["id","class","style","draggable"].forEach(function(e){t.removeAttribute(e)}),e instanceof HTMLCanvasElement){var i=e,n=t;n.width=i.width,n.height=i.height,n.getContext("2d").drawImage(i,0,0)}for(var s=getComputedStyle(e),o=0;o<s.length;o++){var a=s[o];a.indexOf("transition")<0&&(t.style[a]=s[a])}t.style.pointerEvents="none";for(o=0;o<e.children.length;o++)this.copyStyle(e.children[o],t.children[o])},getTouchPoint:function(e){return e&&e.touches&&(e=e.touches[0]),{x:e.clientX,y:e.clientY}},moveDragImage:function(i,n){if(i&&n){var s=this;requestAnimationFrame(function(){var e=s.getTouchPoint(i),t=n.style;t.position="absolute",t.pointerEvents="none",t.zIndex="999999",s.touchDragImageOffset&&(t.left=Math.round(e.x-s.touchDragImageOffset.x)+"px",t.top=Math.round(e.y-s.touchDragImageOffset.y)+"px")})}},bindDragDrop:function(e){e.on("dragstart",this.dragstartHandler.bind(this)).on("dragover",this.dragoverHandler.bind(this)).on("dragend",this.dragendHandler.bind(this)).on("drop",this.dropHandler.bind(this)).on("touchstart",this.touchstartHandler.bind(this)).on("touchmove",this.touchmoveHandler.bind(this)).on("touchend",this.touchendHandler.bind(this))},createNode:function(i){var n=this.options,e=i.level;i.children&&i[n.nodeId]&&p.each(i.children,function(e,t){t.parentId=i[n.nodeId]});var t=p("<div"+(n.draggable?' draggable="true"':"")+(i[n.nodeId]?' id="'+i[n.nodeId]+'"':"")+(i.parentId?' data-parent="'+i.parentId+'"':"")+">").addClass("node "+(i.className||"")+(e>n.visibleLevel?" slide-up":""));n.nodeTemplate?t.append(n.nodeTemplate(i)):t.append('<div class="title">'+i[n.nodeTitle]+"</div>").append(void 0!==n.nodeContent?'<div class="content">'+(i[n.nodeContent]||"")+"</div>":"");var s=p.extend({},i);delete s.children,t.data("nodeData",s);var o=i.relationship||"";return n.verticalLevel&&e>=n.verticalLevel?e+1>n.verticalLevel&&Number(o.substr(2,1))&&t.append('<i class="toggleBtn oci"></i>').children(".title").prepend('<i class="oci '+n.parentNodeSymbol+' symbol"></i>'):(Number(o.substr(0,1))&&t.append('<i class="edge verticalEdge topEdge oci"></i>'),Number(o.substr(1,1))&&t.append('<i class="edge horizontalEdge rightEdge oci"></i><i class="edge horizontalEdge leftEdge oci"></i>'),Number(o.substr(2,1))&&t.append('<i class="edge verticalEdge bottomEdge oci"></i>').children(".title").prepend('<i class="oci '+n.parentNodeSymbol+' symbol"></i>')),t.on("mouseenter mouseleave",this.nodeEnterLeaveHandler.bind(this)),t.on("click",this.nodeClickHandler.bind(this)),t.on("click",".topEdge",this.topEdgeClickHandler.bind(this)),t.on("click",".bottomEdge",this.bottomEdgeClickHandler.bind(this)),t.on("click",".leftEdge, .rightEdge",this.hEdgeClickHandler.bind(this)),t.on("click",".toggleBtn",this.toggleVNodes.bind(this)),n.draggable&&(this.bindDragDrop(t),this.touchHandled=!1,this.touchMoved=!1,this.touchTargetNode=null),n.createNode&&n.createNode(t,i),t},buildHierarchy:function(e,t){var i=this,n=this.options,s=0;if(s=t.level?t.level:t.level=e.parentsUntil(".orgchart",".nodes").length,2<Object.keys(t).length){var o=this.createNode(t);n.verticalLevel&&n.verticalLevel,e.append(o)}if(t.children&&t.children.length){var a,r=s+1>n.visibleLevel||t.collapsed!==d&&t.collapsed;n.verticalLevel&&s+1>=n.verticalLevel?(a=p('<ul class="nodes">'),r&&s+1>=n.verticalLevel&&a.addClass("hidden"),s+1===n.verticalLevel?e.addClass("hybrid").append(a.addClass("vertical")):e.append(a)):(a=p('<ul class="nodes'+(r?" hidden":"")+'">'),2===Object.keys(t).length||r&&e.addClass("isChildrenCollapsed"),e.append(a)),p.each(t.children,function(){var e=p('<li class="hierarchy">');a.append(e),this.level=s+1,i.buildHierarchy(e,this)})}},buildChildNode:function(e,t){this.buildHierarchy(e,{children:t})},addChildren:function(e,t){this.buildChildNode(e.closest(".hierarchy"),t),e.find(".symbol").length||e.children(".title").prepend('<i class="oci '+this.options.parentNodeSymbol+' symbol"></i>'),e.closest(".nodes.vertical").length?e.children(".toggleBtn").length||e.append('<i class="toggleBtn oci"></i>'):e.children(".bottomEdge").length||e.append('<i class="edge verticalEdge bottomEdge oci"></i>'),this.isInAction(e)&&this.switchVerticalArrow(e.children(".bottomEdge"))},buildParentNode:function(e,t){t.relationship=t.relationship||"001";var i=p('<ul class="nodes"><li class="hierarchy"></li></ul>').find(".hierarchy").append(this.createNode(t)).end();this.$chart.prepend(i).find(".hierarchy:first").append(e.closest("ul").addClass("nodes"))},addParent:function(e,t){this.buildParentNode(e,t),e.children(".topEdge").length||e.children(".title").after('<i class="edge verticalEdge topEdge oci"></i>'),this.isInAction(e)&&this.switchVerticalArrow(e.children(".topEdge"))},buildSiblingNode:function(e,t){var i=p.isArray(t)?t.length:t.children.length,n=e.parent().is(".nodes")?e.siblings().length+1:1,s=n+i,o=1<s?Math.floor(s/2-1):0;if(e.closest(".nodes").parent().is(".hierarchy")){this.buildChildNode(e.parent().closest(".hierarchy"),t);var a=e.parent().closest(".hierarchy").children(".nodes:last").children(".hierarchy");1<n?a.eq(0).before(e.siblings().addBack().unwrap()):a.eq(o).after(e.unwrap())}else this.buildHierarchy(e.parent().prepend(p('<li class="hierarchy">')).children(".hierarchy:first"),t),e.prevAll(".hierarchy").children(".nodes").children().eq(o).after(e)},addSiblings:function(e,t){this.buildSiblingNode(e.closest(".hierarchy"),t),e.closest(".nodes").data("siblingsLoaded",!0),e.children(".leftEdge").length||e.children(".topEdge").after('<i class="edge horizontalEdge rightEdge oci"></i><i class="edge horizontalEdge leftEdge oci"></i>'),this.isInAction(e)&&(this.switchHorizontalArrow(e),e.children(".topEdge").removeClass("oci-chevron-up").addClass("oci-chevron-down"))},removeNodes:function(e){var t=e.closest(".hierarchy").parent();t.parent().is(".hierarchy")?this.getNodeState(e,"siblings").exist?(e.closest(".hierarchy").remove(),1===t.children().length&&t.find(".node:first .horizontalEdge").remove()):t.siblings(".node").find(".bottomEdge").remove().end().end().remove():t.closest(".orgchart").remove()},hideDropZones:function(){this.$chart.find(".allowedDrop").removeClass("allowedDrop")},showDropZones:function(e){this.$chart.find(".node").each(function(e,t){p(t).addClass("allowedDrop")}),this.$chart.data("dragged",p(e))},processExternalDrop:function(e,t){t&&this.$chart.data("dragged",p(t)),e.closest(".node").triggerHandler({type:"drop"})},exportPDF:function(e,t){var i={},n=Math.floor(e.width),s=Math.floor(e.height);u.jsPDF||(u.jsPDF=u.jspdf.jsPDF),(i=s<n?new jsPDF({orientation:"landscape",unit:"px",format:[n,s]}):new jsPDF({orientation:"portrait",unit:"px",format:[s,n]})).addImage(e.toDataURL(),"png",0,0),i.save(t+".pdf")},exportPNG:function(e,t){var i="WebkitAppearance"in f.documentElement.style,n=!!u.sidebar,s="Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&-1<navigator.appVersion.indexOf("Edge"),o=this.$chartContainer;if(!i&&!n||s)u.navigator.msSaveBlob(e.msToBlob(),t+".png");else{var a=".oci-download-btn"+(""!==this.options.chartClass?"."+this.options.chartClass:"");o.find(a).length||o.append('<a class="oci-download-btn'+(""!==this.options.chartClass?" "+this.options.chartClass:"")+'" download="'+t+'.png"></a>'),o.find(a).attr("href",e.toDataURL())[0].click()}},export:function(t,i){var n=this;if(t=void 0!==t?t:this.options.exportFilename,i=void 0!==i?i:this.options.exportFileextension,p(this).children(".spinner").length)return!1;var s=this.$chartContainer,e=s.find(".mask");e.length?e.removeClass("hidden"):s.append('<div class="mask"><i class="oci oci-spinner spinner"></i></div>');var o=s.addClass("canvasContainer").find('.orgchart:not(".hidden")').get(0),a="l2r"===n.options.direction||"r2l"===n.options.direction;html2canvas(o,{width:a?o.clientHeight:o.clientWidth,height:a?o.clientWidth:o.clientHeight,onclone:function(e){p(e).find(".canvasContainer").css("overflow","visible").find('.orgchart:not(".hidden"):first').css("transform","")}}).then(function(e){s.find(".mask").addClass("hidden"),"pdf"===i.toLowerCase()?n.exportPDF(e,t):n.exportPNG(e,t),s.removeClass("canvasContainer")},function(){s.removeClass("canvasContainer")})}},p.fn.orgchart=function(e){return new t(this,e).init()}});
|
|
2
2
|
//# sourceMappingURL=jquery.orgchart.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["jquery.orgchart.js"],"names":["factory","module","exports","require","window","document","jQuery","$","undefined","OrgChart","elem","opts","this","$chartContainer","defaultOptions","nodeTitle","nodeId","toggleSiblingsResp","visibleLevel","chartClass","exportButton","exportButtonName","exportFilename","exportFileextension","parentNodeSymbol","draggable","direction","pan","zoom","zoominLimit","zoomoutLimit","prototype","init","that","options","extend","$chart","remove","data","class","click","event","target","closest","length","find","removeClass","MutationObserver","triggerInitEvent","$root","append","type","buildHierarchy","buildJsonDS","children","ajaxURL","attachRel","ajax","url","dataType","done","textStatus","jqXHR","fail","errorThrown","console","log","always","attachExportButton","bindPan","bindZoom","mo","mutations","disconnect","initTime","i","j","addedNodes","classList","contains","initCompleted","initEvent","Event","trigger","observe","childList","triggerLoadEvent","$target","rel","triggerShowEvent","triggerHideEvent","$exportBtn","text","e","preventDefault","export","after","setOptions","val","unbindPan","unbindZoom","panStartHandler","delegateTarget","touches","css","lastX","lastY","lastTf","temp","split","indexOf","parseInt","startX","startY","targetTouches","pageX","pageY","on","newX","newY","matrix","join","panEndHandler","chart","off","zoomWheelHandler","oc","newScale","originalEvent","deltaY","setChartScale","zoomStartHandler","dist","getPinchDist","zoomingHandler","zoomEndHandler","diff","Math","sqrt","clientX","clientY","targetScale","abs","parseFloat","$li","subObj","name","contents","eq","trim","relationship","parent","is","siblings","each","key","value","push","flags","forEach","item","loopChart","includeNodeData","$node","id","getHierarchy","valid","getNodeState","relation","isVerticalNode","parents","exist","visible","getRelatedNodes","hideParentEnd","addClass","hideParent","$parent","hideSiblings","one","showParentEnd","node","isInAction","switchVerticalArrow","showParent","repaint","bind","stopAjax","$nodeLevel","isVisibleNode","index","hideChildrenEnd","animatedNodes","hideChildren","$lowerLevel","$animatedNodes","filter","get","lowerLevel","showChildrenEnd","showChildren","$levels","isVerticalDesc","hideSiblingsEnd","$nodeContainer","nodeContainer","$siblings","prevAll","nextAll","end","switchHorizontalArrow","showSiblingsEnd","visibleNodes","showRelatedParentEnd","showSiblings","$upperLevel","$visibleNodes","startLoading","$edge","not","prop","endLoading","removeAttr","attr","$arrow","toggleClass","$prevSib","prev","$nextSib","next","$sibs","sibsVisible","style","offsetWidth","nodeEnterLeaveHandler","flag","$toggleBtn","$topEdge","$bottomEdge","$leftEdge","nodeClickHandler","loadNodes","isEmptyObject","addParent","addChildren","addSiblings","HideFirstParentEnd","topEdge","topEdgeClickHandler","stopPropagation","parentState","isFunction","bottomEdgeClickHandler","childrenState","hEdgeClickHandler","$hEdge","siblingsState","families","expandVNodesEnd","vNodes","collapseVNodesEnd","toggleVNodes","$descWrapper","$descendants","$children","createGhostNode","ghostNode","nodeCover","$nodeDiv","origEvent","isFirefox","test","navigator","userAgent","toLowerCase","querySelector","createElementNS","add","appendChild","transValues","isHorizontal","scale","slice","setAttribute","outerWidth","outerHeight","xOffset","offsetX","yOffset","offsetY","ghostNodeWrapper","createElement","src","XMLSerializer","serializeToString","dataTransfer","setDragImage","filterAllowedDropNodes","$dragged","draggingNode","hasClass","$dragZone","$dragHier","dropCriteria","dragstartHandler","setData","dragoverHandler","dropEffect","dragendHandler","dropHandler","$dropZone","dropEvent","draggedNode","dragZone","dropZone","isDefaultPrevented","horizontalEdges","$dropSibs","prepend","triggerHandler","draggedItem","touchstartHandler","touchHandled","touchMoved","touchmoveHandler","currentTarget","touchDragImage","createDragImage","moveDragImage","$touchingNodes","elementFromPoint","touchingNodeElement","touchTargetNode","touchendHandler","destroyDragImage","fakeEventForDropHandler","firstTouch","changedTouches","fakeMouseClickEvent","createEvent","initMouseEvent","screenX","screenY","ctrlKey","altKey","shiftKey","metaKey","dispatchEvent","source","dragImage","cloneNode","copyStyle","top","left","sourceRectangle","getBoundingClientRect","sourcePoint","getTouchPoint","touchDragImageOffset","x","y","opacity","body","parentElement","removeChild","dst","att","removeAttribute","HTMLCanvasElement","cSrc","cDst","width","height","getContext","drawImage","cs","getComputedStyle","pointerEvents","image","orgChartMaster","requestAnimationFrame","pt","s","position","zIndex","round","bindDragDrop","createNode","level","child","parentId","className","nodeTemplate","nodeContent","nodeData","verticalLevel","Number","substr","$appendTo","parentsUntil","Object","keys","$nodesLayer","isHidden","collapsed","$nodeCell","buildChildNode","buildParentNode","$currentRoot","$newRootWrapper","buildSiblingNode","$nodeChart","newSiblingCount","isArray","existingSibligCount","siblingCount","insertPostion","floor","before","addBack","unwrap","removeNodes","$wrapper","hideDropZones","showDropZones","dragged","processExternalDrop","exportPDF","canvas","doc","docWidth","docHeight","jsPDF","jspdf","orientation","unit","format","addImage","toDataURL","save","exportPNG","isWebkit","documentElement","isFf","sidebar","isEdge","appName","appVersion","msSaveBlob","msToBlob","selector","$mask","sourceChart","html2canvas","clientHeight","clientWidth","onclone","cloneDoc","then","fn","orgchart"],"mappings":"AAUA,cAEC,SAAUA,GACa,iBAAXC,QAAiD,iBAAnBA,OAAOC,QAC9CF,EAAQG,QAAQ,UAAWC,OAAQC,UAEnCL,EAAQM,OAAQF,OAAQC,UAJ5B,CAME,SAAUE,EAAGH,EAAQC,EAAUG,GAChB,SAAXC,EAAqBC,EAAMC,GAC7BC,KAAKC,gBAAkBN,EAAEG,GACzBE,KAAKD,KAAOA,EACZC,KAAKE,eAAiB,CACpBC,UAAa,OACbC,OAAU,KACVC,oBAAsB,EACtBC,aAAgB,IAChBC,WAAc,GACdC,cAAgB,EAChBC,iBAAoB,SACpBC,eAAkB,WAClBC,oBAAuB,MACvBC,iBAAoB,aACpBC,WAAa,EACbC,UAAa,MACbC,KAAO,EACPC,MAAQ,EACRC,YAAe,EACfC,aAAgB,IAIpBrB,EAASsB,UAAY,CAEnBC,KAAM,SAAUrB,GACd,IAAIsB,EAAOrB,KACXA,KAAKsB,QAAU3B,EAAE4B,OAAO,GAAIvB,KAAKE,eAAgBF,KAAKD,KAAMA,GAE5D,IAAIE,EAAkBD,KAAKC,gBACvBD,KAAKwB,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,UAAUC,EAAQtZ,GAEvBW,EAAKuZ,UAAUZ,EAAQtZ,GAGzBT,EAAgBiC,YAAY,oBAC3B,WACDjC,EAAgBiC,YAAY,uBAKlCvC,EAAEoc,GAAGC,SAAW,SAAUjc,GACxB,OAAO,IAAIF,EAASG,KAAMD,GAAMqB","file":"jquery.orgchart.min.js","sourcesContent":["/*\n * jQuery OrgChart Plugin\n * https://github.com/dabeng/OrgChart\n *\n * Copyright 2016, dabeng\n * https://github.com/dabeng\n *\n * Licensed under the MIT license:\n * http://www.opensource.org/licenses/MIT\n */\n'use strict';\n\n(function (factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n factory(require('jquery'), window, document);\n } else {\n factory(jQuery, window, document);\n }\n}(function ($, window, document, undefined) {\n var OrgChart = function (elem, opts) {\n this.$chartContainer = $(elem);\n this.opts = opts;\n this.defaultOptions = {\n 'nodeTitle': 'name',\n 'nodeId': 'id',\n 'toggleSiblingsResp': false,\n 'visibleLevel': 999,\n 'chartClass': '',\n 'exportButton': false,\n 'exportButtonName': 'Export',\n 'exportFilename': 'OrgChart',\n 'exportFileextension': 'png',\n 'parentNodeSymbol': 'oci-leader',\n 'draggable': false,\n 'direction': 't2b',\n 'pan': false,\n 'zoom': false,\n 'zoominLimit': 7,\n 'zoomoutLimit': 0.5\n };\n };\n //\n OrgChart.prototype = {\n //\n init: function (opts) {\n var that = this;\n this.options = $.extend({}, this.defaultOptions, this.opts, opts);\n // build the org-chart\n var $chartContainer = this.$chartContainer;\n if (this.$chart) {\n this.$chart.remove();\n }\n var data = this.options.data;\n var $chart = this.$chart = $('<div>', {\n 'data': { 'options': this.options },\n 'class': 'orgchart' + (this.options.chartClass !== '' ? ' ' + this.options.chartClass : '') + (this.options.direction !== 't2b' ? ' ' + this.options.direction : ''),\n 'click': function(event) {\n if (!$(event.target).closest('.node').length) {\n $chart.find('.node.focused').removeClass('focused');\n }\n }\n });\n if (typeof MutationObserver !== 'undefined') {\n this.triggerInitEvent();\n }\n var $root = $chart.append($('<ul class=\"nodes\"><li class=\"hierarchy\"></li></ul>')).find('.hierarchy');\n if ($.type(data) === 'object') {\n if (data instanceof $) { // ul datasource\n this.buildHierarchy($root, this.buildJsonDS(data.children()), 0, this.options);\n } else { // local json datasource\n this.buildHierarchy($root, this.options.ajaxURL ? data : this.attachRel(data, '00'));\n }\n } else {\n $chart.append('<i class=\"oci oci-spinner spinner\"></i>');\n $.ajax({\n 'url': data,\n 'dataType': 'json'\n })\n .done(function(data, textStatus, jqXHR) {\n that.buildHierarchy($root, that.options.ajaxURL ? data : that.attachRel(data, '00'), 0, that.options);\n })\n .fail(function(jqXHR, textStatus, errorThrown) {\n console.log(errorThrown);\n })\n .always(function() {\n $chart.children('.spinner').remove();\n });\n }\n $chartContainer.append($chart);\n\n // append the export button\n if (this.options.exportButton && !$('.oc-export-btn').length) {\n this.attachExportButton();\n }\n\n if (this.options.pan) {\n this.bindPan();\n }\n\n if (this.options.zoom) {\n this.bindZoom();\n }\n\n return this;\n },\n //\n triggerInitEvent: function () {\n var that = this;\n var mo = new MutationObserver(function (mutations) {\n mo.disconnect();\n initTime:\n for (var i = 0; i < mutations.length; i++) {\n for (var j = 0; j < mutations[i].addedNodes.length; j++) {\n if (mutations[i].addedNodes[j].classList.contains('orgchart')) {\n if (that.options.initCompleted && typeof that.options.initCompleted === 'function') {\n that.options.initCompleted(that.$chart);\n }\n var initEvent = $.Event('init.orgchart');\n that.$chart.trigger(initEvent);\n break initTime;\n }\n }\n }\n });\n mo.observe(this.$chartContainer[0], { childList: true });\n },\n triggerLoadEvent: function ($target, rel) {\n var initEvent = $.Event('load-' + rel +'.orgchart');\n $target.trigger(initEvent);\n },\n triggerShowEvent: function ($target, rel) {\n var initEvent = $.Event('show-' + rel + '.orgchart');\n $target.trigger(initEvent);\n },\n triggerHideEvent: function ($target, rel) {\n var initEvent = $.Event('hide-' + rel + '.orgchart');\n $target.trigger(initEvent);\n },\n // add export button for orgchart\n attachExportButton: function () {\n var that = this;\n var $exportBtn = $('<button>', {\n 'class': 'oc-export-btn',\n 'text': this.options.exportButtonName,\n 'click': function(e) {\n e.preventDefault();\n that.export();\n }\n });\n this.$chartContainer.after($exportBtn);\n },\n setOptions: function (opts, val) {\n if (typeof opts === 'string') {\n if (opts === 'pan') {\n if (val) {\n this.bindPan();\n } else {\n this.unbindPan();\n }\n }\n if (opts === 'zoom') {\n if (val) {\n this.bindZoom();\n } else {\n this.unbindZoom();\n }\n }\n }\n if (typeof opts === 'object') {\n if (opts.data) {\n this.init(opts);\n } else {\n if (typeof opts.pan !== 'undefined') {\n if (opts.pan) {\n this.bindPan();\n } else {\n this.unbindPan();\n }\n }\n if (typeof opts.zoom !== 'undefined') {\n if (opts.zoom) {\n this.bindZoom();\n } else {\n this.unbindZoom();\n }\n }\n }\n }\n\n return this;\n },\n //\n panStartHandler: function (e) {\n var $chart = $(e.delegateTarget);\n if ($(e.target).closest('.node').length || (e.touches && e.touches.length > 1)) {\n $chart.data('panning', false);\n return;\n } else {\n $chart.css('cursor', 'move').data('panning', true);\n }\n var lastX = 0;\n var lastY = 0;\n var lastTf = $chart.css('transform');\n if (lastTf !== 'none') {\n var temp = lastTf.split(',');\n if (lastTf.indexOf('3d') === -1) {\n lastX = parseInt(temp[4]);\n lastY = parseInt(temp[5]);\n } else {\n lastX = parseInt(temp[12]);\n lastY = parseInt(temp[13]);\n }\n }\n var startX = 0;\n var startY = 0;\n if (!e.targetTouches) { // pand on desktop\n startX = e.pageX - lastX;\n startY = e.pageY - lastY;\n } else if (e.targetTouches.length === 1) { // pan on mobile device\n startX = e.targetTouches[0].pageX - lastX;\n startY = e.targetTouches[0].pageY - lastY;\n } else if (e.targetTouches.length > 1) {\n return;\n }\n $chart.on('mousemove touchmove',function(e) {\n if (!$chart.data('panning')) {\n return;\n }\n var newX = 0;\n var newY = 0;\n if (!e.targetTouches) { // pand on desktop\n newX = e.pageX - startX;\n newY = e.pageY - startY;\n } else if (e.targetTouches.length === 1) { // pan on mobile device\n newX = e.targetTouches[0].pageX - startX;\n newY = e.targetTouches[0].pageY - startY;\n } else if (e.targetTouches.length > 1) {\n return;\n }\n var lastTf = $chart.css('transform');\n if (lastTf === 'none') {\n if (lastTf.indexOf('3d') === -1) {\n $chart.css('transform', 'matrix(1, 0, 0, 1, ' + newX + ', ' + newY + ')');\n } else {\n $chart.css('transform', 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, ' + newX + ', ' + newY + ', 0, 1)');\n }\n } else {\n var matrix = lastTf.split(',');\n if (lastTf.indexOf('3d') === -1) {\n matrix[4] = ' ' + newX;\n matrix[5] = ' ' + newY + ')';\n } else {\n matrix[12] = ' ' + newX;\n matrix[13] = ' ' + newY;\n }\n $chart.css('transform', matrix.join(','));\n }\n });\n },\n //\n panEndHandler: function (e) {\n if (e.data.chart.data('panning')) {\n e.data.chart.data('panning', false).css('cursor', 'default').off('mousemove');\n }\n },\n //\n bindPan: function () {\n this.$chartContainer.css('overflow', 'hidden');\n this.$chart.on('mousedown touchstart', this.panStartHandler);\n $(document).on('mouseup touchend', { 'chart': this.$chart }, this.panEndHandler);\n },\n //\n unbindPan: function () {\n this.$chartContainer.css('overflow', 'auto');\n this.$chart.off('mousedown touchstart', this.panStartHandler);\n $(document).off('mouseup touchend', this.panEndHandler);\n },\n //\n zoomWheelHandler: function (e) {\n var oc = e.data.oc;\n e.preventDefault();\n var newScale = 1 + (e.originalEvent.deltaY > 0 ? -0.2 : 0.2);\n oc.setChartScale(oc.$chart, newScale);\n },\n //\n zoomStartHandler: function (e) {\n if(e.touches && e.touches.length === 2) {\n var oc = e.data.oc;\n oc.$chart.data('pinching', true);\n var dist = oc.getPinchDist(e);\n oc.$chart.data('pinchDistStart', dist);\n }\n },\n zoomingHandler: function (e) {\n var oc = e.data.oc;\n if(oc.$chart.data('pinching')) {\n var dist = oc.getPinchDist(e);\n oc.$chart.data('pinchDistEnd', dist);\n }\n },\n zoomEndHandler: function (e) {\n var oc = e.data.oc;\n if(oc.$chart.data('pinching')) {\n oc.$chart.data('pinching', false);\n var diff = oc.$chart.data('pinchDistEnd') - oc.$chart.data('pinchDistStart');\n if (diff > 0) {\n oc.setChartScale(oc.$chart, 1.2);\n } else if (diff < 0) {\n oc.setChartScale(oc.$chart, 0.8);\n }\n }\n },\n //\n bindZoom: function () {\n this.$chartContainer.on('wheel', { 'oc': this }, this.zoomWheelHandler);\n this.$chartContainer.on('touchstart', { 'oc': this }, this.zoomStartHandler);\n $(document).on('touchmove', { 'oc': this }, this.zoomingHandler);\n $(document).on('touchend', { 'oc': this }, this.zoomEndHandler);\n },\n unbindZoom: function () {\n this.$chartContainer.off('wheel', this.zoomWheelHandler);\n this.$chartContainer.off('touchstart', this.zoomStartHandler);\n $(document).off('touchmove', this.zoomingHandler);\n $(document).off('touchend', this.zoomEndHandler);\n },\n //\n getPinchDist: function (e) {\n return Math.sqrt((e.touches[0].clientX - e.touches[1].clientX) * (e.touches[0].clientX - e.touches[1].clientX) +\n (e.touches[0].clientY - e.touches[1].clientY) * (e.touches[0].clientY - e.touches[1].clientY));\n },\n //\n setChartScale: function ($chart, newScale) {\n var opts = $chart.data('options');\n var lastTf = $chart.css('transform');\n var matrix = '';\n var targetScale = 1;\n if (lastTf === 'none') {\n $chart.css('transform', 'scale(' + newScale + ',' + newScale + ')');\n } else {\n matrix = lastTf.split(',');\n if (lastTf.indexOf('3d') === -1) {\n targetScale = Math.abs(window.parseFloat(matrix[3]) * newScale);\n if (targetScale > opts.zoomoutLimit && targetScale < opts.zoominLimit) {\n $chart.css('transform', lastTf + ' scale(' + newScale + ',' + newScale + ')');\n }\n } else {\n targetScale = Math.abs(window.parseFloat(matrix[1]) * newScale);\n if (targetScale > opts.zoomoutLimit && targetScale < opts.zoominLimit) {\n $chart.css('transform', lastTf + ' scale3d(' + newScale + ',' + newScale + ', 1)');\n }\n }\n }\n },\n //\n buildJsonDS: function ($li) {\n var that = this;\n var subObj = {\n 'name': $li.contents().eq(0).text().trim(),\n 'relationship': ($li.parent().parent().is('li') ? '1': '0') + ($li.siblings('li').length ? 1: 0) + ($li.children('ul').length ? 1 : 0)\n };\n $.each($li.data(), function(key, value) {\n subObj[key] = value;\n });\n $li.children('ul').children().each(function() {\n if (!subObj.children) { subObj.children = []; }\n subObj.children.push(that.buildJsonDS($(this)));\n });\n return subObj;\n },\n //\n attachRel: function (data, flags) {\n var that = this;\n data.relationship = flags + (data.children && data.children.length > 0 ? 1 : 0);\n if (data.children) {\n data.children.forEach(function(item) {\n that.attachRel(item, '1' + (data.children.length > 1 ? 1 : 0));\n });\n }\n return data;\n },\n //\n loopChart: function ($chart, includeNodeData) {\n includeNodeData = (includeNodeData !== null && includeNodeData !== undefined) ? includeNodeData : false;\n var that = this;\n var $node = $chart.find('.node:first');\n var subObj = { 'id': $node[0].id };\n if (includeNodeData) {\n $.each($node.data('nodeData'), function (key, value) {\n subObj[key] = value;\n });\n }\n $node.siblings('.nodes').children().each(function() {\n if (!subObj.children) { subObj.children = []; }\n subObj.children.push(that.loopChart($(this), includeNodeData));\n });\n return subObj;\n },\n //\n getHierarchy: function (includeNodeData) {\n includeNodeData = (includeNodeData !== null && includeNodeData !== undefined) ? includeNodeData : false;\n if (typeof this.$chart === 'undefined') {\n return 'Error: orgchart does not exist'\n } else {\n if (!this.$chart.find('.node').length) {\n return 'Error: nodes do not exist'\n } else {\n var valid = true;\n this.$chart.find('.node').each(function () {\n if (!this.id) {\n valid = false;\n return false;\n }\n });\n if (!valid) {\n return 'Error: All nodes of orghcart to be exported must have data-id attribute!';\n }\n }\n }\n return this.loopChart(this.$chart, includeNodeData);\n },\n // detect the exist/display state of related node\n getNodeState: function ($node, relation) {\n var $target = {};\n var isVerticalNode = !!$node.closest('vertical').length;\n var relation = relation || 'self';\n if (relation === 'parent') {\n if (isVerticalNode) {\n $target = $node.closest('ul').parents('ul');\n if (!$target.length) {\n $target = $node.closest('.nodes');\n if (!$target.length) {\n $target = $node.closest('.vertical').siblings(':first');\n }\n }\n } else {\n $target = $node.closest('.nodes').siblings('.node');\n }\n if ($target.length) {\n if ($target.is('.hidden') || (!$target.is('.hidden') && $target.closest('.nodes').is('.hidden')) || (!$target.is('.hidden') && $target.closest('.vertical').is('.hidden'))) {\n return { 'exist': true, 'visible': false };\n }\n return { 'exist': true, 'visible': true };\n }\n } else if (relation === 'children') {\n $target = isVerticalNode ? $node.parent().children('ul') : $node.siblings('.nodes');\n if ($target.length) {\n if (!$target.is('.hidden')) {\n return { 'exist': true, 'visible': true };\n }\n return { 'exist': true, 'visible': false };\n }\n } else if (relation === 'siblings') {\n $target = isVerticalNode ? $node.closest('ul') : $node.parent().siblings();\n if ($target.length && (!isVerticalNode || $target.children('li').length > 1)) {\n if (!$target.is('.hidden') && !$target.parent().is('.hidden') && (!isVerticalNode || !$target.closest('.vertical').is('.hidden'))) {\n return { 'exist': true, 'visible': true };\n }\n return { 'exist': true, 'visible': false };\n }\n } else {\n $target = $node;\n if ($target.length) {\n if (!(($target.closest('.nodes').length && $target.closest('.nodes').is('.hidden')) ||\n ($target.closest('.hierarchy').length && $target.closest('.hierarchy').is('.hidden')) ||\n ($target.closest('.vertical').length && ($target.closest('.nodes').is('.hidden') || $target.closest('.vertical').is('.hidden')))\n )) {\n return { 'exist': true, 'visible': true };\n }\n return { 'exist': true, 'visible': false };\n }\n }\n return { 'exist': false, 'visible': false };\n },\n // find the related nodes\n getRelatedNodes: function ($node, relation) {\n if (!$node || !($node instanceof $) || !$node.is('.node')) {\n return $();\n }\n if (relation === 'parent') {\n return $node.closest('.nodes').siblings('.node');\n } else if (relation === 'children') {\n return $node.siblings('.nodes').children('.hierarchy').find('.node:first');\n } else if (relation === 'siblings') {\n return $node.closest('.hierarchy').siblings().find('.node:first');\n } else {\n return $();\n }\n },\n hideParentEnd: function (event) {\n $(event.target).removeClass('sliding');\n event.data.parent.addClass('hidden');\n },\n // recursively hide the ancestor node and sibling nodes of the specified node\n hideParent: function ($node) {\n var $parent = $node.closest('.nodes').siblings('.node');\n if ($parent.find('.spinner').length) {\n $node.closest('.orgchart').data('inAjax', false);\n }\n // hide the sibling nodes\n if (this.getNodeState($node, 'siblings').visible) {\n this.hideSiblings($node);\n }\n // hide the lines\n $node.parent().addClass('isAncestorsCollapsed');\n // hide the superior nodes with transition\n if (this.getNodeState($parent).visible) {\n $parent.addClass('sliding slide-down').one('transitionend', { 'parent': $parent }, this.hideParentEnd);\n }\n // if the current node has the parent node, hide it recursively\n if (this.getNodeState($parent, 'parent').visible) {\n this.hideParent($parent);\n }\n },\n showParentEnd: function (event) {\n var $node = event.data.node;\n $(event.target).removeClass('sliding');\n if (this.isInAction($node)) {\n this.switchVerticalArrow($node.children('.topEdge'));\n }\n },\n // show the parent node of the specified node\n showParent: function ($node) {\n // just show only one superior level\n var $parent = $node.closest('.nodes').siblings('.node').removeClass('hidden');\n // just show only one line\n $node.closest('.hierarchy').removeClass('isAncestorsCollapsed');\n // show parent node with animation\n this.repaint($parent[0]);\n $parent.addClass('sliding').removeClass('slide-down').one('transitionend', { 'node': $node }, this.showParentEnd.bind(this));\n },\n stopAjax: function ($nodeLevel) {\n if ($nodeLevel.find('.spinner').length) {\n $nodeLevel.closest('.orgchart').data('inAjax', false);\n }\n },\n isVisibleNode: function (index, elem) {\n return this.getNodeState($(elem)).visible;\n },\n // do some necessary cleanup tasks when hide animation is finished\n hideChildrenEnd: function (event) {\n var $node = event.data.node;\n event.data.animatedNodes.removeClass('sliding');\n event.data.animatedNodes.closest('.nodes').addClass('hidden');\n if (this.isInAction($node)) {\n this.switchVerticalArrow($node.children('.bottomEdge'));\n }\n },\n // recursively hide the descendant nodes of the specified node\n hideChildren: function ($node) {\n $node.closest('.hierarchy').addClass('isChildrenCollapsed');\n var $lowerLevel = $node.siblings('.nodes');\n this.stopAjax($lowerLevel);\n var $animatedNodes = $lowerLevel.find('.node').filter(this.isVisibleNode.bind(this));\n var isVerticalDesc = $lowerLevel.is('.vertical');\n if (!isVerticalDesc) {\n $animatedNodes.closest('.hierarchy').addClass('isCollapsedDescendant');\n }\n if ($lowerLevel.is('.vertical') || $lowerLevel.find('.vertical').length) {\n $animatedNodes.find('.oci-minus-square').removeClass('oci-minus-square').addClass('oci-plus-square');\n }\n this.repaint($animatedNodes.get(0));\n $animatedNodes.addClass('sliding slide-up').eq(0).one('transitionend', { 'animatedNodes': $animatedNodes, 'lowerLevel': $lowerLevel, 'node': $node }, this.hideChildrenEnd.bind(this));\n },\n //\n showChildrenEnd: function (event) {\n var $node = event.data.node;\n event.data.animatedNodes.removeClass('sliding');\n if (this.isInAction($node)) {\n this.switchVerticalArrow($node.children('.bottomEdge'));\n }\n },\n // show the children nodes of the specified node\n showChildren: function ($node) {\n var that = this;\n $node.closest('.hierarchy').removeClass('isChildrenCollapsed');\n var $levels = $node.siblings('.nodes');\n var isVerticalDesc = $levels.is('.vertical');\n var $animatedNodes = isVerticalDesc\n ? $levels.removeClass('hidden').find('.node').filter(this.isVisibleNode.bind(this))\n : $levels.removeClass('hidden').children('.hierarchy').find('.node:first').filter(this.isVisibleNode.bind(this));\n if (!isVerticalDesc) {\n $animatedNodes.filter(':not(:only-child)').closest('.hierarchy').addClass('isChildrenCollapsed');\n $animatedNodes.closest('.hierarchy').removeClass('isCollapsedDescendant');\n }\n // the two following statements are used to enforce browser to repaint\n this.repaint($animatedNodes.get(0));\n $animatedNodes.addClass('sliding').removeClass('slide-up').eq(0).one('transitionend', { 'node': $node, 'animatedNodes': $animatedNodes }, this.showChildrenEnd.bind(this));\n },\n //\n hideSiblingsEnd: function (event) {\n var $node = event.data.node;\n var $nodeContainer = event.data.nodeContainer;\n var direction = event.data.direction;\n var $siblings = direction ? (direction === 'left' ? $nodeContainer.prevAll(':not(.hidden)') : $nodeContainer.nextAll(':not(.hidden)')) : $nodeContainer.siblings();\n event.data.animatedNodes.removeClass('sliding');\n $siblings.find('.node:gt(0)').filter(this.isVisibleNode.bind(this))\n .removeClass('slide-left slide-right').addClass('slide-up');\n $siblings.find('.nodes, .vertical').addClass('hidden')\n .end().addClass('hidden');\n\n if (this.isInAction($node)) {\n this.switchHorizontalArrow($node);\n }\n },\n // hide the sibling nodes of the specified node\n hideSiblings: function ($node, direction) {\n var that = this;\n var $nodeContainer = $node.closest('.hierarchy').addClass('isSiblingsCollapsed');\n if ($nodeContainer.siblings().find('.spinner').length) {\n $node.closest('.orgchart').data('inAjax', false);\n }\n if (direction) {\n if (direction === 'left') {\n $nodeContainer.addClass('left-sibs')\n .prevAll('.isSiblingsCollapsed').removeClass('isSiblingsCollapsed left-sibs').end()\n .prevAll().addClass('isCollapsedSibling isChildrenCollapsed')\n .find('.node').filter(this.isVisibleNode.bind(this)).addClass('sliding slide-right');\n } else {\n $nodeContainer.addClass('right-sibs')\n .nextAll('.isSiblingsCollapsed').removeClass('isSiblingsCollapsed right-sibs').end()\n .nextAll().addClass('isCollapsedSibling isChildrenCollapsed')\n .find('.node').filter(this.isVisibleNode.bind(this)).addClass('sliding slide-left');\n }\n } else {\n $nodeContainer.prevAll().find('.node').filter(this.isVisibleNode.bind(this)).addClass('sliding slide-right');\n $nodeContainer.nextAll().find('.node').filter(this.isVisibleNode.bind(this)).addClass('sliding slide-left');\n $nodeContainer.siblings().addClass('isCollapsedSibling isChildrenCollapsed');\n }\n var $animatedNodes = $nodeContainer.siblings().find('.sliding');\n $animatedNodes.eq(0).one('transitionend', { 'node': $node, 'nodeContainer': $nodeContainer, 'direction': direction, 'animatedNodes': $animatedNodes }, this.hideSiblingsEnd.bind(this));\n },\n //\n showSiblingsEnd: function (event) {\n var $node = event.data.node;\n event.data.visibleNodes.removeClass('sliding');\n if (this.isInAction($node)) {\n this.switchHorizontalArrow($node);\n $node.children('.topEdge').removeClass('oci-chevron-up').addClass('oci-chevron-down');\n }\n },\n //\n showRelatedParentEnd: function(event) {\n $(event.target).removeClass('sliding');\n },\n // show the sibling nodes of the specified node\n showSiblings: function ($node, direction) {\n var that = this;\n // firstly, show the sibling nodes\n var $siblings = $();\n var $nodeContainer = $node.closest('.hierarchy');\n if (direction) {\n if (direction === 'left') {\n $siblings = $nodeContainer.prevAll().removeClass('hidden');\n } else {\n $siblings = $nodeContainer.nextAll().removeClass('hidden');\n }\n } else {\n $siblings = $node.closest('.hierarchy').siblings().removeClass('hidden');\n }\n // secondly, show the lines\n var $upperLevel = $node.closest('.nodes').siblings('.node');\n if (direction) {\n $nodeContainer.removeClass(direction + '-sibs');\n if (!$nodeContainer.is('[class*=-sibs]')) {\n $nodeContainer.removeClass('isSiblingsCollapsed');\n }\n $siblings.removeClass('isCollapsedSibling ' + direction + '-sibs');\n } else {\n $node.closest('.hierarchy').removeClass('isSiblingsCollapsed');\n $siblings.removeClass('isCollapsedSibling');\n }\n // thirdly, show parent node if it is collapsed\n if (!this.getNodeState($node, 'parent').visible) {\n $node.closest('.hierarchy').removeClass('isAncestorsCollapsed');\n $upperLevel.removeClass('hidden');\n this.repaint($upperLevel[0]);\n $upperLevel.addClass('sliding').removeClass('slide-down').one('transitionend', this.showRelatedParentEnd);\n }\n // lastly, show the sibling nodes with animation\n var $visibleNodes = $siblings.find('.node').filter(this.isVisibleNode.bind(this));\n this.repaint($visibleNodes.get(0));\n $visibleNodes.addClass('sliding').removeClass('slide-left slide-right');\n $visibleNodes.eq(0).one('transitionend', { 'node': $node, 'visibleNodes': $visibleNodes }, this.showSiblingsEnd.bind(this));\n },\n // start up loading status for requesting new nodes\n startLoading: function ($edge) {\n var $chart = this.$chart;\n if (typeof $chart.data('inAjax') !== 'undefined' && $chart.data('inAjax') === true) {\n return false;\n }\n\n $edge.addClass('hidden');\n $edge.parent().append('<i class=\"oci oci-spinner spinner\"></i>')\n .children().not('.spinner').css('opacity', 0.2);\n $chart.data('inAjax', true);\n $('.oc-export-btn').prop('disabled', true);\n return true;\n },\n // terminate loading status for requesting new nodes\n endLoading: function ($edge) {\n var $node = $edge.parent();\n $edge.removeClass('hidden');\n $node.find('.spinner').remove();\n $node.children().removeAttr('style');\n this.$chart.data('inAjax', false);\n $('.oc-export-btn').prop('disabled', false);\n },\n // whether the cursor is hovering over the node\n isInAction: function ($node) {\n return $node.children('.edge').attr('class').indexOf('oci-') > -1 ? true : false;\n },\n //\n switchVerticalArrow: function ($arrow) {\n $arrow.toggleClass('oci-chevron-up').toggleClass('oci-chevron-down');\n },\n //\n switchHorizontalArrow: function ($node) {\n var opts = this.options;\n if (opts.toggleSiblingsResp && (typeof opts.ajaxURL === 'undefined' || $node.closest('.nodes').data('siblingsLoaded'))) {\n var $prevSib = $node.parent().prev();\n if ($prevSib.length) {\n if ($prevSib.is('.hidden')) {\n $node.children('.leftEdge').addClass('oci-chevron-left').removeClass('oci-chevron-right');\n } else {\n $node.children('.leftEdge').addClass('oci-chevron-right').removeClass('oci-chevron-left');\n }\n }\n var $nextSib = $node.parent().next();\n if ($nextSib.length) {\n if ($nextSib.is('.hidden')) {\n $node.children('.rightEdge').addClass('oci-chevron-right').removeClass('oci-chevron-left');\n } else {\n $node.children('.rightEdge').addClass('oci-chevron-left').removeClass('oci-chevron-right');\n }\n }\n } else {\n var $sibs = $node.parent().siblings();\n var sibsVisible = $sibs.length ? !$sibs.is('.hidden') : false;\n $node.children('.leftEdge').toggleClass('oci-chevron-right', sibsVisible).toggleClass('oci-chevron-left', !sibsVisible);\n $node.children('.rightEdge').toggleClass('oci-chevron-left', sibsVisible).toggleClass('oci-chevron-right', !sibsVisible);\n }\n },\n //\n repaint: function (node) {\n if (node) {\n node.style.offsetWidth = node.offsetWidth;\n }\n },\n // determines how to show arrow buttons \n nodeEnterLeaveHandler: function (event) {\n var $node = $(event.delegateTarget);\n var flag = false;\n if ($node.closest('.nodes.vertical').length) {\n var $toggleBtn = $node.children('.toggleBtn');\n if (event.type === 'mouseenter') {\n if ($node.children('.toggleBtn').length) {\n flag = this.getNodeState($node, 'children').visible;\n $toggleBtn.toggleClass('oci-plus-square', !flag).toggleClass('oci-minus-square', flag);\n }\n } else {\n $toggleBtn.removeClass('oci-plus-square oci-minus-square');\n }\n } else {\n var $topEdge = $node.children('.topEdge');\n var $rightEdge = $node.children('.rightEdge');\n var $bottomEdge = $node.children('.bottomEdge');\n var $leftEdge = $node.children('.leftEdge');\n if (event.type === 'mouseenter') {\n if ($topEdge.length) {\n flag = this.getNodeState($node, 'parent').visible;\n $topEdge.toggleClass('oci-chevron-up', !flag).toggleClass('oci-chevron-down', flag);\n }\n if ($bottomEdge.length) {\n flag = this.getNodeState($node, 'children').visible;\n $bottomEdge.toggleClass('oci-chevron-down', !flag).toggleClass('oci-chevron-up', flag);\n }\n if ($leftEdge.length) {\n this.switchHorizontalArrow($node);\n }\n } else {\n $node.children('.edge').removeClass('oci-chevron-up oci-chevron-down oci-chevron-right oci-chevron-left');\n }\n }\n },\n //\n nodeClickHandler: function (event) {\n this.$chart.find('.focused').removeClass('focused');\n $(event.delegateTarget).addClass('focused');\n },\n // load new nodes by ajax\n loadNodes: function (rel, url, $edge) {\n var that = this;\n var opts = this.options;\n $.ajax({ 'url': url, 'dataType': 'json' })\n .done(function (data) {\n if (that.$chart.data('inAjax')) {\n if (rel === 'parent') {\n if (!$.isEmptyObject(data)) {\n that.addParent($edge.parent(), data);\n }\n } else if (rel === 'children') {\n if (data.children.length) {\n that.addChildren($edge.parent(), data[rel]);\n }\n } else {\n that.addSiblings($edge.parent(), data.siblings ? data.siblings : data);\n }\n that.triggerLoadEvent($edge.parent(), rel);\n }\n })\n .fail(function () {\n console.log('Failed to get ' + rel + ' data');\n })\n .always(function () {\n that.endLoading($edge);\n });\n },\n //\n HideFirstParentEnd: function (event) {\n var $topEdge = event.data.topEdge;\n var $node = $topEdge.parent();\n if (this.isInAction($node)) {\n this.switchVerticalArrow($topEdge);\n this.switchHorizontalArrow($node);\n }\n },\n // actions on clinking top edge of a node\n topEdgeClickHandler: function (event) {\n event.stopPropagation();\n var that = this;\n var $topEdge = $(event.target);\n var $node = $(event.delegateTarget);\n var parentState = this.getNodeState($node, 'parent');\n if (parentState.exist) {\n var $parent = $node.closest('.nodes').siblings('.node');\n if ($parent.is('.sliding')) { return; }\n // hide the ancestor nodes and sibling nodes of the specified node\n if (parentState.visible) {\n this.hideParent($node);\n $parent.one('transitionend', { 'topEdge': $topEdge }, this.HideFirstParentEnd.bind(this));\n this.triggerHideEvent($node, 'parent');\n } else { // show the ancestors and siblings\n this.showParent($node);\n this.triggerShowEvent($node, 'parent');\n }\n } else { // load the new parent node of the specified node by ajax request\n // start up loading status\n if (this.startLoading($topEdge)) {\n var opts = this.options;\n var url = $.isFunction(opts.ajaxURL.parent) ? opts.ajaxURL.parent($node.data('nodeData')) : opts.ajaxURL.parent + $node[0].id;\n this.loadNodes('parent', url, $topEdge);\n }\n }\n },\n // actions on clinking bottom edge of a node\n bottomEdgeClickHandler: function (event) {\n event.stopPropagation();\n var $bottomEdge = $(event.target);\n var $node = $(event.delegateTarget);\n var childrenState = this.getNodeState($node, 'children');\n if (childrenState.exist) {\n var $children = $node.siblings('.nodes').children().children('.node');\n if ($children.is('.sliding')) { return; }\n // hide the descendant nodes of the specified node\n if (childrenState.visible) {\n this.hideChildren($node);\n this.triggerHideEvent($node, 'children');\n } else { // show the descendants\n this.showChildren($node);\n this.triggerShowEvent($node, 'children');\n }\n } else { // load the new children nodes of the specified node by ajax request\n if (this.startLoading($bottomEdge)) {\n var opts = this.options;\n var url = $.isFunction(opts.ajaxURL.children) ? opts.ajaxURL.children($node.data('nodeData')) : opts.ajaxURL.children + $node[0].id;\n this.loadNodes('children', url, $bottomEdge);\n }\n }\n },\n // actions on clicking horizontal edges\n hEdgeClickHandler: function (event) {\n event.stopPropagation();\n var $hEdge = $(event.target);\n var $node = $(event.delegateTarget);\n var opts = this.options;\n var siblingsState = this.getNodeState($node, 'siblings');\n if (siblingsState.exist) {\n var $siblings = $node.closest('.hierarchy').siblings();\n if ($siblings.find('.sliding').length) { return; }\n if (opts.toggleSiblingsResp) {\n var $prevSib = $node.closest('.hierarchy').prev();\n var $nextSib = $node.closest('.hierarchy').next();\n if ($hEdge.is('.leftEdge')) {\n if ($prevSib.is('.hidden')) {\n this.showSiblings($node, 'left');\n this.triggerShowEvent($node,'siblings');\n } else {\n this.hideSiblings($node, 'left');\n this.triggerHideEvent($node, 'siblings');\n }\n } else {\n if ($nextSib.is('.hidden')) {\n this.showSiblings($node, 'right');\n this.triggerShowEvent($node,'siblings');\n } else {\n this.hideSiblings($node, 'right');\n this.triggerHideEvent($node, 'siblings');\n }\n }\n } else {\n if (siblingsState.visible) {\n this.hideSiblings($node);\n this.triggerHideEvent($node, 'siblings');\n } else {\n this.showSiblings($node);\n this.triggerShowEvent($node, 'siblings');\n }\n }\n } else {\n // load the new sibling nodes of the specified node by ajax request\n if (this.startLoading($hEdge)) {\n var nodeId = $node[0].id;\n var url = (this.getNodeState($node, 'parent').exist) ?\n ($.isFunction(opts.ajaxURL.siblings) ? opts.ajaxURL.siblings($node.data('nodeData')) : opts.ajaxURL.siblings + nodeId) :\n ($.isFunction(opts.ajaxURL.families) ? opts.ajaxURL.families($node.data('nodeData')) : opts.ajaxURL.families + nodeId);\n this.loadNodes('siblings', url, $hEdge);\n }\n }\n },\n //\n expandVNodesEnd: function (event) {\n event.data.vNodes.removeClass('sliding');\n },\n //\n collapseVNodesEnd: function (event) {\n event.data.vNodes.removeClass('sliding').closest('ul').addClass('hidden');\n },\n // event handler for toggle buttons in Hybrid(horizontal + vertical) OrgChart\n toggleVNodes: function (event) {\n var $toggleBtn = $(event.target);\n var $descWrapper = $toggleBtn.parent().next();\n var $descendants = $descWrapper.find('.node');\n var $children = $descWrapper.children().children('.node');\n if ($children.is('.sliding')) { return; }\n $toggleBtn.toggleClass('oci-plus-square oci-minus-square');\n if ($descendants.eq(0).is('.slide-up')) {\n $descWrapper.removeClass('hidden');\n this.repaint($children.get(0));\n $children.addClass('sliding').removeClass('slide-up').eq(0).one('transitionend', { 'vNodes': $children }, this.expandVNodesEnd);\n } else {\n $descendants.addClass('sliding slide-up').eq(0).one('transitionend', { 'vNodes': $descendants }, this.collapseVNodesEnd);\n $descendants.find('.toggleBtn').removeClass('oci-minus-square').addClass('oci-plus-square');\n }\n },\n //\n createGhostNode: function (event) {\n var $nodeDiv = $(event.target);\n var opts = this.options;\n var origEvent = event.originalEvent;\n var isFirefox = /firefox/.test(window.navigator.userAgent.toLowerCase());\n var ghostNode, nodeCover;\n if (!document.querySelector('.ghost-node')) {\n ghostNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n if (!ghostNode.classList) return;\n ghostNode.classList.add('ghost-node');\n nodeCover = document.createElementNS('http://www.w3.org/2000/svg','rect');\n ghostNode.appendChild(nodeCover);\n $nodeDiv.closest('.orgchart').append(ghostNode);\n } else {\n ghostNode = $nodeDiv.closest('.orgchart').children('.ghost-node').get(0);\n nodeCover = $(ghostNode).children().get(0);\n }\n var transValues = $nodeDiv.closest('.orgchart').css('transform').split(',');\n var isHorizontal = opts.direction === 't2b' || opts.direction === 'b2t';\n var scale = Math.abs(window.parseFloat(isHorizontal ? transValues[0].slice(transValues[0].indexOf('(') + 1) : transValues[1]));\n ghostNode.setAttribute('width', isHorizontal ? $nodeDiv.outerWidth(false) : $nodeDiv.outerHeight(false));\n ghostNode.setAttribute('height', isHorizontal ? $nodeDiv.outerHeight(false) : $nodeDiv.outerWidth(false));\n nodeCover.setAttribute('x',5 * scale);\n nodeCover.setAttribute('y',5 * scale);\n nodeCover.setAttribute('width', 120 * scale);\n nodeCover.setAttribute('height', 40 * scale);\n nodeCover.setAttribute('rx', 4 * scale);\n nodeCover.setAttribute('ry', 4 * scale);\n nodeCover.setAttribute('stroke-width', 1 * scale);\n var xOffset = origEvent.offsetX * scale;\n var yOffset = origEvent.offsetY * scale;\n if (opts.direction === 'l2r') {\n xOffset = origEvent.offsetY * scale;\n yOffset = origEvent.offsetX * scale;\n } else if (opts.direction === 'r2l') {\n xOffset = $nodeDiv.outerWidth(false) - origEvent.offsetY * scale;\n yOffset = origEvent.offsetX * scale;\n } else if (opts.direction === 'b2t') {\n xOffset = $nodeDiv.outerWidth(false) - origEvent.offsetX * scale;\n yOffset = $nodeDiv.outerHeight(false) - origEvent.offsetY * scale;\n }\n if (isFirefox) { // hack for old version of Firefox(< 48.0)\n nodeCover.setAttribute('fill', 'rgb(255, 255, 255)');\n nodeCover.setAttribute('stroke', 'rgb(191, 0, 0)');\n var ghostNodeWrapper = document.createElement('img');\n ghostNodeWrapper.src = 'data:image/svg+xml;utf8,' + (new XMLSerializer()).serializeToString(ghostNode);\n origEvent.dataTransfer.setDragImage(ghostNodeWrapper, xOffset, yOffset);\n } else {\n // IE/Edge do not support this, so only use it if we can\n if (origEvent.dataTransfer.setDragImage)\n origEvent.dataTransfer.setDragImage(ghostNode, xOffset, yOffset);\n }\n },\n //\n filterAllowedDropNodes: function ($dragged) {\n var opts = this.options;\n // what is being dragged? a node, or something within a node?\n var draggingNode = $dragged.closest('[draggable]').hasClass('node');\n var $dragZone = $dragged.closest('.nodes').siblings('.node'); // parent node\n var $dragHier = $dragged.closest('.hierarchy').find('.node'); // this node, and its children\n this.$chart.data('dragged', $dragged)\n .find('.node').each(function (index, node) {\n if (!draggingNode || $dragHier.index(node) === -1) {\n if (opts.dropCriteria) {\n if (opts.dropCriteria($dragged, $dragZone, $(node))) {\n $(node).addClass('allowedDrop');\n }\n } else {\n $(node).addClass('allowedDrop');\n }\n }\n });\n },\n //\n dragstartHandler: function (event) {\n event.originalEvent.dataTransfer.setData('text/html', 'hack for firefox');\n // if users enable zoom or direction options\n if (this.$chart.css('transform') !== 'none') {\n this.createGhostNode(event);\n }\n this.filterAllowedDropNodes($(event.target));\n },\n //\n dragoverHandler: function (event) {\n if (!$(event.delegateTarget).is('.allowedDrop')) {\n event.originalEvent.dataTransfer.dropEffect = 'none';\n } else {\n // default action for drag-and-drop of div is not to drop, so preventing default action for nodes which have allowedDrop class\n //to fix drag and drop on IE and Edge\t\t\n event.preventDefault();\n }\n },\n //\n dragendHandler: function (event) {\n this.$chart.find('.allowedDrop').removeClass('allowedDrop');\n },\n // when user drops the node, it will be removed from original parent node and be added to new parent node\n dropHandler: function (event) {\n var $dropZone = $(event.delegateTarget);\n var $dragged = this.$chart.data('dragged');\n\n // Pass on drops which are not nodes (since they are not our doing)\n if (!$dragged.hasClass('node')) {\n this.$chart.triggerHandler({ 'type': 'otherdropped.orgchart', 'draggedItem': $dragged, 'dropZone': $dropZone });\n return;\n }\n \n if (!$dropZone.hasClass('allowedDrop')) {\n // We are trying to drop a node into a node which isn't allowed\n // IE/Edge have a habit of allowing this, so we need our own double-check\n return;\n }\n\n var $dragZone = $dragged.closest('.nodes').siblings('.node');\n var dropEvent = $.Event('nodedrop.orgchart');\n this.$chart.trigger(dropEvent, { 'draggedNode': $dragged, 'dragZone': $dragZone, 'dropZone': $dropZone });\n if (dropEvent.isDefaultPrevented()) {\n return;\n }\n // firstly, deal with the hierarchy of drop zone\n if (!$dropZone.siblings('.nodes').length) { // if the drop zone is a leaf node\n $dropZone.append('<i class=\"edge verticalEdge bottomEdge oci\"></i>')\n .after('<ul class=\"nodes\"></ul>')\n .siblings('.nodes').append($dragged.find('.horizontalEdge').remove().end().closest('.hierarchy'));\n if ($dropZone.children('.title').length) {\n $dropZone.children('.title').prepend('<i class=\"oci '+ this.$chart.data('options').parentNodeSymbol + ' symbol\"></i>');\n }\n } else {\n var horizontalEdges = '<i class=\"edge horizontalEdge rightEdge oci\"></i><i class=\"edge horizontalEdge leftEdge oci\"></i>';\n if (!$dragged.find('.horizontalEdge').length) {\n $dragged.append(horizontalEdges);\n }\n $dropZone.siblings('.nodes').append($dragged.closest('.hierarchy'));\n var $dropSibs = $dragged.closest('.hierarchy').siblings().find('.node:first');\n if ($dropSibs.length === 1) {\n $dropSibs.append(horizontalEdges);\n }\n }\n // secondly, deal with the hierarchy of dragged node\n if ($dragZone.siblings('.nodes').children('.hierarchy').length === 1) { // if there is only one sibling node left\n $dragZone.siblings('.nodes').children('.hierarchy').find('.node:first')\n .find('.horizontalEdge').remove();\n } else if ($dragZone.siblings('.nodes').children('.hierarchy').length === 0) {\n $dragZone.find('.bottomEdge, .symbol').remove()\n .end().siblings('.nodes').remove();\n }\n },\n //\n touchstartHandler: function (event) {\n if (this.touchHandled)\n return;\n\n if (event.touches && event.touches.length > 1)\n return;\n\n this.touchHandled = true;\n this.touchMoved = false; // this is so we can work out later if this was a 'press' or a 'drag' touch\n event.preventDefault();\n },\n //\n touchmoveHandler: function (event) {\n if (!this.touchHandled)\n return;\n\n if (event.touches && event.touches.length > 1)\n return;\n\n event.preventDefault();\n\n if (!this.touchMoved) {\n // we do not bother with createGhostNode (dragstart does) since the touch event does not have a dataTransfer property\n this.filterAllowedDropNodes($(event.currentTarget)); // will also set 'this.$chart.data('dragged')' for us\n // create an image which can be used to illustrate the drag (our own createGhostNode)\n this.touchDragImage = this.createDragImage(event, this.$chart.data('dragged')[0]);\n }\n this.touchMoved = true;\n\n // move our dragimage so it follows our finger\n this.moveDragImage(event, this.touchDragImage);\n\n var $touching = $(document.elementFromPoint(event.touches[0].clientX, event.touches[0].clientY));\n var $touchingNodes = $touching.closest('div.node');\n if ($touchingNodes.length > 0) {\n var touchingNodeElement = $touchingNodes[0];\n if ($touchingNodes.is('.allowedDrop')) {\n this.touchTargetNode = touchingNodeElement;\n }\n else {\n this.touchTargetNode = null;\n }\n }\n else {\n this.touchTargetNode = null;\n }\n },\n //\n touchendHandler: function (event) {\n if (!this.touchHandled) {\n return;\n }\n this.destroyDragImage();\n if (this.touchMoved) {\n // we've had movement, so this was a 'drag' touch\n if (this.touchTargetNode) {\n var fakeEventForDropHandler = { delegateTarget: this.touchTargetNode };\n this.dropHandler(fakeEventForDropHandler);\n this.touchTargetNode = null;\n }\n this.dragendHandler(event);\n }\n else {\n // we did not move, so this was a 'press' touch (fake a click)\n var firstTouch = event.changedTouches[0];\n var fakeMouseClickEvent = document.createEvent('MouseEvents');\n fakeMouseClickEvent.initMouseEvent('click', true, true, window, 1, firstTouch.screenX, firstTouch.screenY, firstTouch.clientX, firstTouch.clientY, event.ctrlKey, event.altKey, event.shiftKey, event.metaKey, 0, null);\n event.target.dispatchEvent(fakeMouseClickEvent);\n }\n this.touchHandled = false;\n },\n //\n createDragImage: function (event, source) {\n var dragImage = source.cloneNode(true);\n this.copyStyle(source, dragImage);\n dragImage.style.top = dragImage.style.left = '-9999px';\n var sourceRectangle = source.getBoundingClientRect();\n var sourcePoint = this.getTouchPoint(event);\n this.touchDragImageOffset = { x: sourcePoint.x - sourceRectangle.left, y: sourcePoint.y - sourceRectangle.top };\n dragImage.style.opacity = '0.5';\n document.body.appendChild(dragImage);\n return dragImage;\n },\n //\n destroyDragImage: function () {\n if (this.touchDragImage && this.touchDragImage.parentElement)\n this.touchDragImage.parentElement.removeChild(this.touchDragImage);\n this.touchDragImageOffset = null;\n this.touchDragImage = null;\n },\n //\n copyStyle: function (src, dst) {\n // remove potentially troublesome attributes\n var badAttributes = ['id', 'class', 'style', 'draggable'];\n badAttributes.forEach(function (att) {\n dst.removeAttribute(att);\n });\n // copy canvas content\n if (src instanceof HTMLCanvasElement) {\n var cSrc = src, cDst = dst;\n cDst.width = cSrc.width;\n cDst.height = cSrc.height;\n cDst.getContext('2d').drawImage(cSrc, 0, 0);\n }\n // copy style (without transitions)\n var cs = getComputedStyle(src);\n for (var i = 0; i < cs.length; i++) {\n var key = cs[i];\n if (key.indexOf('transition') < 0) {\n dst.style[key] = cs[key];\n }\n }\n dst.style.pointerEvents = 'none';\n // and repeat for all children\n for (var i = 0; i < src.children.length; i++) {\n this.copyStyle(src.children[i], dst.children[i]);\n }\n },\n //\n getTouchPoint: function (event) {\n if (event && event.touches) {\n event = event.touches[0];\n }\n return {\n x: event.clientX,\n y: event.clientY\n };\n },\n //\n moveDragImage: function (event, image) {\n if (!event || !image)\n return;\n var orgChartMaster = this;\n requestAnimationFrame(function () {\n var pt = orgChartMaster.getTouchPoint(event);\n var s = image.style;\n s.position = 'absolute';\n s.pointerEvents = 'none';\n s.zIndex = '999999';\n if (orgChartMaster.touchDragImageOffset) {\n s.left = Math.round(pt.x - orgChartMaster.touchDragImageOffset.x) + 'px';\n s.top = Math.round(pt.y - orgChartMaster.touchDragImageOffset.y) + 'px';\n }\n });\n },\n //\n bindDragDrop: function ($node) {\n $node.on('dragstart', this.dragstartHandler.bind(this))\n .on('dragover', this.dragoverHandler.bind(this))\n .on('dragend', this.dragendHandler.bind(this))\n .on('drop', this.dropHandler.bind(this))\n .on('touchstart', this.touchstartHandler.bind(this))\n .on('touchmove', this.touchmoveHandler.bind(this))\n .on('touchend', this.touchendHandler.bind(this));\n },\n // create node\n createNode: function (data) {\n var that = this;\n var opts = this.options;\n var level = data.level;\n if (data.children && data[opts.nodeId]) {\n $.each(data.children, function (index, child) {\n child.parentId = data[opts.nodeId]\n });\n }\n // construct the content of node\n var $nodeDiv = $('<div' + (opts.draggable ? ' draggable=\"true\"' : '') + (data[opts.nodeId] ? ' id=\"' + data[opts.nodeId] + '\"' : '') + (data.parentId ? ' data-parent=\"' + data.parentId + '\"' : '') + '>')\n .addClass('node ' + (data.className || '') + (level > opts.visibleLevel ? ' slide-up' : ''));\n if (opts.nodeTemplate) {\n $nodeDiv.append(opts.nodeTemplate(data));\n } else {\n $nodeDiv.append('<div class=\"title\">' + data[opts.nodeTitle] + '</div>')\n .append(typeof opts.nodeContent !== 'undefined' ? '<div class=\"content\">' + (data[opts.nodeContent] || '') + '</div>' : '');\n }\n //\n var nodeData = $.extend({}, data);\n delete nodeData.children;\n $nodeDiv.data('nodeData', nodeData);\n // append 4 direction arrows or expand/collapse buttons\n var flags = data.relationship || '';\n if (opts.verticalLevel && level >= opts.verticalLevel) {\n if ((level + 1) > opts.verticalLevel && Number(flags.substr(2,1))) {\n $nodeDiv.append('<i class=\"toggleBtn oci\"></i>')\n .children('.title').prepend('<i class=\"oci '+ opts.parentNodeSymbol + ' symbol\"></i>');\n }\n } else {\n if (Number(flags.substr(0,1))) {\n $nodeDiv.append('<i class=\"edge verticalEdge topEdge oci\"></i>');\n }\n if(Number(flags.substr(1,1))) {\n $nodeDiv.append('<i class=\"edge horizontalEdge rightEdge oci\"></i>' +\n '<i class=\"edge horizontalEdge leftEdge oci\"></i>');\n }\n if(Number(flags.substr(2,1))) {\n $nodeDiv.append('<i class=\"edge verticalEdge bottomEdge oci\"></i>')\n .children('.title').prepend('<i class=\"oci '+ opts.parentNodeSymbol + ' symbol\"></i>');\n }\n }\n\n $nodeDiv.on('mouseenter mouseleave', this.nodeEnterLeaveHandler.bind(this));\n $nodeDiv.on('click', this.nodeClickHandler.bind(this));\n $nodeDiv.on('click', '.topEdge', this.topEdgeClickHandler.bind(this));\n $nodeDiv.on('click', '.bottomEdge', this.bottomEdgeClickHandler.bind(this));\n $nodeDiv.on('click', '.leftEdge, .rightEdge', this.hEdgeClickHandler.bind(this));\n $nodeDiv.on('click', '.toggleBtn', this.toggleVNodes.bind(this));\n\n if (opts.draggable) {\n this.bindDragDrop($nodeDiv);\n this.touchHandled = false;\n this.touchMoved = false;\n this.touchTargetNode = null;\n }\n // allow user to append dom modification after finishing node create of orgchart\n if (opts.createNode) {\n opts.createNode($nodeDiv, data);\n }\n\n return $nodeDiv;\n },\n // recursively build the tree\n buildHierarchy: function ($appendTo, data) {\n var that = this;\n var opts = this.options;\n var level = 0;\n if (data.level) {\n level = data.level;\n } else {\n level = data.level = $appendTo.parentsUntil('.orgchart', '.nodes').length;\n }\n // Construct the node\n if (Object.keys(data).length > 2) {\n var $nodeDiv = this.createNode(data);\n if (opts.verticalLevel && level >= opts.verticalLevel) {\n $appendTo.append($nodeDiv);\n } else {\n $appendTo.append($nodeDiv);\n }\n }\n // Construct the \"inferior nodes\"\n if (data.children && data.children.length) {\n var isHidden = level + 1 > opts.visibleLevel || (data.collapsed !== undefined && data.collapsed);\n var isVerticalLayer = opts.verticalLevel && (level + 1) >= opts.verticalLevel;\n var $nodesLayer;\n if (isVerticalLayer) {\n $nodesLayer = $('<ul class=\"nodes\">');\n if (isHidden && level + 1 >= opts.verticalLevel) {\n $nodesLayer.addClass('hidden');\n }\n if (level + 1 === opts.verticalLevel) {\n $appendTo.addClass('hybrid').append($nodesLayer.addClass('vertical'));\n } else {\n $appendTo.append($nodesLayer);\n }\n } else {\n $nodesLayer = $('<ul class=\"nodes' + (isHidden ? ' hidden' : '') + '\">');\n if (Object.keys(data).length === 2) {\n $appendTo.append($nodesLayer);\n } else {\n if (isHidden) {\n $appendTo.addClass('isChildrenCollapsed');\n }\n $appendTo.append($nodesLayer);\n }\n }\n // recurse through children nodes\n $.each(data.children, function () {\n var $nodeCell = $('<li class=\"hierarchy\">');\n $nodesLayer.append($nodeCell);\n this.level = level + 1;\n that.buildHierarchy($nodeCell, this);\n });\n }\n },\n // build the child nodes of specific node\n buildChildNode: function ($appendTo, data) {\n this.buildHierarchy($appendTo, { 'children': data });\n },\n // exposed method\n addChildren: function ($node, data) {\n this.buildChildNode($node.closest('.hierarchy'), data);\n if (!$node.find('.symbol').length) {\n $node.children('.title').prepend('<i class=\"oci '+ this.options.parentNodeSymbol + ' symbol\"></i>');\n }\n if ($node.closest('.nodes.vertical').length) {\n if (!$node.children('.toggleBtn').length) {\n $node.append('<i class=\"toggleBtn oci\"></i>');\n }\n } else {\n if (!$node.children('.bottomEdge').length) {\n $node.append('<i class=\"edge verticalEdge bottomEdge oci\"></i>');\n }\n }\n if (this.isInAction($node)) {\n this.switchVerticalArrow($node.children('.bottomEdge'));\n }\n },\n // build the parent node of specific node\n buildParentNode: function ($currentRoot, data) {\n data.relationship = data.relationship || '001';\n var $newRootWrapper = $('<ul class=\"nodes\"><li class=\"hierarchy\"></li></ul>')\n .find('.hierarchy').append(this.createNode(data)).end();\n this.$chart.prepend($newRootWrapper)\n .find('.hierarchy:first').append($currentRoot.closest('ul').addClass('nodes'));\n },\n // exposed method\n addParent: function ($currentRoot, data) {\n this.buildParentNode($currentRoot, data);\n if (!$currentRoot.children('.topEdge').length) {\n $currentRoot.children('.title').after('<i class=\"edge verticalEdge topEdge oci\"></i>');\n }\n if (this.isInAction($currentRoot)) {\n this.switchVerticalArrow($currentRoot.children('.topEdge'));\n }\n },\n // build the sibling nodes of specific node\n buildSiblingNode: function ($nodeChart, data) {\n var newSiblingCount = $.isArray(data) ? data.length : data.children.length;\n var existingSibligCount = $nodeChart.parent().is('.nodes') ? $nodeChart.siblings().length + 1 : 1;\n var siblingCount = existingSibligCount + newSiblingCount;\n var insertPostion = (siblingCount > 1) ? Math.floor(siblingCount/2 - 1) : 0;\n // just build the sibling nodes for the specific node\n if ($nodeChart.closest('.nodes').parent().is('.hierarchy')) {\n this.buildChildNode($nodeChart.parent().closest('.hierarchy'), data);\n var $siblings = $nodeChart.parent().closest('.hierarchy').children('.nodes:last').children('.hierarchy');\n if (existingSibligCount > 1) {\n $siblings.eq(0).before($nodeChart.siblings().addBack().unwrap());\n } else {\n $siblings.eq(insertPostion).after($nodeChart.unwrap());\n }\n } else { // build the sibling nodes and parent node for the specific ndoe\n this.buildHierarchy($nodeChart.parent().prepend($('<li class=\"hierarchy\">')).children('.hierarchy:first'), data);\n $nodeChart.prevAll('.hierarchy').children('.nodes').children().eq(insertPostion).after($nodeChart);\n }\n },\n //\n addSiblings: function ($node, data) {\n this.buildSiblingNode($node.closest('.hierarchy'), data);\n $node.closest('.nodes').data('siblingsLoaded', true);\n if (!$node.children('.leftEdge').length) {\n $node.children('.topEdge').after('<i class=\"edge horizontalEdge rightEdge oci\"></i><i class=\"edge horizontalEdge leftEdge oci\"></i>');\n }\n if (this.isInAction($node)) {\n this.switchHorizontalArrow($node);\n $node.children('.topEdge').removeClass('oci-chevron-up').addClass('oci-chevron-down');\n }\n },\n // remove node and its descendent nodes\n removeNodes: function ($node) {\n var $wrapper = $node.closest('.hierarchy').parent();\n if ($wrapper.parent().is('.hierarchy')) {\n if (this.getNodeState($node, 'siblings').exist) {\n $node.closest('.hierarchy').remove();\n if ($wrapper.children().length === 1) {\n $wrapper.find('.node:first .horizontalEdge').remove();\n }\n } else {\n $wrapper.siblings('.node').find('.bottomEdge').remove()\n .end().end().remove();\n }\n } else { // if $node is root node\n $wrapper.closest('.orgchart').remove();\n }\n },\n //\n hideDropZones: function () {\n // Remove all the 'this is a drop zone' indicators\n var orgChartObj = this;\n orgChartObj.$chart.find('.allowedDrop')\n .removeClass('allowedDrop');\n },\n //\n showDropZones: function (dragged) {\n // Highlight all the 'drop zones', and set dragged, so that the drop/enter can work out what happens later\n // TODO: This assumes all nodes are droppable: it doesn't run the custom isDroppable function - it should!\n var orgChartObj = this;\n orgChartObj.$chart.find('.node')\n .each(function (index, node) {\n $(node).addClass('allowedDrop');\n });\n orgChartObj.$chart.data('dragged', $(dragged));\n },\n //\n processExternalDrop: function (dropZone, dragged) {\n // Allow an external drop event to be handled by one of our nodes\n if (dragged) {\n this.$chart.data('dragged', $(dragged));\n }\n var droppedOnNode = dropZone.closest('.node');\n // would like to just call 'dropZoneHandler', but I can't reach it from here\n // instead raise a drop event on the node element\n droppedOnNode.triggerHandler({ 'type': 'drop' });\n },\n //\n exportPDF: function(canvas, exportFilename){\n var doc = {};\n var docWidth = Math.floor(canvas.width);\n var docHeight = Math.floor(canvas.height);\n if (!window.jsPDF) {\n window.jsPDF = window.jspdf.jsPDF;\n }\n\n if (docWidth > docHeight) {\n doc = new jsPDF({\n orientation: 'landscape',\n unit: 'px',\n format: [docWidth, docHeight]\n });\n } else {\n doc = new jsPDF({\n orientation: 'portrait',\n unit: 'px',\n format: [docHeight, docWidth]\n });\n }\n doc.addImage(canvas.toDataURL(), 'png', 0, 0);\n doc.save(exportFilename + '.pdf');\n },\n //\n exportPNG: function(canvas, exportFilename){\n var that = this;\n var isWebkit = 'WebkitAppearance' in document.documentElement.style;\n var isFf = !!window.sidebar;\n var isEdge = navigator.appName === 'Microsoft Internet Explorer' || (navigator.appName === \"Netscape\" && navigator.appVersion.indexOf('Edge') > -1);\n var $chartContainer = this.$chartContainer;\n\n if ((!isWebkit && !isFf) || isEdge) {\n window.navigator.msSaveBlob(canvas.msToBlob(), exportFilename + '.png');\n } else {\n var selector = '.oci-download-btn' + (that.options.chartClass !== '' ? '.' + that.options.chartClass : '');\n\n if (!$chartContainer.find(selector).length) {\n $chartContainer.append('<a class=\"oci-download-btn' + (that.options.chartClass !== '' ? ' ' + that.options.chartClass : '') + '\"'\n + ' download=\"' + exportFilename + '.png\"></a>');\n }\n\n $chartContainer.find(selector).attr('href', canvas.toDataURL())[0].click();\n }\n },\n //\n export: function (exportFilename, exportFileextension) {\n var that = this;\n exportFilename = (typeof exportFilename !== 'undefined') ? exportFilename : this.options.exportFilename;\n exportFileextension = (typeof exportFileextension !== 'undefined') ? exportFileextension : this.options.exportFileextension;\n if ($(this).children('.spinner').length) {\n return false;\n }\n var $chartContainer = this.$chartContainer;\n var $mask = $chartContainer.find('.mask');\n if (!$mask.length) {\n $chartContainer.append('<div class=\"mask\"><i class=\"oci oci-spinner spinner\"></i></div>');\n } else {\n $mask.removeClass('hidden');\n }\n var sourceChart = $chartContainer.addClass('canvasContainer').find('.orgchart:not(\".hidden\")').get(0);\n var flag = that.options.direction === 'l2r' || that.options.direction === 'r2l';\n html2canvas(sourceChart, {\n 'width': flag ? sourceChart.clientHeight : sourceChart.clientWidth,\n 'height': flag ? sourceChart.clientWidth : sourceChart.clientHeight,\n 'onclone': function (cloneDoc) {\n $(cloneDoc).find('.canvasContainer').css('overflow', 'visible')\n .find('.orgchart:not(\".hidden\"):first').css('transform', '');\n }\n })\n .then(function (canvas) {\n $chartContainer.find('.mask').addClass('hidden');\n\n if (exportFileextension.toLowerCase() === 'pdf') {\n that.exportPDF(canvas, exportFilename);\n } else {\n that.exportPNG(canvas, exportFilename);\n }\n\n $chartContainer.removeClass('canvasContainer');\n }, function () {\n $chartContainer.removeClass('canvasContainer');\n });\n }\n };\n\n $.fn.orgchart = function (opts) {\n return new OrgChart(this, opts).init();\n };\n\n}));\n"]}
|
|
1
|
+
{"version":3,"sources":["jquery.orgchart.js"],"names":["factory","module","exports","require","window","document","jQuery","$","undefined","OrgChart","elem","opts","this","$chartContainer","defaultOptions","nodeTitle","nodeId","toggleSiblingsResp","visibleLevel","chartClass","exportButton","exportButtonName","exportFilename","exportFileextension","parentNodeSymbol","draggable","direction","pan","zoom","zoominLimit","zoomoutLimit","prototype","init","that","options","extend","$chart","remove","data","class","click","event","target","closest","length","find","removeClass","MutationObserver","triggerInitEvent","$root","append","type","buildHierarchy","buildJsonDS","children","ajaxURL","attachRel","ajax","url","dataType","done","textStatus","jqXHR","fail","errorThrown","console","log","always","attachExportButton","bindPan","bindZoom","mo","mutations","disconnect","initTime","i","j","addedNodes","classList","contains","initCompleted","initEvent","Event","trigger","observe","childList","triggerLoadEvent","$target","rel","triggerShowEvent","triggerHideEvent","$exportBtn","text","e","preventDefault","export","after","setOptions","val","unbindPan","unbindZoom","panStartHandler","delegateTarget","touches","css","lastX","lastY","lastTf","temp","split","indexOf","parseInt","startX","startY","targetTouches","pageX","pageY","on","newX","newY","matrix","join","panEndHandler","chart","off","zoomWheelHandler","oc","newScale","originalEvent","deltaY","setChartScale","zoomStartHandler","dist","getPinchDist","zoomingHandler","zoomEndHandler","diff","Math","sqrt","clientX","clientY","targetScale","abs","parseFloat","$li","subObj","name","contents","eq","trim","relationship","parent","is","siblings","each","key","value","push","flags","forEach","item","loopChart","includeNodeData","$node","id","getHierarchy","valid","getNodeState","relation","isVerticalNode","parents","exist","visible","getParent","getRelatedNodes","getChildren","getSiblings","hideParentEnd","addClass","hideParent","$parent","hideSiblings","one","showParentEnd","node","isInAction","switchVerticalArrow","showParent","repaint","bind","stopAjax","$nodeLevel","isVisibleNode","index","hideChildrenEnd","animatedNodes","hideChildren","$lowerLevel","$animatedNodes","filter","get","lowerLevel","showChildrenEnd","showChildren","$levels","isVerticalDesc","hideSiblingsEnd","$nodeContainer","nodeContainer","$siblings","prevAll","nextAll","end","switchHorizontalArrow","showSiblingsEnd","visibleNodes","showRelatedParentEnd","showSiblings","$upperLevel","$visibleNodes","startLoading","$edge","not","prop","endLoading","removeAttr","attr","$arrow","toggleClass","$prevSib","prev","$nextSib","next","$sibs","sibsVisible","style","offsetWidth","nodeEnterLeaveHandler","flag","$toggleBtn","$topEdge","$bottomEdge","$leftEdge","nodeClickHandler","loadNodes","isEmptyObject","addParent","addChildren","addSiblings","HideFirstParentEnd","topEdge","topEdgeClickHandler","stopPropagation","parentState","isFunction","bottomEdgeClickHandler","childrenState","hEdgeClickHandler","$hEdge","siblingsState","families","expandVNodesEnd","vNodes","collapseVNodesEnd","toggleVNodes","$descWrapper","$descendants","$children","createGhostNode","ghostNode","nodeCover","$nodeDiv","origEvent","isFirefox","test","navigator","userAgent","toLowerCase","querySelector","createElementNS","add","appendChild","transValues","isHorizontal","scale","slice","setAttribute","outerWidth","outerHeight","xOffset","offsetX","yOffset","offsetY","ghostNodeWrapper","createElement","src","XMLSerializer","serializeToString","dataTransfer","setDragImage","filterAllowedDropNodes","$dragged","draggingNode","hasClass","$dragZone","$dragHier","dropCriteria","dragstartHandler","setData","dragoverHandler","dropEffect","dragendHandler","dropHandler","$dropZone","dropEvent","draggedNode","dragZone","dropZone","isDefaultPrevented","horizontalEdges","$dropSibs","prepend","triggerHandler","draggedItem","touchstartHandler","touchHandled","touchMoved","touchmoveHandler","currentTarget","touchDragImage","createDragImage","moveDragImage","$touchingNodes","elementFromPoint","touchingNodeElement","touchTargetNode","touchendHandler","destroyDragImage","fakeEventForDropHandler","firstTouch","changedTouches","fakeMouseClickEvent","createEvent","initMouseEvent","screenX","screenY","ctrlKey","altKey","shiftKey","metaKey","dispatchEvent","source","dragImage","cloneNode","copyStyle","top","left","sourceRectangle","getBoundingClientRect","sourcePoint","getTouchPoint","touchDragImageOffset","x","y","opacity","body","parentElement","removeChild","dst","att","removeAttribute","HTMLCanvasElement","cSrc","cDst","width","height","getContext","drawImage","cs","getComputedStyle","pointerEvents","image","orgChartMaster","requestAnimationFrame","pt","s","position","zIndex","round","bindDragDrop","createNode","level","child","parentId","className","nodeTemplate","nodeContent","nodeData","verticalLevel","Number","substr","$appendTo","parentsUntil","Object","keys","$nodesLayer","isHidden","collapsed","$nodeCell","buildChildNode","buildParentNode","$currentRoot","$newRootWrapper","buildSiblingNode","$nodeChart","newSiblingCount","isArray","existingSibligCount","siblingCount","insertPostion","floor","before","addBack","unwrap","removeNodes","$wrapper","hideDropZones","showDropZones","dragged","processExternalDrop","exportPDF","canvas","doc","docWidth","docHeight","jsPDF","jspdf","orientation","unit","format","addImage","toDataURL","save","exportPNG","isWebkit","documentElement","isFf","sidebar","isEdge","appName","appVersion","msSaveBlob","msToBlob","selector","$mask","sourceChart","html2canvas","clientHeight","clientWidth","onclone","cloneDoc","then","fn","orgchart"],"mappings":"AAUA,cAEC,SAAUA,GACa,iBAAXC,QAAiD,iBAAnBA,OAAOC,QAC9CF,EAAQG,QAAQ,UAAWC,OAAQC,UAEnCL,EAAQM,OAAQF,OAAQC,UAJ5B,CAME,SAAUE,EAAGH,EAAQC,EAAUG,GAChB,SAAXC,EAAqBC,EAAMC,GAC7BC,KAAKC,gBAAkBN,EAAEG,GACzBE,KAAKD,KAAOA,EACZC,KAAKE,eAAiB,CACpBC,UAAa,OACbC,OAAU,KACVC,oBAAsB,EACtBC,aAAgB,IAChBC,WAAc,GACdC,cAAgB,EAChBC,iBAAoB,SACpBC,eAAkB,WAClBC,oBAAuB,MACvBC,iBAAoB,aACpBC,WAAa,EACbC,UAAa,MACbC,KAAO,EACPC,MAAQ,EACRC,YAAe,EACfC,aAAgB,IAIpBrB,EAASsB,UAAY,CAEnBC,KAAM,SAAUrB,GACd,IAAIsB,EAAOrB,KACXA,KAAKsB,QAAU3B,EAAE4B,OAAO,GAAIvB,KAAKE,eAAgBF,KAAKD,KAAMA,GAE5D,IAAIE,EAAkBD,KAAKC,gBACvBD,KAAKwB,QACPxB,KAAKwB,OAAOC,SAEd,IAAIC,EAAO1B,KAAKsB,QAAQI,KACpBF,EAASxB,KAAKwB,OAAS7B,EAAE,QAAS,CACpC+B,KAAQ,CAAEJ,QAAWtB,KAAKsB,SAC1BK,MAAS,YAA0C,KAA5B3B,KAAKsB,QAAQf,WAAoB,IAAMP,KAAKsB,QAAQf,WAAa,KAAkC,QAA3BP,KAAKsB,QAAQR,UAAsB,IAAMd,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3B,WACDjC,EAAgBiC,YAAY,uBAKlCvC,EAAEuc,GAAGC,SAAW,SAAUpc,GACxB,OAAO,IAAIF,EAASG,KAAMD,GAAMqB","file":"jquery.orgchart.min.js","sourcesContent":["/*\n * jQuery OrgChart Plugin\n * https://github.com/dabeng/OrgChart\n *\n * Copyright 2016, dabeng\n * https://github.com/dabeng\n *\n * Licensed under the MIT license:\n * http://www.opensource.org/licenses/MIT\n */\n'use strict';\n\n(function (factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n factory(require('jquery'), window, document);\n } else {\n factory(jQuery, window, document);\n }\n}(function ($, window, document, undefined) {\n var OrgChart = function (elem, opts) {\n this.$chartContainer = $(elem);\n this.opts = opts;\n this.defaultOptions = {\n 'nodeTitle': 'name',\n 'nodeId': 'id',\n 'toggleSiblingsResp': false,\n 'visibleLevel': 999,\n 'chartClass': '',\n 'exportButton': false,\n 'exportButtonName': 'Export',\n 'exportFilename': 'OrgChart',\n 'exportFileextension': 'png',\n 'parentNodeSymbol': 'oci-leader',\n 'draggable': false,\n 'direction': 't2b',\n 'pan': false,\n 'zoom': false,\n 'zoominLimit': 7,\n 'zoomoutLimit': 0.5\n };\n };\n //\n OrgChart.prototype = {\n //\n init: function (opts) {\n var that = this;\n this.options = $.extend({}, this.defaultOptions, this.opts, opts);\n // build the org-chart\n var $chartContainer = this.$chartContainer;\n if (this.$chart) {\n this.$chart.remove();\n }\n var data = this.options.data;\n var $chart = this.$chart = $('<div>', {\n 'data': { 'options': this.options },\n 'class': 'orgchart' + (this.options.chartClass !== '' ? ' ' + this.options.chartClass : '') + (this.options.direction !== 't2b' ? ' ' + this.options.direction : ''),\n 'click': function(event) {\n if (!$(event.target).closest('.node').length) {\n $chart.find('.node.focused').removeClass('focused');\n }\n }\n });\n if (typeof MutationObserver !== 'undefined') {\n this.triggerInitEvent();\n }\n var $root = $chart.append($('<ul class=\"nodes\"><li class=\"hierarchy\"></li></ul>')).find('.hierarchy');\n if ($.type(data) === 'object') {\n if (data instanceof $) { // ul datasource\n this.buildHierarchy($root, this.buildJsonDS(data.children()), 0, this.options);\n } else { // local json datasource\n this.buildHierarchy($root, this.options.ajaxURL ? data : this.attachRel(data, '00'));\n }\n } else {\n $chart.append('<i class=\"oci oci-spinner spinner\"></i>');\n $.ajax({\n 'url': data,\n 'dataType': 'json'\n })\n .done(function(data, textStatus, jqXHR) {\n that.buildHierarchy($root, that.options.ajaxURL ? data : that.attachRel(data, '00'), 0, that.options);\n })\n .fail(function(jqXHR, textStatus, errorThrown) {\n console.log(errorThrown);\n })\n .always(function() {\n $chart.children('.spinner').remove();\n });\n }\n $chartContainer.append($chart);\n\n // append the export button\n if (this.options.exportButton && !$('.oc-export-btn').length) {\n this.attachExportButton();\n }\n\n if (this.options.pan) {\n this.bindPan();\n }\n\n if (this.options.zoom) {\n this.bindZoom();\n }\n\n return this;\n },\n //\n triggerInitEvent: function () {\n var that = this;\n var mo = new MutationObserver(function (mutations) {\n mo.disconnect();\n initTime:\n for (var i = 0; i < mutations.length; i++) {\n for (var j = 0; j < mutations[i].addedNodes.length; j++) {\n if (mutations[i].addedNodes[j].classList.contains('orgchart')) {\n if (that.options.initCompleted && typeof that.options.initCompleted === 'function') {\n that.options.initCompleted(that.$chart);\n }\n var initEvent = $.Event('init.orgchart');\n that.$chart.trigger(initEvent);\n break initTime;\n }\n }\n }\n });\n mo.observe(this.$chartContainer[0], { childList: true });\n },\n triggerLoadEvent: function ($target, rel) {\n var initEvent = $.Event('load-' + rel +'.orgchart');\n $target.trigger(initEvent);\n },\n triggerShowEvent: function ($target, rel) {\n var initEvent = $.Event('show-' + rel + '.orgchart');\n $target.trigger(initEvent);\n },\n triggerHideEvent: function ($target, rel) {\n var initEvent = $.Event('hide-' + rel + '.orgchart');\n $target.trigger(initEvent);\n },\n // add export button for orgchart\n attachExportButton: function () {\n var that = this;\n var $exportBtn = $('<button>', {\n 'class': 'oc-export-btn',\n 'text': this.options.exportButtonName,\n 'click': function(e) {\n e.preventDefault();\n that.export();\n }\n });\n this.$chartContainer.after($exportBtn);\n },\n setOptions: function (opts, val) {\n if (typeof opts === 'string') {\n if (opts === 'pan') {\n if (val) {\n this.bindPan();\n } else {\n this.unbindPan();\n }\n }\n if (opts === 'zoom') {\n if (val) {\n this.bindZoom();\n } else {\n this.unbindZoom();\n }\n }\n }\n if (typeof opts === 'object') {\n if (opts.data) {\n this.init(opts);\n } else {\n if (typeof opts.pan !== 'undefined') {\n if (opts.pan) {\n this.bindPan();\n } else {\n this.unbindPan();\n }\n }\n if (typeof opts.zoom !== 'undefined') {\n if (opts.zoom) {\n this.bindZoom();\n } else {\n this.unbindZoom();\n }\n }\n }\n }\n\n return this;\n },\n //\n panStartHandler: function (e) {\n var $chart = $(e.delegateTarget);\n if ($(e.target).closest('.node').length || (e.touches && e.touches.length > 1)) {\n $chart.data('panning', false);\n return;\n } else {\n $chart.css('cursor', 'move').data('panning', true);\n }\n var lastX = 0;\n var lastY = 0;\n var lastTf = $chart.css('transform');\n if (lastTf !== 'none') {\n var temp = lastTf.split(',');\n if (lastTf.indexOf('3d') === -1) {\n lastX = parseInt(temp[4]);\n lastY = parseInt(temp[5]);\n } else {\n lastX = parseInt(temp[12]);\n lastY = parseInt(temp[13]);\n }\n }\n var startX = 0;\n var startY = 0;\n if (!e.targetTouches) { // pand on desktop\n startX = e.pageX - lastX;\n startY = e.pageY - lastY;\n } else if (e.targetTouches.length === 1) { // pan on mobile device\n startX = e.targetTouches[0].pageX - lastX;\n startY = e.targetTouches[0].pageY - lastY;\n } else if (e.targetTouches.length > 1) {\n return;\n }\n $chart.on('mousemove touchmove',function(e) {\n if (!$chart.data('panning')) {\n return;\n }\n var newX = 0;\n var newY = 0;\n if (!e.targetTouches) { // pand on desktop\n newX = e.pageX - startX;\n newY = e.pageY - startY;\n } else if (e.targetTouches.length === 1) { // pan on mobile device\n newX = e.targetTouches[0].pageX - startX;\n newY = e.targetTouches[0].pageY - startY;\n } else if (e.targetTouches.length > 1) {\n return;\n }\n var lastTf = $chart.css('transform');\n if (lastTf === 'none') {\n if (lastTf.indexOf('3d') === -1) {\n $chart.css('transform', 'matrix(1, 0, 0, 1, ' + newX + ', ' + newY + ')');\n } else {\n $chart.css('transform', 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, ' + newX + ', ' + newY + ', 0, 1)');\n }\n } else {\n var matrix = lastTf.split(',');\n if (lastTf.indexOf('3d') === -1) {\n matrix[4] = ' ' + newX;\n matrix[5] = ' ' + newY + ')';\n } else {\n matrix[12] = ' ' + newX;\n matrix[13] = ' ' + newY;\n }\n $chart.css('transform', matrix.join(','));\n }\n });\n },\n //\n panEndHandler: function (e) {\n if (e.data.chart.data('panning')) {\n e.data.chart.data('panning', false).css('cursor', 'default').off('mousemove');\n }\n },\n //\n bindPan: function () {\n this.$chartContainer.css('overflow', 'hidden');\n this.$chart.on('mousedown touchstart', this.panStartHandler);\n $(document).on('mouseup touchend', { 'chart': this.$chart }, this.panEndHandler);\n },\n //\n unbindPan: function () {\n this.$chartContainer.css('overflow', 'auto');\n this.$chart.off('mousedown touchstart', this.panStartHandler);\n $(document).off('mouseup touchend', this.panEndHandler);\n },\n //\n zoomWheelHandler: function (e) {\n var oc = e.data.oc;\n e.preventDefault();\n var newScale = 1 + (e.originalEvent.deltaY > 0 ? -0.2 : 0.2);\n oc.setChartScale(oc.$chart, newScale);\n },\n //\n zoomStartHandler: function (e) {\n if(e.touches && e.touches.length === 2) {\n var oc = e.data.oc;\n oc.$chart.data('pinching', true);\n var dist = oc.getPinchDist(e);\n oc.$chart.data('pinchDistStart', dist);\n }\n },\n zoomingHandler: function (e) {\n var oc = e.data.oc;\n if(oc.$chart.data('pinching')) {\n var dist = oc.getPinchDist(e);\n oc.$chart.data('pinchDistEnd', dist);\n }\n },\n zoomEndHandler: function (e) {\n var oc = e.data.oc;\n if(oc.$chart.data('pinching')) {\n oc.$chart.data('pinching', false);\n var diff = oc.$chart.data('pinchDistEnd') - oc.$chart.data('pinchDistStart');\n if (diff > 0) {\n oc.setChartScale(oc.$chart, 1.2);\n } else if (diff < 0) {\n oc.setChartScale(oc.$chart, 0.8);\n }\n }\n },\n //\n bindZoom: function () {\n this.$chartContainer.on('wheel', { 'oc': this }, this.zoomWheelHandler);\n this.$chartContainer.on('touchstart', { 'oc': this }, this.zoomStartHandler);\n $(document).on('touchmove', { 'oc': this }, this.zoomingHandler);\n $(document).on('touchend', { 'oc': this }, this.zoomEndHandler);\n },\n unbindZoom: function () {\n this.$chartContainer.off('wheel', this.zoomWheelHandler);\n this.$chartContainer.off('touchstart', this.zoomStartHandler);\n $(document).off('touchmove', this.zoomingHandler);\n $(document).off('touchend', this.zoomEndHandler);\n },\n //\n getPinchDist: function (e) {\n return Math.sqrt((e.touches[0].clientX - e.touches[1].clientX) * (e.touches[0].clientX - e.touches[1].clientX) +\n (e.touches[0].clientY - e.touches[1].clientY) * (e.touches[0].clientY - e.touches[1].clientY));\n },\n //\n setChartScale: function ($chart, newScale) {\n var opts = $chart.data('options');\n var lastTf = $chart.css('transform');\n var matrix = '';\n var targetScale = 1;\n if (lastTf === 'none') {\n $chart.css('transform', 'scale(' + newScale + ',' + newScale + ')');\n } else {\n matrix = lastTf.split(',');\n if (lastTf.indexOf('3d') === -1) {\n targetScale = Math.abs(window.parseFloat(matrix[3]) * newScale);\n if (targetScale > opts.zoomoutLimit && targetScale < opts.zoominLimit) {\n $chart.css('transform', lastTf + ' scale(' + newScale + ',' + newScale + ')');\n }\n } else {\n targetScale = Math.abs(window.parseFloat(matrix[1]) * newScale);\n if (targetScale > opts.zoomoutLimit && targetScale < opts.zoominLimit) {\n $chart.css('transform', lastTf + ' scale3d(' + newScale + ',' + newScale + ', 1)');\n }\n }\n }\n },\n //\n buildJsonDS: function ($li) {\n var that = this;\n var subObj = {\n 'name': $li.contents().eq(0).text().trim(),\n 'relationship': ($li.parent().parent().is('li') ? '1': '0') + ($li.siblings('li').length ? 1: 0) + ($li.children('ul').length ? 1 : 0)\n };\n $.each($li.data(), function(key, value) {\n subObj[key] = value;\n });\n $li.children('ul').children().each(function() {\n if (!subObj.children) { subObj.children = []; }\n subObj.children.push(that.buildJsonDS($(this)));\n });\n return subObj;\n },\n //\n attachRel: function (data, flags) {\n var that = this;\n data.relationship = flags + (data.children && data.children.length > 0 ? 1 : 0);\n if (data.children) {\n data.children.forEach(function(item) {\n that.attachRel(item, '1' + (data.children.length > 1 ? 1 : 0));\n });\n }\n return data;\n },\n //\n loopChart: function ($chart, includeNodeData) {\n includeNodeData = (includeNodeData !== null && includeNodeData !== undefined) ? includeNodeData : false;\n var that = this;\n var $node = $chart.find('.node:first');\n var subObj = { 'id': $node[0].id };\n if (includeNodeData) {\n $.each($node.data('nodeData'), function (key, value) {\n subObj[key] = value;\n });\n }\n $node.siblings('.nodes').children().each(function() {\n if (!subObj.children) { subObj.children = []; }\n subObj.children.push(that.loopChart($(this), includeNodeData));\n });\n return subObj;\n },\n //\n getHierarchy: function (includeNodeData) {\n includeNodeData = (includeNodeData !== null && includeNodeData !== undefined) ? includeNodeData : false;\n if (typeof this.$chart === 'undefined') {\n return 'Error: orgchart does not exist'\n } else {\n if (!this.$chart.find('.node').length) {\n return 'Error: nodes do not exist'\n } else {\n var valid = true;\n this.$chart.find('.node').each(function () {\n if (!this.id) {\n valid = false;\n return false;\n }\n });\n if (!valid) {\n return 'Error: All nodes of orghcart to be exported must have data-id attribute!';\n }\n }\n }\n return this.loopChart(this.$chart, includeNodeData);\n },\n // detect the exist/display state of related node\n getNodeState: function ($node, relation) {\n var $target = {};\n var isVerticalNode = !!$node.closest('vertical').length;\n var relation = relation || 'self';\n if (relation === 'parent') {\n if (isVerticalNode) {\n $target = $node.closest('ul').parents('ul');\n if (!$target.length) {\n $target = $node.closest('.nodes');\n if (!$target.length) {\n $target = $node.closest('.vertical').siblings(':first');\n }\n }\n } else {\n $target = $node.closest('.nodes').siblings('.node');\n }\n if ($target.length) {\n if ($target.is('.hidden') || (!$target.is('.hidden') && $target.closest('.nodes').is('.hidden')) || (!$target.is('.hidden') && $target.closest('.vertical').is('.hidden'))) {\n return { 'exist': true, 'visible': false };\n }\n return { 'exist': true, 'visible': true };\n }\n } else if (relation === 'children') {\n $target = isVerticalNode ? $node.parent().children('ul') : $node.siblings('.nodes');\n if ($target.length) {\n if (!$target.is('.hidden')) {\n return { 'exist': true, 'visible': true };\n }\n return { 'exist': true, 'visible': false };\n }\n } else if (relation === 'siblings') {\n $target = isVerticalNode ? $node.closest('ul') : $node.parent().siblings();\n if ($target.length && (!isVerticalNode || $target.children('li').length > 1)) {\n if (!$target.is('.hidden') && !$target.parent().is('.hidden') && (!isVerticalNode || !$target.closest('.vertical').is('.hidden'))) {\n return { 'exist': true, 'visible': true };\n }\n return { 'exist': true, 'visible': false };\n }\n } else {\n $target = $node;\n if ($target.length) {\n if (!(($target.closest('.nodes').length && $target.closest('.nodes').is('.hidden')) ||\n ($target.closest('.hierarchy').length && $target.closest('.hierarchy').is('.hidden')) ||\n ($target.closest('.vertical').length && ($target.closest('.nodes').is('.hidden') || $target.closest('.vertical').is('.hidden')))\n )) {\n return { 'exist': true, 'visible': true };\n }\n return { 'exist': true, 'visible': false };\n }\n }\n return { 'exist': false, 'visible': false };\n },\n getParent: function ($node) {\n return this.getRelatedNodes($node, 'parent');\n },\n getChildren: function ($node) {\n return this.getRelatedNodes($node, 'children');\n },\n getSiblings: function ($node) {\n return this.getRelatedNodes($node, 'siblings');\n },\n // find the related nodes\n getRelatedNodes: function ($node, relation) {\n if (!$node || !($node instanceof $) || !$node.is('.node')) {\n return $();\n }\n if (relation === 'parent') {\n return $node.closest('.nodes').siblings('.node');\n } else if (relation === 'children') {\n return $node.siblings('.nodes').children('.hierarchy').find('.node:first');\n } else if (relation === 'siblings') {\n return $node.closest('.hierarchy').siblings().find('.node:first');\n } else {\n return $();\n }\n },\n hideParentEnd: function (event) {\n $(event.target).removeClass('sliding');\n event.data.parent.addClass('hidden');\n },\n // recursively hide the ancestor node and sibling nodes of the specified node\n hideParent: function ($node) {\n var $parent = $node.closest('.nodes').siblings('.node');\n if ($parent.find('.spinner').length) {\n $node.closest('.orgchart').data('inAjax', false);\n }\n // hide the sibling nodes\n if (this.getNodeState($node, 'siblings').visible) {\n this.hideSiblings($node);\n }\n // hide the lines\n $node.parent().addClass('isAncestorsCollapsed');\n // hide the superior nodes with transition\n if (this.getNodeState($parent).visible) {\n $parent.addClass('sliding slide-down').one('transitionend', { 'parent': $parent }, this.hideParentEnd);\n }\n // if the current node has the parent node, hide it recursively\n if (this.getNodeState($parent, 'parent').visible) {\n this.hideParent($parent);\n }\n },\n showParentEnd: function (event) {\n var $node = event.data.node;\n $(event.target).removeClass('sliding');\n if (this.isInAction($node)) {\n this.switchVerticalArrow($node.children('.topEdge'));\n }\n },\n // show the parent node of the specified node\n showParent: function ($node) {\n // just show only one superior level\n var $parent = $node.closest('.nodes').siblings('.node').removeClass('hidden');\n // just show only one line\n $node.closest('.hierarchy').removeClass('isAncestorsCollapsed');\n // show parent node with animation\n this.repaint($parent[0]);\n $parent.addClass('sliding').removeClass('slide-down').one('transitionend', { 'node': $node }, this.showParentEnd.bind(this));\n },\n stopAjax: function ($nodeLevel) {\n if ($nodeLevel.find('.spinner').length) {\n $nodeLevel.closest('.orgchart').data('inAjax', false);\n }\n },\n isVisibleNode: function (index, elem) {\n return this.getNodeState($(elem)).visible;\n },\n // do some necessary cleanup tasks when hide animation is finished\n hideChildrenEnd: function (event) {\n var $node = event.data.node;\n event.data.animatedNodes.removeClass('sliding');\n event.data.animatedNodes.closest('.nodes').addClass('hidden');\n if (this.isInAction($node)) {\n this.switchVerticalArrow($node.children('.bottomEdge'));\n }\n },\n // recursively hide the descendant nodes of the specified node\n hideChildren: function ($node) {\n $node.closest('.hierarchy').addClass('isChildrenCollapsed');\n var $lowerLevel = $node.siblings('.nodes');\n this.stopAjax($lowerLevel);\n var $animatedNodes = $lowerLevel.find('.node').filter(this.isVisibleNode.bind(this));\n var isVerticalDesc = $lowerLevel.is('.vertical');\n if (!isVerticalDesc) {\n $animatedNodes.closest('.hierarchy').addClass('isCollapsedDescendant');\n }\n if ($lowerLevel.is('.vertical') || $lowerLevel.find('.vertical').length) {\n $animatedNodes.find('.oci-minus-square').removeClass('oci-minus-square').addClass('oci-plus-square');\n }\n this.repaint($animatedNodes.get(0));\n $animatedNodes.addClass('sliding slide-up').eq(0).one('transitionend', { 'animatedNodes': $animatedNodes, 'lowerLevel': $lowerLevel, 'node': $node }, this.hideChildrenEnd.bind(this));\n },\n //\n showChildrenEnd: function (event) {\n var $node = event.data.node;\n event.data.animatedNodes.removeClass('sliding');\n if (this.isInAction($node)) {\n this.switchVerticalArrow($node.children('.bottomEdge'));\n }\n },\n // show the children nodes of the specified node\n showChildren: function ($node) {\n var that = this;\n $node.closest('.hierarchy').removeClass('isChildrenCollapsed');\n var $levels = $node.siblings('.nodes');\n var isVerticalDesc = $levels.is('.vertical');\n var $animatedNodes = isVerticalDesc\n ? $levels.removeClass('hidden').find('.node').filter(this.isVisibleNode.bind(this))\n : $levels.removeClass('hidden').children('.hierarchy').find('.node:first').filter(this.isVisibleNode.bind(this));\n if (!isVerticalDesc) {\n $animatedNodes.filter(':not(:only-child)').closest('.hierarchy').addClass('isChildrenCollapsed');\n $animatedNodes.closest('.hierarchy').removeClass('isCollapsedDescendant');\n }\n // the two following statements are used to enforce browser to repaint\n this.repaint($animatedNodes.get(0));\n $animatedNodes.addClass('sliding').removeClass('slide-up').eq(0).one('transitionend', { 'node': $node, 'animatedNodes': $animatedNodes }, this.showChildrenEnd.bind(this));\n },\n //\n hideSiblingsEnd: function (event) {\n var $node = event.data.node;\n var $nodeContainer = event.data.nodeContainer;\n var direction = event.data.direction;\n var $siblings = direction ? (direction === 'left' ? $nodeContainer.prevAll(':not(.hidden)') : $nodeContainer.nextAll(':not(.hidden)')) : $nodeContainer.siblings();\n event.data.animatedNodes.removeClass('sliding');\n $siblings.find('.node:gt(0)').filter(this.isVisibleNode.bind(this))\n .removeClass('slide-left slide-right').addClass('slide-up');\n $siblings.find('.nodes, .vertical').addClass('hidden')\n .end().addClass('hidden');\n\n if (this.isInAction($node)) {\n this.switchHorizontalArrow($node);\n }\n },\n // hide the sibling nodes of the specified node\n hideSiblings: function ($node, direction) {\n var that = this;\n var $nodeContainer = $node.closest('.hierarchy').addClass('isSiblingsCollapsed');\n if ($nodeContainer.siblings().find('.spinner').length) {\n $node.closest('.orgchart').data('inAjax', false);\n }\n if (direction) {\n if (direction === 'left') {\n $nodeContainer.addClass('left-sibs')\n .prevAll('.isSiblingsCollapsed').removeClass('isSiblingsCollapsed left-sibs').end()\n .prevAll().addClass('isCollapsedSibling isChildrenCollapsed')\n .find('.node').filter(this.isVisibleNode.bind(this)).addClass('sliding slide-right');\n } else {\n $nodeContainer.addClass('right-sibs')\n .nextAll('.isSiblingsCollapsed').removeClass('isSiblingsCollapsed right-sibs').end()\n .nextAll().addClass('isCollapsedSibling isChildrenCollapsed')\n .find('.node').filter(this.isVisibleNode.bind(this)).addClass('sliding slide-left');\n }\n } else {\n $nodeContainer.prevAll().find('.node').filter(this.isVisibleNode.bind(this)).addClass('sliding slide-right');\n $nodeContainer.nextAll().find('.node').filter(this.isVisibleNode.bind(this)).addClass('sliding slide-left');\n $nodeContainer.siblings().addClass('isCollapsedSibling isChildrenCollapsed');\n }\n var $animatedNodes = $nodeContainer.siblings().find('.sliding');\n $animatedNodes.eq(0).one('transitionend', { 'node': $node, 'nodeContainer': $nodeContainer, 'direction': direction, 'animatedNodes': $animatedNodes }, this.hideSiblingsEnd.bind(this));\n },\n //\n showSiblingsEnd: function (event) {\n var $node = event.data.node;\n event.data.visibleNodes.removeClass('sliding');\n if (this.isInAction($node)) {\n this.switchHorizontalArrow($node);\n $node.children('.topEdge').removeClass('oci-chevron-up').addClass('oci-chevron-down');\n }\n },\n //\n showRelatedParentEnd: function(event) {\n $(event.target).removeClass('sliding');\n },\n // show the sibling nodes of the specified node\n showSiblings: function ($node, direction) {\n var that = this;\n // firstly, show the sibling nodes\n var $siblings = $();\n var $nodeContainer = $node.closest('.hierarchy');\n if (direction) {\n if (direction === 'left') {\n $siblings = $nodeContainer.prevAll().removeClass('hidden');\n } else {\n $siblings = $nodeContainer.nextAll().removeClass('hidden');\n }\n } else {\n $siblings = $node.closest('.hierarchy').siblings().removeClass('hidden');\n }\n // secondly, show the lines\n var $upperLevel = $node.closest('.nodes').siblings('.node');\n if (direction) {\n $nodeContainer.removeClass(direction + '-sibs');\n if (!$nodeContainer.is('[class*=-sibs]')) {\n $nodeContainer.removeClass('isSiblingsCollapsed');\n }\n $siblings.removeClass('isCollapsedSibling ' + direction + '-sibs');\n } else {\n $node.closest('.hierarchy').removeClass('isSiblingsCollapsed');\n $siblings.removeClass('isCollapsedSibling');\n }\n // thirdly, show parent node if it is collapsed\n if (!this.getNodeState($node, 'parent').visible) {\n $node.closest('.hierarchy').removeClass('isAncestorsCollapsed');\n $upperLevel.removeClass('hidden');\n this.repaint($upperLevel[0]);\n $upperLevel.addClass('sliding').removeClass('slide-down').one('transitionend', this.showRelatedParentEnd);\n }\n // lastly, show the sibling nodes with animation\n var $visibleNodes = $siblings.find('.node').filter(this.isVisibleNode.bind(this));\n this.repaint($visibleNodes.get(0));\n $visibleNodes.addClass('sliding').removeClass('slide-left slide-right');\n $visibleNodes.eq(0).one('transitionend', { 'node': $node, 'visibleNodes': $visibleNodes }, this.showSiblingsEnd.bind(this));\n },\n // start up loading status for requesting new nodes\n startLoading: function ($edge) {\n var $chart = this.$chart;\n if (typeof $chart.data('inAjax') !== 'undefined' && $chart.data('inAjax') === true) {\n return false;\n }\n\n $edge.addClass('hidden');\n $edge.parent().append('<i class=\"oci oci-spinner spinner\"></i>')\n .children().not('.spinner').css('opacity', 0.2);\n $chart.data('inAjax', true);\n $('.oc-export-btn').prop('disabled', true);\n return true;\n },\n // terminate loading status for requesting new nodes\n endLoading: function ($edge) {\n var $node = $edge.parent();\n $edge.removeClass('hidden');\n $node.find('.spinner').remove();\n $node.children().removeAttr('style');\n this.$chart.data('inAjax', false);\n $('.oc-export-btn').prop('disabled', false);\n },\n // whether the cursor is hovering over the node\n isInAction: function ($node) {\n return $node.children('.edge').attr('class').indexOf('oci-') > -1 ? true : false;\n },\n //\n switchVerticalArrow: function ($arrow) {\n $arrow.toggleClass('oci-chevron-up').toggleClass('oci-chevron-down');\n },\n //\n switchHorizontalArrow: function ($node) {\n var opts = this.options;\n if (opts.toggleSiblingsResp && (typeof opts.ajaxURL === 'undefined' || $node.closest('.nodes').data('siblingsLoaded'))) {\n var $prevSib = $node.parent().prev();\n if ($prevSib.length) {\n if ($prevSib.is('.hidden')) {\n $node.children('.leftEdge').addClass('oci-chevron-left').removeClass('oci-chevron-right');\n } else {\n $node.children('.leftEdge').addClass('oci-chevron-right').removeClass('oci-chevron-left');\n }\n }\n var $nextSib = $node.parent().next();\n if ($nextSib.length) {\n if ($nextSib.is('.hidden')) {\n $node.children('.rightEdge').addClass('oci-chevron-right').removeClass('oci-chevron-left');\n } else {\n $node.children('.rightEdge').addClass('oci-chevron-left').removeClass('oci-chevron-right');\n }\n }\n } else {\n var $sibs = $node.parent().siblings();\n var sibsVisible = $sibs.length ? !$sibs.is('.hidden') : false;\n $node.children('.leftEdge').toggleClass('oci-chevron-right', sibsVisible).toggleClass('oci-chevron-left', !sibsVisible);\n $node.children('.rightEdge').toggleClass('oci-chevron-left', sibsVisible).toggleClass('oci-chevron-right', !sibsVisible);\n }\n },\n //\n repaint: function (node) {\n if (node) {\n node.style.offsetWidth = node.offsetWidth;\n }\n },\n // determines how to show arrow buttons \n nodeEnterLeaveHandler: function (event) {\n var $node = $(event.delegateTarget);\n var flag = false;\n if ($node.closest('.nodes.vertical').length) {\n var $toggleBtn = $node.children('.toggleBtn');\n if (event.type === 'mouseenter') {\n if ($node.children('.toggleBtn').length) {\n flag = this.getNodeState($node, 'children').visible;\n $toggleBtn.toggleClass('oci-plus-square', !flag).toggleClass('oci-minus-square', flag);\n }\n } else {\n $toggleBtn.removeClass('oci-plus-square oci-minus-square');\n }\n } else {\n var $topEdge = $node.children('.topEdge');\n var $rightEdge = $node.children('.rightEdge');\n var $bottomEdge = $node.children('.bottomEdge');\n var $leftEdge = $node.children('.leftEdge');\n if (event.type === 'mouseenter') {\n if ($topEdge.length) {\n flag = this.getNodeState($node, 'parent').visible;\n $topEdge.toggleClass('oci-chevron-up', !flag).toggleClass('oci-chevron-down', flag);\n }\n if ($bottomEdge.length) {\n flag = this.getNodeState($node, 'children').visible;\n $bottomEdge.toggleClass('oci-chevron-down', !flag).toggleClass('oci-chevron-up', flag);\n }\n if ($leftEdge.length) {\n this.switchHorizontalArrow($node);\n }\n } else {\n $node.children('.edge').removeClass('oci-chevron-up oci-chevron-down oci-chevron-right oci-chevron-left');\n }\n }\n },\n //\n nodeClickHandler: function (event) {\n this.$chart.find('.focused').removeClass('focused');\n $(event.delegateTarget).addClass('focused');\n },\n // load new nodes by ajax\n loadNodes: function (rel, url, $edge) {\n var that = this;\n var opts = this.options;\n $.ajax({ 'url': url, 'dataType': 'json' })\n .done(function (data) {\n if (that.$chart.data('inAjax')) {\n if (rel === 'parent') {\n if (!$.isEmptyObject(data)) {\n that.addParent($edge.parent(), data);\n }\n } else if (rel === 'children') {\n if (data.children.length) {\n that.addChildren($edge.parent(), data[rel]);\n }\n } else {\n that.addSiblings($edge.parent(), data.siblings ? data.siblings : data);\n }\n that.triggerLoadEvent($edge.parent(), rel);\n }\n })\n .fail(function () {\n console.log('Failed to get ' + rel + ' data');\n })\n .always(function () {\n that.endLoading($edge);\n });\n },\n //\n HideFirstParentEnd: function (event) {\n var $topEdge = event.data.topEdge;\n var $node = $topEdge.parent();\n if (this.isInAction($node)) {\n this.switchVerticalArrow($topEdge);\n this.switchHorizontalArrow($node);\n }\n },\n // actions on clinking top edge of a node\n topEdgeClickHandler: function (event) {\n event.stopPropagation();\n var that = this;\n var $topEdge = $(event.target);\n var $node = $(event.delegateTarget);\n var parentState = this.getNodeState($node, 'parent');\n if (parentState.exist) {\n var $parent = $node.closest('.nodes').siblings('.node');\n if ($parent.is('.sliding')) { return; }\n // hide the ancestor nodes and sibling nodes of the specified node\n if (parentState.visible) {\n this.hideParent($node);\n $parent.one('transitionend', { 'topEdge': $topEdge }, this.HideFirstParentEnd.bind(this));\n this.triggerHideEvent($node, 'parent');\n } else { // show the ancestors and siblings\n this.showParent($node);\n this.triggerShowEvent($node, 'parent');\n }\n } else { // load the new parent node of the specified node by ajax request\n // start up loading status\n if (this.startLoading($topEdge)) {\n var opts = this.options;\n var url = $.isFunction(opts.ajaxURL.parent) ? opts.ajaxURL.parent($node.data('nodeData')) : opts.ajaxURL.parent + $node[0].id;\n this.loadNodes('parent', url, $topEdge);\n }\n }\n },\n // actions on clinking bottom edge of a node\n bottomEdgeClickHandler: function (event) {\n event.stopPropagation();\n var $bottomEdge = $(event.target);\n var $node = $(event.delegateTarget);\n var childrenState = this.getNodeState($node, 'children');\n if (childrenState.exist) {\n var $children = $node.siblings('.nodes').children().children('.node');\n if ($children.is('.sliding')) { return; }\n // hide the descendant nodes of the specified node\n if (childrenState.visible) {\n this.hideChildren($node);\n this.triggerHideEvent($node, 'children');\n } else { // show the descendants\n this.showChildren($node);\n this.triggerShowEvent($node, 'children');\n }\n } else { // load the new children nodes of the specified node by ajax request\n if (this.startLoading($bottomEdge)) {\n var opts = this.options;\n var url = $.isFunction(opts.ajaxURL.children) ? opts.ajaxURL.children($node.data('nodeData')) : opts.ajaxURL.children + $node[0].id;\n this.loadNodes('children', url, $bottomEdge);\n }\n }\n },\n // actions on clicking horizontal edges\n hEdgeClickHandler: function (event) {\n event.stopPropagation();\n var $hEdge = $(event.target);\n var $node = $(event.delegateTarget);\n var opts = this.options;\n var siblingsState = this.getNodeState($node, 'siblings');\n if (siblingsState.exist) {\n var $siblings = $node.closest('.hierarchy').siblings();\n if ($siblings.find('.sliding').length) { return; }\n if (opts.toggleSiblingsResp) {\n var $prevSib = $node.closest('.hierarchy').prev();\n var $nextSib = $node.closest('.hierarchy').next();\n if ($hEdge.is('.leftEdge')) {\n if ($prevSib.is('.hidden')) {\n this.showSiblings($node, 'left');\n this.triggerShowEvent($node,'siblings');\n } else {\n this.hideSiblings($node, 'left');\n this.triggerHideEvent($node, 'siblings');\n }\n } else {\n if ($nextSib.is('.hidden')) {\n this.showSiblings($node, 'right');\n this.triggerShowEvent($node,'siblings');\n } else {\n this.hideSiblings($node, 'right');\n this.triggerHideEvent($node, 'siblings');\n }\n }\n } else {\n if (siblingsState.visible) {\n this.hideSiblings($node);\n this.triggerHideEvent($node, 'siblings');\n } else {\n this.showSiblings($node);\n this.triggerShowEvent($node, 'siblings');\n }\n }\n } else {\n // load the new sibling nodes of the specified node by ajax request\n if (this.startLoading($hEdge)) {\n var nodeId = $node[0].id;\n var url = (this.getNodeState($node, 'parent').exist) ?\n ($.isFunction(opts.ajaxURL.siblings) ? opts.ajaxURL.siblings($node.data('nodeData')) : opts.ajaxURL.siblings + nodeId) :\n ($.isFunction(opts.ajaxURL.families) ? opts.ajaxURL.families($node.data('nodeData')) : opts.ajaxURL.families + nodeId);\n this.loadNodes('siblings', url, $hEdge);\n }\n }\n },\n //\n expandVNodesEnd: function (event) {\n event.data.vNodes.removeClass('sliding');\n },\n //\n collapseVNodesEnd: function (event) {\n event.data.vNodes.removeClass('sliding').closest('ul').addClass('hidden');\n },\n // event handler for toggle buttons in Hybrid(horizontal + vertical) OrgChart\n toggleVNodes: function (event) {\n var $toggleBtn = $(event.target);\n var $descWrapper = $toggleBtn.parent().next();\n var $descendants = $descWrapper.find('.node');\n var $children = $descWrapper.children().children('.node');\n if ($children.is('.sliding')) { return; }\n $toggleBtn.toggleClass('oci-plus-square oci-minus-square');\n if ($descendants.eq(0).is('.slide-up')) {\n $descWrapper.removeClass('hidden');\n this.repaint($children.get(0));\n $children.addClass('sliding').removeClass('slide-up').eq(0).one('transitionend', { 'vNodes': $children }, this.expandVNodesEnd);\n } else {\n $descendants.addClass('sliding slide-up').eq(0).one('transitionend', { 'vNodes': $descendants }, this.collapseVNodesEnd);\n $descendants.find('.toggleBtn').removeClass('oci-minus-square').addClass('oci-plus-square');\n }\n },\n //\n createGhostNode: function (event) {\n var $nodeDiv = $(event.target);\n var opts = this.options;\n var origEvent = event.originalEvent;\n var isFirefox = /firefox/.test(window.navigator.userAgent.toLowerCase());\n var ghostNode, nodeCover;\n if (!document.querySelector('.ghost-node')) {\n ghostNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n if (!ghostNode.classList) return;\n ghostNode.classList.add('ghost-node');\n nodeCover = document.createElementNS('http://www.w3.org/2000/svg','rect');\n ghostNode.appendChild(nodeCover);\n $nodeDiv.closest('.orgchart').append(ghostNode);\n } else {\n ghostNode = $nodeDiv.closest('.orgchart').children('.ghost-node').get(0);\n nodeCover = $(ghostNode).children().get(0);\n }\n var transValues = $nodeDiv.closest('.orgchart').css('transform').split(',');\n var isHorizontal = opts.direction === 't2b' || opts.direction === 'b2t';\n var scale = Math.abs(window.parseFloat(isHorizontal ? transValues[0].slice(transValues[0].indexOf('(') + 1) : transValues[1]));\n ghostNode.setAttribute('width', isHorizontal ? $nodeDiv.outerWidth(false) : $nodeDiv.outerHeight(false));\n ghostNode.setAttribute('height', isHorizontal ? $nodeDiv.outerHeight(false) : $nodeDiv.outerWidth(false));\n nodeCover.setAttribute('x',5 * scale);\n nodeCover.setAttribute('y',5 * scale);\n nodeCover.setAttribute('width', 120 * scale);\n nodeCover.setAttribute('height', 40 * scale);\n nodeCover.setAttribute('rx', 4 * scale);\n nodeCover.setAttribute('ry', 4 * scale);\n nodeCover.setAttribute('stroke-width', 1 * scale);\n var xOffset = origEvent.offsetX * scale;\n var yOffset = origEvent.offsetY * scale;\n if (opts.direction === 'l2r') {\n xOffset = origEvent.offsetY * scale;\n yOffset = origEvent.offsetX * scale;\n } else if (opts.direction === 'r2l') {\n xOffset = $nodeDiv.outerWidth(false) - origEvent.offsetY * scale;\n yOffset = origEvent.offsetX * scale;\n } else if (opts.direction === 'b2t') {\n xOffset = $nodeDiv.outerWidth(false) - origEvent.offsetX * scale;\n yOffset = $nodeDiv.outerHeight(false) - origEvent.offsetY * scale;\n }\n if (isFirefox) { // hack for old version of Firefox(< 48.0)\n nodeCover.setAttribute('fill', 'rgb(255, 255, 255)');\n nodeCover.setAttribute('stroke', 'rgb(191, 0, 0)');\n var ghostNodeWrapper = document.createElement('img');\n ghostNodeWrapper.src = 'data:image/svg+xml;utf8,' + (new XMLSerializer()).serializeToString(ghostNode);\n origEvent.dataTransfer.setDragImage(ghostNodeWrapper, xOffset, yOffset);\n } else {\n // IE/Edge do not support this, so only use it if we can\n if (origEvent.dataTransfer.setDragImage)\n origEvent.dataTransfer.setDragImage(ghostNode, xOffset, yOffset);\n }\n },\n //\n filterAllowedDropNodes: function ($dragged) {\n var opts = this.options;\n // what is being dragged? a node, or something within a node?\n var draggingNode = $dragged.closest('[draggable]').hasClass('node');\n var $dragZone = $dragged.closest('.nodes').siblings('.node'); // parent node\n var $dragHier = $dragged.closest('.hierarchy').find('.node'); // this node, and its children\n this.$chart.data('dragged', $dragged)\n .find('.node').each(function (index, node) {\n if (!draggingNode || $dragHier.index(node) === -1) {\n if (opts.dropCriteria) {\n if (opts.dropCriteria($dragged, $dragZone, $(node))) {\n $(node).addClass('allowedDrop');\n }\n } else {\n $(node).addClass('allowedDrop');\n }\n }\n });\n },\n //\n dragstartHandler: function (event) {\n event.originalEvent.dataTransfer.setData('text/html', 'hack for firefox');\n // if users enable zoom or direction options\n if (this.$chart.css('transform') !== 'none') {\n this.createGhostNode(event);\n }\n this.filterAllowedDropNodes($(event.target));\n },\n //\n dragoverHandler: function (event) {\n if (!$(event.delegateTarget).is('.allowedDrop')) {\n event.originalEvent.dataTransfer.dropEffect = 'none';\n } else {\n // default action for drag-and-drop of div is not to drop, so preventing default action for nodes which have allowedDrop class\n //to fix drag and drop on IE and Edge\n event.preventDefault();\n }\n },\n //\n dragendHandler: function (event) {\n this.$chart.find('.allowedDrop').removeClass('allowedDrop');\n },\n // when user drops the node, it will be removed from original parent node and be added to new parent node\n dropHandler: function (event) {\n var $dropZone = $(event.delegateTarget);\n var $dragged = this.$chart.data('dragged');\n\n // Pass on drops which are not nodes (since they are not our doing)\n if (!$dragged.hasClass('node')) {\n this.$chart.triggerHandler({ 'type': 'otherdropped.orgchart', 'draggedItem': $dragged, 'dropZone': $dropZone });\n return;\n }\n\n if (!$dropZone.hasClass('allowedDrop')) {\n // We are trying to drop a node into a node which isn't allowed\n // IE/Edge have a habit of allowing this, so we need our own double-check\n return;\n }\n\n var $dragZone = $dragged.closest('.nodes').siblings('.node');\n var dropEvent = $.Event('nodedrop.orgchart');\n this.$chart.trigger(dropEvent, { 'draggedNode': $dragged, 'dragZone': $dragZone, 'dropZone': $dropZone });\n if (dropEvent.isDefaultPrevented()) {\n return;\n }\n // firstly, deal with the hierarchy of drop zone\n if (!$dropZone.siblings('.nodes').length) { // if the drop zone is a leaf node\n $dropZone.append('<i class=\"edge verticalEdge bottomEdge oci\"></i>')\n .after('<ul class=\"nodes\"></ul>')\n .siblings('.nodes').append($dragged.find('.horizontalEdge').remove().end().closest('.hierarchy'));\n if ($dropZone.children('.title').length) {\n $dropZone.children('.title').prepend('<i class=\"oci '+ this.$chart.data('options').parentNodeSymbol + ' symbol\"></i>');\n }\n } else {\n var horizontalEdges = '<i class=\"edge horizontalEdge rightEdge oci\"></i><i class=\"edge horizontalEdge leftEdge oci\"></i>';\n if (!$dragged.find('.horizontalEdge').length) {\n $dragged.append(horizontalEdges);\n }\n $dropZone.siblings('.nodes').append($dragged.closest('.hierarchy'));\n var $dropSibs = $dragged.closest('.hierarchy').siblings().find('.node:first');\n if ($dropSibs.length === 1) {\n $dropSibs.append(horizontalEdges);\n }\n }\n // secondly, deal with the hierarchy of dragged node\n if ($dragZone.siblings('.nodes').children('.hierarchy').length === 1) { // if there is only one sibling node left\n $dragZone.siblings('.nodes').children('.hierarchy').find('.node:first')\n .find('.horizontalEdge').remove();\n } else if ($dragZone.siblings('.nodes').children('.hierarchy').length === 0) {\n $dragZone.find('.bottomEdge, .symbol').remove()\n .end().siblings('.nodes').remove();\n }\n },\n //\n touchstartHandler: function (event) {\n if (this.touchHandled)\n return;\n\n if (event.touches && event.touches.length > 1)\n return;\n\n this.touchHandled = true;\n this.touchMoved = false; // this is so we can work out later if this was a 'press' or a 'drag' touch\n event.preventDefault();\n },\n //\n touchmoveHandler: function (event) {\n if (!this.touchHandled)\n return;\n\n if (event.touches && event.touches.length > 1)\n return;\n\n event.preventDefault();\n\n if (!this.touchMoved) {\n // we do not bother with createGhostNode (dragstart does) since the touch event does not have a dataTransfer property\n this.filterAllowedDropNodes($(event.currentTarget)); // will also set 'this.$chart.data('dragged')' for us\n // create an image which can be used to illustrate the drag (our own createGhostNode)\n this.touchDragImage = this.createDragImage(event, this.$chart.data('dragged')[0]);\n }\n this.touchMoved = true;\n\n // move our dragimage so it follows our finger\n this.moveDragImage(event, this.touchDragImage);\n\n var $touching = $(document.elementFromPoint(event.touches[0].clientX, event.touches[0].clientY));\n var $touchingNodes = $touching.closest('div.node');\n if ($touchingNodes.length > 0) {\n var touchingNodeElement = $touchingNodes[0];\n if ($touchingNodes.is('.allowedDrop')) {\n this.touchTargetNode = touchingNodeElement;\n }\n else {\n this.touchTargetNode = null;\n }\n }\n else {\n this.touchTargetNode = null;\n }\n },\n //\n touchendHandler: function (event) {\n if (!this.touchHandled) {\n return;\n }\n this.destroyDragImage();\n if (this.touchMoved) {\n // we've had movement, so this was a 'drag' touch\n if (this.touchTargetNode) {\n var fakeEventForDropHandler = { delegateTarget: this.touchTargetNode };\n this.dropHandler(fakeEventForDropHandler);\n this.touchTargetNode = null;\n }\n this.dragendHandler(event);\n }\n else {\n // we did not move, so this was a 'press' touch (fake a click)\n var firstTouch = event.changedTouches[0];\n var fakeMouseClickEvent = document.createEvent('MouseEvents');\n fakeMouseClickEvent.initMouseEvent('click', true, true, window, 1, firstTouch.screenX, firstTouch.screenY, firstTouch.clientX, firstTouch.clientY, event.ctrlKey, event.altKey, event.shiftKey, event.metaKey, 0, null);\n event.target.dispatchEvent(fakeMouseClickEvent);\n }\n this.touchHandled = false;\n },\n //\n createDragImage: function (event, source) {\n var dragImage = source.cloneNode(true);\n this.copyStyle(source, dragImage);\n dragImage.style.top = dragImage.style.left = '-9999px';\n var sourceRectangle = source.getBoundingClientRect();\n var sourcePoint = this.getTouchPoint(event);\n this.touchDragImageOffset = { x: sourcePoint.x - sourceRectangle.left, y: sourcePoint.y - sourceRectangle.top };\n dragImage.style.opacity = '0.5';\n document.body.appendChild(dragImage);\n return dragImage;\n },\n //\n destroyDragImage: function () {\n if (this.touchDragImage && this.touchDragImage.parentElement)\n this.touchDragImage.parentElement.removeChild(this.touchDragImage);\n this.touchDragImageOffset = null;\n this.touchDragImage = null;\n },\n //\n copyStyle: function (src, dst) {\n // remove potentially troublesome attributes\n var badAttributes = ['id', 'class', 'style', 'draggable'];\n badAttributes.forEach(function (att) {\n dst.removeAttribute(att);\n });\n // copy canvas content\n if (src instanceof HTMLCanvasElement) {\n var cSrc = src, cDst = dst;\n cDst.width = cSrc.width;\n cDst.height = cSrc.height;\n cDst.getContext('2d').drawImage(cSrc, 0, 0);\n }\n // copy style (without transitions)\n var cs = getComputedStyle(src);\n for (var i = 0; i < cs.length; i++) {\n var key = cs[i];\n if (key.indexOf('transition') < 0) {\n dst.style[key] = cs[key];\n }\n }\n dst.style.pointerEvents = 'none';\n // and repeat for all children\n for (var i = 0; i < src.children.length; i++) {\n this.copyStyle(src.children[i], dst.children[i]);\n }\n },\n //\n getTouchPoint: function (event) {\n if (event && event.touches) {\n event = event.touches[0];\n }\n return {\n x: event.clientX,\n y: event.clientY\n };\n },\n //\n moveDragImage: function (event, image) {\n if (!event || !image)\n return;\n var orgChartMaster = this;\n requestAnimationFrame(function () {\n var pt = orgChartMaster.getTouchPoint(event);\n var s = image.style;\n s.position = 'absolute';\n s.pointerEvents = 'none';\n s.zIndex = '999999';\n if (orgChartMaster.touchDragImageOffset) {\n s.left = Math.round(pt.x - orgChartMaster.touchDragImageOffset.x) + 'px';\n s.top = Math.round(pt.y - orgChartMaster.touchDragImageOffset.y) + 'px';\n }\n });\n },\n //\n bindDragDrop: function ($node) {\n $node.on('dragstart', this.dragstartHandler.bind(this))\n .on('dragover', this.dragoverHandler.bind(this))\n .on('dragend', this.dragendHandler.bind(this))\n .on('drop', this.dropHandler.bind(this))\n .on('touchstart', this.touchstartHandler.bind(this))\n .on('touchmove', this.touchmoveHandler.bind(this))\n .on('touchend', this.touchendHandler.bind(this));\n },\n // create node\n createNode: function (data) {\n var that = this;\n var opts = this.options;\n var level = data.level;\n if (data.children && data[opts.nodeId]) {\n $.each(data.children, function (index, child) {\n child.parentId = data[opts.nodeId]\n });\n }\n // construct the content of node\n var $nodeDiv = $('<div' + (opts.draggable ? ' draggable=\"true\"' : '') + (data[opts.nodeId] ? ' id=\"' + data[opts.nodeId] + '\"' : '') + (data.parentId ? ' data-parent=\"' + data.parentId + '\"' : '') + '>')\n .addClass('node ' + (data.className || '') + (level > opts.visibleLevel ? ' slide-up' : ''));\n if (opts.nodeTemplate) {\n $nodeDiv.append(opts.nodeTemplate(data));\n } else {\n $nodeDiv.append('<div class=\"title\">' + data[opts.nodeTitle] + '</div>')\n .append(typeof opts.nodeContent !== 'undefined' ? '<div class=\"content\">' + (data[opts.nodeContent] || '') + '</div>' : '');\n }\n //\n var nodeData = $.extend({}, data);\n delete nodeData.children;\n $nodeDiv.data('nodeData', nodeData);\n // append 4 direction arrows or expand/collapse buttons\n var flags = data.relationship || '';\n if (opts.verticalLevel && level >= opts.verticalLevel) {\n if ((level + 1) > opts.verticalLevel && Number(flags.substr(2,1))) {\n $nodeDiv.append('<i class=\"toggleBtn oci\"></i>')\n .children('.title').prepend('<i class=\"oci '+ opts.parentNodeSymbol + ' symbol\"></i>');\n }\n } else {\n if (Number(flags.substr(0,1))) {\n $nodeDiv.append('<i class=\"edge verticalEdge topEdge oci\"></i>');\n }\n if(Number(flags.substr(1,1))) {\n $nodeDiv.append('<i class=\"edge horizontalEdge rightEdge oci\"></i>' +\n '<i class=\"edge horizontalEdge leftEdge oci\"></i>');\n }\n if(Number(flags.substr(2,1))) {\n $nodeDiv.append('<i class=\"edge verticalEdge bottomEdge oci\"></i>')\n .children('.title').prepend('<i class=\"oci '+ opts.parentNodeSymbol + ' symbol\"></i>');\n }\n }\n\n $nodeDiv.on('mouseenter mouseleave', this.nodeEnterLeaveHandler.bind(this));\n $nodeDiv.on('click', this.nodeClickHandler.bind(this));\n $nodeDiv.on('click', '.topEdge', this.topEdgeClickHandler.bind(this));\n $nodeDiv.on('click', '.bottomEdge', this.bottomEdgeClickHandler.bind(this));\n $nodeDiv.on('click', '.leftEdge, .rightEdge', this.hEdgeClickHandler.bind(this));\n $nodeDiv.on('click', '.toggleBtn', this.toggleVNodes.bind(this));\n\n if (opts.draggable) {\n this.bindDragDrop($nodeDiv);\n this.touchHandled = false;\n this.touchMoved = false;\n this.touchTargetNode = null;\n }\n // allow user to append dom modification after finishing node create of orgchart\n if (opts.createNode) {\n opts.createNode($nodeDiv, data);\n }\n\n return $nodeDiv;\n },\n // recursively build the tree\n buildHierarchy: function ($appendTo, data) {\n var that = this;\n var opts = this.options;\n var level = 0;\n if (data.level) {\n level = data.level;\n } else {\n level = data.level = $appendTo.parentsUntil('.orgchart', '.nodes').length;\n }\n // Construct the node\n if (Object.keys(data).length > 2) {\n var $nodeDiv = this.createNode(data);\n if (opts.verticalLevel && level >= opts.verticalLevel) {\n $appendTo.append($nodeDiv);\n } else {\n $appendTo.append($nodeDiv);\n }\n }\n // Construct the \"inferior nodes\"\n if (data.children && data.children.length) {\n var isHidden = level + 1 > opts.visibleLevel || (data.collapsed !== undefined && data.collapsed);\n var isVerticalLayer = opts.verticalLevel && (level + 1) >= opts.verticalLevel;\n var $nodesLayer;\n if (isVerticalLayer) {\n $nodesLayer = $('<ul class=\"nodes\">');\n if (isHidden && level + 1 >= opts.verticalLevel) {\n $nodesLayer.addClass('hidden');\n }\n if (level + 1 === opts.verticalLevel) {\n $appendTo.addClass('hybrid').append($nodesLayer.addClass('vertical'));\n } else {\n $appendTo.append($nodesLayer);\n }\n } else {\n $nodesLayer = $('<ul class=\"nodes' + (isHidden ? ' hidden' : '') + '\">');\n if (Object.keys(data).length === 2) {\n $appendTo.append($nodesLayer);\n } else {\n if (isHidden) {\n $appendTo.addClass('isChildrenCollapsed');\n }\n $appendTo.append($nodesLayer);\n }\n }\n // recurse through children nodes\n $.each(data.children, function () {\n var $nodeCell = $('<li class=\"hierarchy\">');\n $nodesLayer.append($nodeCell);\n this.level = level + 1;\n that.buildHierarchy($nodeCell, this);\n });\n }\n },\n // build the child nodes of specific node\n buildChildNode: function ($appendTo, data) {\n this.buildHierarchy($appendTo, { 'children': data });\n },\n // exposed method\n addChildren: function ($node, data) {\n this.buildChildNode($node.closest('.hierarchy'), data);\n if (!$node.find('.symbol').length) {\n $node.children('.title').prepend('<i class=\"oci '+ this.options.parentNodeSymbol + ' symbol\"></i>');\n }\n if ($node.closest('.nodes.vertical').length) {\n if (!$node.children('.toggleBtn').length) {\n $node.append('<i class=\"toggleBtn oci\"></i>');\n }\n } else {\n if (!$node.children('.bottomEdge').length) {\n $node.append('<i class=\"edge verticalEdge bottomEdge oci\"></i>');\n }\n }\n if (this.isInAction($node)) {\n this.switchVerticalArrow($node.children('.bottomEdge'));\n }\n },\n // build the parent node of specific node\n buildParentNode: function ($currentRoot, data) {\n data.relationship = data.relationship || '001';\n var $newRootWrapper = $('<ul class=\"nodes\"><li class=\"hierarchy\"></li></ul>')\n .find('.hierarchy').append(this.createNode(data)).end();\n this.$chart.prepend($newRootWrapper)\n .find('.hierarchy:first').append($currentRoot.closest('ul').addClass('nodes'));\n },\n // exposed method\n addParent: function ($currentRoot, data) {\n this.buildParentNode($currentRoot, data);\n if (!$currentRoot.children('.topEdge').length) {\n $currentRoot.children('.title').after('<i class=\"edge verticalEdge topEdge oci\"></i>');\n }\n if (this.isInAction($currentRoot)) {\n this.switchVerticalArrow($currentRoot.children('.topEdge'));\n }\n },\n // build the sibling nodes of specific node\n buildSiblingNode: function ($nodeChart, data) {\n var newSiblingCount = $.isArray(data) ? data.length : data.children.length;\n var existingSibligCount = $nodeChart.parent().is('.nodes') ? $nodeChart.siblings().length + 1 : 1;\n var siblingCount = existingSibligCount + newSiblingCount;\n var insertPostion = (siblingCount > 1) ? Math.floor(siblingCount/2 - 1) : 0;\n // just build the sibling nodes for the specific node\n if ($nodeChart.closest('.nodes').parent().is('.hierarchy')) {\n this.buildChildNode($nodeChart.parent().closest('.hierarchy'), data);\n var $siblings = $nodeChart.parent().closest('.hierarchy').children('.nodes:last').children('.hierarchy');\n if (existingSibligCount > 1) {\n $siblings.eq(0).before($nodeChart.siblings().addBack().unwrap());\n } else {\n $siblings.eq(insertPostion).after($nodeChart.unwrap());\n }\n } else { // build the sibling nodes and parent node for the specific ndoe\n this.buildHierarchy($nodeChart.parent().prepend($('<li class=\"hierarchy\">')).children('.hierarchy:first'), data);\n $nodeChart.prevAll('.hierarchy').children('.nodes').children().eq(insertPostion).after($nodeChart);\n }\n },\n //\n addSiblings: function ($node, data) {\n this.buildSiblingNode($node.closest('.hierarchy'), data);\n $node.closest('.nodes').data('siblingsLoaded', true);\n if (!$node.children('.leftEdge').length) {\n $node.children('.topEdge').after('<i class=\"edge horizontalEdge rightEdge oci\"></i><i class=\"edge horizontalEdge leftEdge oci\"></i>');\n }\n if (this.isInAction($node)) {\n this.switchHorizontalArrow($node);\n $node.children('.topEdge').removeClass('oci-chevron-up').addClass('oci-chevron-down');\n }\n },\n // remove node and its descendent nodes\n removeNodes: function ($node) {\n var $wrapper = $node.closest('.hierarchy').parent();\n if ($wrapper.parent().is('.hierarchy')) {\n if (this.getNodeState($node, 'siblings').exist) {\n $node.closest('.hierarchy').remove();\n if ($wrapper.children().length === 1) {\n $wrapper.find('.node:first .horizontalEdge').remove();\n }\n } else {\n $wrapper.siblings('.node').find('.bottomEdge').remove()\n .end().end().remove();\n }\n } else { // if $node is root node\n $wrapper.closest('.orgchart').remove();\n }\n },\n //\n hideDropZones: function () {\n // Remove all the 'this is a drop zone' indicators\n var orgChartObj = this;\n orgChartObj.$chart.find('.allowedDrop')\n .removeClass('allowedDrop');\n },\n //\n showDropZones: function (dragged) {\n // Highlight all the 'drop zones', and set dragged, so that the drop/enter can work out what happens later\n // TODO: This assumes all nodes are droppable: it doesn't run the custom isDroppable function - it should!\n var orgChartObj = this;\n orgChartObj.$chart.find('.node')\n .each(function (index, node) {\n $(node).addClass('allowedDrop');\n });\n orgChartObj.$chart.data('dragged', $(dragged));\n },\n //\n processExternalDrop: function (dropZone, dragged) {\n // Allow an external drop event to be handled by one of our nodes\n if (dragged) {\n this.$chart.data('dragged', $(dragged));\n }\n var droppedOnNode = dropZone.closest('.node');\n // would like to just call 'dropZoneHandler', but I can't reach it from here\n // instead raise a drop event on the node element\n droppedOnNode.triggerHandler({ 'type': 'drop' });\n },\n //\n exportPDF: function(canvas, exportFilename){\n var doc = {};\n var docWidth = Math.floor(canvas.width);\n var docHeight = Math.floor(canvas.height);\n if (!window.jsPDF) {\n window.jsPDF = window.jspdf.jsPDF;\n }\n\n if (docWidth > docHeight) {\n doc = new jsPDF({\n orientation: 'landscape',\n unit: 'px',\n format: [docWidth, docHeight]\n });\n } else {\n doc = new jsPDF({\n orientation: 'portrait',\n unit: 'px',\n format: [docHeight, docWidth]\n });\n }\n doc.addImage(canvas.toDataURL(), 'png', 0, 0);\n doc.save(exportFilename + '.pdf');\n },\n //\n exportPNG: function(canvas, exportFilename){\n var that = this;\n var isWebkit = 'WebkitAppearance' in document.documentElement.style;\n var isFf = !!window.sidebar;\n var isEdge = navigator.appName === 'Microsoft Internet Explorer' || (navigator.appName === \"Netscape\" && navigator.appVersion.indexOf('Edge') > -1);\n var $chartContainer = this.$chartContainer;\n\n if ((!isWebkit && !isFf) || isEdge) {\n window.navigator.msSaveBlob(canvas.msToBlob(), exportFilename + '.png');\n } else {\n var selector = '.oci-download-btn' + (that.options.chartClass !== '' ? '.' + that.options.chartClass : '');\n\n if (!$chartContainer.find(selector).length) {\n $chartContainer.append('<a class=\"oci-download-btn' + (that.options.chartClass !== '' ? ' ' + that.options.chartClass : '') + '\"'\n + ' download=\"' + exportFilename + '.png\"></a>');\n }\n\n $chartContainer.find(selector).attr('href', canvas.toDataURL())[0].click();\n }\n },\n //\n export: function (exportFilename, exportFileextension) {\n var that = this;\n exportFilename = (typeof exportFilename !== 'undefined') ? exportFilename : this.options.exportFilename;\n exportFileextension = (typeof exportFileextension !== 'undefined') ? exportFileextension : this.options.exportFileextension;\n if ($(this).children('.spinner').length) {\n return false;\n }\n var $chartContainer = this.$chartContainer;\n var $mask = $chartContainer.find('.mask');\n if (!$mask.length) {\n $chartContainer.append('<div class=\"mask\"><i class=\"oci oci-spinner spinner\"></i></div>');\n } else {\n $mask.removeClass('hidden');\n }\n var sourceChart = $chartContainer.addClass('canvasContainer').find('.orgchart:not(\".hidden\")').get(0);\n var flag = that.options.direction === 'l2r' || that.options.direction === 'r2l';\n html2canvas(sourceChart, {\n 'width': flag ? sourceChart.clientHeight : sourceChart.clientWidth,\n 'height': flag ? sourceChart.clientWidth : sourceChart.clientHeight,\n 'onclone': function (cloneDoc) {\n $(cloneDoc).find('.canvasContainer').css('overflow', 'visible')\n .find('.orgchart:not(\".hidden\"):first').css('transform', '');\n }\n })\n .then(function (canvas) {\n $chartContainer.find('.mask').addClass('hidden');\n\n if (exportFileextension.toLowerCase() === 'pdf') {\n that.exportPDF(canvas, exportFilename);\n } else {\n that.exportPNG(canvas, exportFilename);\n }\n\n $chartContainer.removeClass('canvasContainer');\n }, function () {\n $chartContainer.removeClass('canvasContainer');\n });\n }\n };\n\n $.fn.orgchart = function (opts) {\n return new OrgChart(this, opts).init();\n };\n\n}));\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orgchart",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Simple and direct organization chart(tree-like hierarchy) plugin based on pure DOM and jQuery.",
|
|
5
5
|
"main": "./dist/js/jquery.orgchart.min.js",
|
|
6
6
|
"style": [
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
],
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "gulp test",
|
|
11
|
+
"unit-tests": "gulp unit-tests",
|
|
11
12
|
"build": "gulp build",
|
|
12
13
|
"start": "gulp serve"
|
|
13
14
|
},
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
"jest-cli": "^24.9.0",
|
|
60
61
|
"jest-image-snapshot": "^2.11.0",
|
|
61
62
|
"jest-puppeteer": "^4.3.0",
|
|
62
|
-
"jsdom": "^
|
|
63
|
+
"jsdom": "^16.5.0",
|
|
63
64
|
"jsdom-global": "^3.0.2",
|
|
64
65
|
"merge-stream": "^1.0.1",
|
|
65
66
|
"mocha": "^6.2.0",
|
|
@@ -471,6 +471,15 @@
|
|
|
471
471
|
}
|
|
472
472
|
return { 'exist': false, 'visible': false };
|
|
473
473
|
},
|
|
474
|
+
getParent: function ($node) {
|
|
475
|
+
return this.getRelatedNodes($node, 'parent');
|
|
476
|
+
},
|
|
477
|
+
getChildren: function ($node) {
|
|
478
|
+
return this.getRelatedNodes($node, 'children');
|
|
479
|
+
},
|
|
480
|
+
getSiblings: function ($node) {
|
|
481
|
+
return this.getRelatedNodes($node, 'siblings');
|
|
482
|
+
},
|
|
474
483
|
// find the related nodes
|
|
475
484
|
getRelatedNodes: function ($node, relation) {
|
|
476
485
|
if (!$node || !($node instanceof $) || !$node.is('.node')) {
|
|
@@ -1041,7 +1050,7 @@
|
|
|
1041
1050
|
event.originalEvent.dataTransfer.dropEffect = 'none';
|
|
1042
1051
|
} else {
|
|
1043
1052
|
// default action for drag-and-drop of div is not to drop, so preventing default action for nodes which have allowedDrop class
|
|
1044
|
-
//to fix drag and drop on IE and Edge
|
|
1053
|
+
//to fix drag and drop on IE and Edge
|
|
1045
1054
|
event.preventDefault();
|
|
1046
1055
|
}
|
|
1047
1056
|
},
|
|
@@ -1059,7 +1068,7 @@
|
|
|
1059
1068
|
this.$chart.triggerHandler({ 'type': 'otherdropped.orgchart', 'draggedItem': $dragged, 'dropZone': $dropZone });
|
|
1060
1069
|
return;
|
|
1061
1070
|
}
|
|
1062
|
-
|
|
1071
|
+
|
|
1063
1072
|
if (!$dropZone.hasClass('allowedDrop')) {
|
|
1064
1073
|
// We are trying to drop a node into a node which isn't allowed
|
|
1065
1074
|
// IE/Edge have a habit of allowing this, so we need our own double-check
|
package/test/unit/tests.js
CHANGED
|
@@ -184,7 +184,8 @@ describe('orgchart -- unit tests', function () {
|
|
|
184
184
|
|
|
185
185
|
it('getRelatedNodes()', function () {
|
|
186
186
|
oc.getRelatedNodes().should.deep.equal($());
|
|
187
|
-
oc.getRelatedNodes(
|
|
187
|
+
oc.getRelatedNodes({}, 'children').should.deep.equal($());
|
|
188
|
+
oc.getRelatedNodes($('.hierarchy:first'), 'children').should.deep.equal($());
|
|
188
189
|
oc.getRelatedNodes($('.node:first'), 'child').should.deep.equal($());
|
|
189
190
|
|
|
190
191
|
oc.getRelatedNodes($laolao, 'parent').should.deep.equal($());
|
|
@@ -196,6 +197,37 @@ describe('orgchart -- unit tests', function () {
|
|
|
196
197
|
oc.getRelatedNodes($bomiao, 'siblings').toArray().should.members([$sumiao[0], $hongmiao[0]]);
|
|
197
198
|
});
|
|
198
199
|
|
|
200
|
+
it('getParent()', function () {
|
|
201
|
+
oc.getParent().should.deep.equal($());
|
|
202
|
+
oc.getParent({}).should.deep.equal($());
|
|
203
|
+
oc.getParent($('.hierarchy:first')).should.deep.equal($());
|
|
204
|
+
|
|
205
|
+
oc.getParent($laolao).should.deep.equal($());
|
|
206
|
+
oc.getParent($bomiao).should.deep.equal($laolao);
|
|
207
|
+
oc.getParent($sandan).should.deep.equal($pangpang);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it('getSiblings()', function () {
|
|
211
|
+
oc.getSiblings().should.deep.equal($());
|
|
212
|
+
oc.getSiblings({}).should.deep.equal($());
|
|
213
|
+
oc.getSiblings($('.hierarchy:first')).should.deep.equal($());
|
|
214
|
+
|
|
215
|
+
oc.getSiblings($laolao).should.deep.equal($());
|
|
216
|
+
oc.getSiblings($bomiao).toArray().should.members([$sumiao[0], $hongmiao[0]]);
|
|
217
|
+
oc.getSiblings($sandan).should.deep.equal($());
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it('getChildren()', function () {
|
|
221
|
+
oc.getChildren().should.deep.equal($());
|
|
222
|
+
oc.getChildren({}).should.deep.equal($());
|
|
223
|
+
oc.getChildren($('.hierarchy:first')).should.deep.equal($());
|
|
224
|
+
|
|
225
|
+
oc.getChildren($laolao).toArray().should.members([$bomiao[0], $sumiao[0], $hongmiao[0]]);
|
|
226
|
+
oc.getChildren($bomiao).should.deep.equal($());
|
|
227
|
+
oc.getChildren($sumiao).toArray().should.members([$tiehua[0], $heihei[0], $pangpang[0]]);
|
|
228
|
+
oc.getChildren($sandan).should.deep.equal($());
|
|
229
|
+
});
|
|
230
|
+
|
|
199
231
|
it('hideParent()', function () {
|
|
200
232
|
var spy = sinon.spy(oc, 'hideParent');
|
|
201
233
|
var spy2 = sinon.spy(oc, 'hideSiblings');
|