orgchart 3.1.0 → 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 CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  ## Foreword
12
12
  First of all, thanks a lot for [wesnolte](https://github.com/wesnolte)'s great work:blush: -- [jOrgChart](https://github.com/wesnolte/jOrgChart). The thought that using nested tables to build out the tree-like orgonization chart is amazing. This idea is more simple and direct than its counterparts based on svg
13
- Unfortunately, it's long time not to see the update of jOrgChart. on the other hand, I got some interesting ideas to add, so I choose to create a new repo.
13
+ Unfortunately, it's long time not to see the update of jOrgChart. on the other hand, I got some interesting ideas to add, so I choose to create a new repo. **Since version 3.0, we use nested ul to construct tree-like chart instead of nested table.**
14
14
 
15
15
  ## Features
16
16
  - Supports both local data and remote data (JSON).
@@ -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>
@@ -77,9 +77,6 @@
77
77
 
78
78
  var oc = $('#chart-container').orgchart({
79
79
  'data' : datascource,
80
- 'chartClass': 'edit-state',
81
- 'exportButton': true,
82
- 'exportFilename': 'SportsChart',
83
80
  'createNode': function($node, data) {
84
81
  $node[0].id = getId();
85
82
  }
@@ -78,9 +78,6 @@
78
78
 
79
79
  var oc = $('#chart-container').orgchart({
80
80
  'data' : datascource,
81
- 'chartClass': 'edit-state',
82
- 'exportButton': true,
83
- 'exportFilename': 'SportsChart',
84
81
  'verticalLevel': 3,
85
82
  'createNode': function($node, data) {
86
83
  $node[0].id = getId();
@@ -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>
@@ -413,9 +413,7 @@
413
413
  }
414
414
 
415
415
  .oc-export-btn {
416
- position: absolute;
417
- top: 0.5rem;
418
- right: 0.5rem;
416
+ margin-left: 0.5rem;
419
417
  padding: 0.5rem 1rem;
420
418
  }
421
419
 
@@ -1 +1 @@
1
- .orgchart{box-sizing:border-box;display:inline-block;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:linear-gradient(90deg,rgba(200,0,0,.15) 10%,rgba(0,0,0,0) 10%),linear-gradient(rgba(200,0,0,.15) 10%,rgba(0,0,0,0) 10%);background-size:10px 10px;border:1px dashed transparent;padding:20px 20px 0 20px}.orgchart .hidden,.orgchart~.hidden{display:none!important}.orgchart.b2t{transform:rotate(180deg)}.orgchart.l2r{position:absolute;transform:rotate(-90deg) rotateY(180deg);transform-origin:left top;text-align:center}.orgchart.r2l{position:absolute;transform:rotate(90deg);transform-origin:left top;text-align:center}.orgchart~.mask{position:absolute;top:0;right:0;bottom:0;left:0;z-index:999;text-align:center;background-color:rgba(0,0,0,.3)}.orgchart~.mask .spinner{position:absolute;top:calc(50% - 50px);left:calc(50% - 50px)}.orgchart>.spinner::before,.orgchart~.mask .spinner::before{width:100px;height:100px;border-width:10px;border-radius:50px;border-top-color:rgba(68,157,68,.8);border-bottom-color:rgba(68,157,68,.8);border-left-color:rgba(68,157,68,.8)}.orgchart .nodes{display:flex;list-style:none;padding-left:0;margin:0}.orgchart .hierarchy{position:relative}.orgchart .hierarchy::before{content:"";position:absolute;top:-11px;left:0;width:100%;border-top:2px solid rgba(217,83,79,.8);box-sizing:border-box}.orgchart .hierarchy.isSiblingsCollapsed.left-sibs::before,.orgchart .hierarchy:first-child::before{left:calc(50% - 1px);width:calc(50% + 1px)}.orgchart .hierarchy.isSiblingsCollapsed.right-sibs::before,.orgchart .hierarchy:last-child::before{width:calc(50% + 1px)}.orgchart .hierarchy:not(.hidden):only-child::before{width:2px}.orgchart .isAncestorsCollapsed:only-child::before,.orgchart .isAncestorsCollapsed>.node::before,.orgchart .isChildrenCollapsed>.node:not(:only-child)::after,.orgchart .isCollapsedDescendant::before,.orgchart .isCollapsedDescendant>.node::after,.orgchart .isCollapsedDescendant>.node::before,.orgchart .isCollapsedSibling .hierarchy::before,.orgchart .isCollapsedSibling::before,.orgchart .isSiblingsCollapsed.left-sibs.right-sibs::before,.orgchart .isSiblingsCollapsed.left-sibs:last-child:before,.orgchart .isSiblingsCollapsed.right-sibs:first-child:before,.orgchart .isSiblingsCollapsed:not(.left-sibs):not(.right-sibs)::before,.orgchart>.nodes>.hierarchy::before{content:none}.orgchart .node:not(:only-child)::after{content:"";position:absolute;bottom:-11px;left:calc(50% - 1px);width:2px;height:9px;background-color:rgba(217,83,79,.8)}.orgchart ul li .node.allowedDrop{border-color:rgba(68,157,68,.9)}.orgchart ul li .node.currentDropTarget{background-color:rgba(68,157,68,.9)}.orgchart ul li .node.selected{background-color:rgba(238,217,54,.5)}.orgchart ul li .node:hover{background-color:rgba(238,217,54,.5)}.orgchart>ul>li>ul li>.node::before{content:"";position:absolute;top:-11px;left:calc(50% - 1px);width:2px;height:9px;background-color:rgba(217,83,79,.8)}.orgchart>ul>li>ul li.isSiblingsCollapsed>.node::before{top:-13px;height:11px}.orgchart .node{box-sizing:border-box;display:inline-block;position:relative;margin:0 0 20px 0;padding:3px;border:2px dashed transparent;text-align:center}.orgchart.l2r .node,.orgchart.r2l .node{width:50px;height:140px}.orgchart .node:hover{background-color:rgba(238,217,54,.5);transition:.5s;cursor:default;z-index:20}.orgchart .node.focused{background-color:rgba(238,217,54,.5)}.orgchart .ghost-node{position:fixed;left:-10000px;top:-10000px}.orgchart .ghost-node rect{fill:#fff;stroke:#bf0000}.orgchart .node.allowedDrop{border-color:rgba(68,157,68,.9)}.orgchart .node>.spinner{position:absolute;top:calc(50% - 1rem);left:calc(50% - 1rem)}.orgchart .node>.spinner::before{width:2rem;height:2rem;border-width:.2rem;border-radius:1rem;border-top-color:rgba(68,157,68,.8);border-bottom-color:rgba(68,157,68,.8);border-left-color:rgba(68,157,68,.8)}.orgchart .node .title{box-sizing:border-box;padding:2px;width:130px;text-align:center;font-size:.75rem;font-weight:700;height:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background-color:rgba(217,83,79,.8);color:#fff;border-radius:4px 4px 0 0}.orgchart.b2t .node .title{transform:rotate(-180deg);transform-origin:center bottom}.orgchart.l2r .node .title{transform:rotate(-90deg) translate(-45px,-45px) rotateY(180deg);transform-origin:bottom center}.orgchart.r2l .node .title{transform:rotate(-90deg) translate(-45px,-45px);transform-origin:bottom center}.orgchart .node .title .symbol{float:left;margin-top:12px;margin-left:2px}.orgchart .node .title .symbol::before{background-color:#fff;border-color:rgba(217,83,79,.8)}.orgchart .node .title .symbol::after{background-color:#fff}.orgchart .node .content{box-sizing:border-box;padding:2px;height:20px;font-size:.625rem;border:1px solid rgba(217,83,79,.8);border-radius:0 0 4px 4px;text-align:center;background-color:#fff;color:#333;text-overflow:ellipsis;white-space:nowrap}.orgchart.b2t .node .content{transform:rotate(180deg);transform-origin:center top}.orgchart.l2r .node .content{transform:rotate(-90deg) translate(-45px,-45px) rotateY(180deg);transform-origin:top center;width:130px}.orgchart.r2l .node .content{transform:rotate(-90deg) translate(-45px,-45px);transform-origin:top center;width:130px}.orgchart .node .edge{position:absolute;cursor:default;transition:.2s}.orgchart .node .edge::before{border-color:rgba(68,157,68,.5)}.orgchart.noncollapsable .node .edge{display:none}.orgchart .node .edge:hover{cursor:pointer}.orgchart .edge:hover::before{border-color:#449d44}.orgchart .node .verticalEdge{width:calc(100% - 6px);width:-webkit-calc(100% - 6px);width:-moz-calc(100% - 6px);height:10px;left:3px}.orgchart .node .verticalEdge::before{position:absolute;left:calc(50% - .3125rem)}.orgchart .node .topEdge{top:-2px}.orgchart .node .topEdge.oci-chevron-up::before{top:2px}.orgchart .node .topEdge.oci-chevron-down::before{bottom:3px}.orgchart .node .bottomEdge{bottom:-2px}.orgchart .node .bottomEdge.oci-chevron-up::before{bottom:-3px}.orgchart .node .bottomEdge.oci-chevron-down::before{bottom:1px}.orgchart .node .horizontalEdge{width:10px;height:calc(100% - 6px);height:-webkit-calc(100% - 6px);height:-moz-calc(100% - 6px);top:3px}.orgchart .node .rightEdge{right:-2px}.orgchart .node .leftEdge{left:-2px}.orgchart .node .horizontalEdge::before{position:absolute;top:calc(50% - .3125rem)}.orgchart .node .rightEdge.oci-chevron-left::before{right:-3px}.orgchart .node .rightEdge.oci-chevron-right::before{right:1px}.orgchart .node .leftEdge.oci-chevron-right::before{left:-3px}.orgchart .node .leftEdge.oci-chevron-left::before{left:1px}.orgchart .node .toggleBtn{position:absolute;left:5px;bottom:-2px}.orgchart .node .toggleBtn::before{background-color:rgba(68,157,68,.6)}.orgchart .node .toggleBtn:hover::before{background-color:#449d44}.oc-export-btn{position:absolute;top:.5rem;right:.5rem;padding:.5rem 1rem}.orgchart .node{transition:transform .3s,opacity .3s}.orgchart .slide-down{opacity:0;transform:translateY(40px)}.orgchart.l2r .node.slide-down,.orgchart.r2l .node.slide-down{transform:translateY(130px)}.orgchart .slide-up{opacity:0;transform:translateY(-40px)}.orgchart.l2r .node.slide-up,.orgchart.r2l .node.slide-up{transform:translateY(-130px)}.orgchart .slide-right{opacity:0;transform:translateX(130px)}.orgchart.l2r .node.slide-right,.orgchart.r2l .node.slide-right{transform:translateX(40px)}.orgchart .slide-left{opacity:0;transform:translateX(-130px)}.orgchart.l2r .node.slide-left,.orgchart.r2l .node.slide-left{transform:translateX(-40px)}.orgchart .hierarchy.hybrid>.node{margin-bottom:0}.orgchart .hierarchy.hybrid>.node::after{content:none}.orgchart .nodes.vertical{display:block;margin:0;padding-left:18px}.orgchart .nodes.vertical .nodes{list-style:none;display:block;margin:0;padding-left:18px;text-align:left}.orgchart .nodes.vertical .node{margin-bottom:0}.orgchart .nodes.vertical .node::after,.orgchart .nodes.vertical .node::before{content:none}.orgchart .nodes.vertical::before{content:'';display:inline-block;position:relative;height:14px;width:2px;left:-9px;background-color:rgba(217,83,79,.8)}.orgchart .nodes.vertical>.hierarchy:first-child::before{box-sizing:border-box;top:-4px;height:30px;width:calc(50% - 2px);border-width:2px 0 0 2px}.orgchart .nodes.vertical .hierarchy{position:relative;text-align:left}.orgchart .nodes.vertical .hierarchy::after,.orgchart .nodes.vertical .hierarchy::before{box-sizing:border-box;content:'';position:absolute;left:-6px;border-color:rgba(217,83,79,.8);border-style:solid;border-width:0 0 2px 2px}.orgchart .nodes.vertical .hierarchy::before{top:-4px;height:30px;width:11px}.orgchart .nodes.vertical .hierarchy::after{top:1px;height:100%}.orgchart .nodes.vertical .hierarchy:first-child::after{box-sizing:border-box;top:24px;width:11px;border-width:2px 0 0 2px}.orgchart .nodes.vertical .hierarchy:last-child::after{box-sizing:border-box;border-width:2px 0 0}.oci{display:inline-block;position:relative;font-style:normal;font-family:Arial}.oci-chevron-up::before{content:"";display:inline-block;box-sizing:border-box;vertical-align:text-bottom;width:.625rem;height:.625rem;border-width:0 .2rem .2rem 0;border-style:solid;border-color:#000;background:0 0;transform:rotate(-135deg)}.oci-chevron-right::before{content:"";display:inline-block;box-sizing:border-box;width:.625rem;height:.625rem;border-width:0 .2rem .2rem 0;border-style:solid;border-color:#000;background:0 0;transform:rotate(-45deg)}.oci-chevron-down::before{content:"";display:inline-block;box-sizing:border-box;width:.625rem;height:.625rem;border-width:0 .2rem .2rem 0;border-style:solid;border-color:#000;background:0 0;transform:rotate(45deg)}.oci-chevron-left::before{content:"";display:inline-block;box-sizing:border-box;width:.625rem;height:.625rem;border-width:0 .2rem .2rem 0;border-style:solid;border-color:#000;background:0 0;transform:rotate(135deg)}.oci-leader::before{position:absolute;content:"";display:inline-block;width:.4rem;height:.4rem;border-radius:.2rem;background:#000;top:-.75rem;left:.1rem}.oci-leader::after{position:absolute;content:"";display:inline-block;width:.875rem;height:.375rem;border-radius:.25rem .25rem 0 0;background:#000;top:-.3rem;left:-.125rem}.oci-plus-square::before{content:"+";display:inline-block;vertical-align:text-bottom;text-align:center;width:1rem;height:1rem;background-color:#000;color:#fff}.oci-plus-circle::before{content:"+";display:inline-block;vertical-align:text-bottom;text-align:center;width:1rem;height:1rem;border-radius:.5rem;background-color:#000;color:#fff}.oci-minus-square::before{content:"−";display:inline-block;vertical-align:text-bottom;text-align:center;width:1rem;height:1rem;background-color:#000;color:#fff}.oci-minus-circle::before{content:"−";display:inline-block;vertical-align:text-bottom;text-align:center;width:1rem;height:1rem;border-radius:.5rem;background-color:#000;color:#fff}.oci-arrow-circle-up::before{content:"▲";display:inline-block;text-align:center;vertical-align:text-bottom;width:1rem;height:1rem;border-radius:.5rem;background-color:#000;color:#fff;font-size:.875rem}.oci-arrow-circle-down::before{content:"▼";text-align:center;display:inline-block;vertical-align:text-bottom;width:1rem;height:1rem;border-radius:.5rem;background-color:#000;color:#fff;font-size:.875rem}.oci-info-circle::before{content:"i";display:inline-block;vertical-align:text-bottom;width:1rem;height:1rem;border-radius:.5rem;background-color:#000;color:#fff;text-align:center;font-weight:700}.oci-spinner::before{content:"";vertical-align:text-bottom;display:inline-block;box-sizing:border-box;width:1rem;height:1rem;border:.1rem solid #000;border-right-color:transparent;border-radius:.625rem;animation:oci-infinite-spinning .75s linear infinite}@keyframes oci-infinite-spinning{from{transform:rotate(0)}to{transform:rotate(360deg)}}
1
+ .orgchart{box-sizing:border-box;display:inline-block;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:linear-gradient(90deg,rgba(200,0,0,.15) 10%,rgba(0,0,0,0) 10%),linear-gradient(rgba(200,0,0,.15) 10%,rgba(0,0,0,0) 10%);background-size:10px 10px;border:1px dashed transparent;padding:20px 20px 0 20px}.orgchart .hidden,.orgchart~.hidden{display:none!important}.orgchart.b2t{transform:rotate(180deg)}.orgchart.l2r{position:absolute;transform:rotate(-90deg) rotateY(180deg);transform-origin:left top;text-align:center}.orgchart.r2l{position:absolute;transform:rotate(90deg);transform-origin:left top;text-align:center}.orgchart~.mask{position:absolute;top:0;right:0;bottom:0;left:0;z-index:999;text-align:center;background-color:rgba(0,0,0,.3)}.orgchart~.mask .spinner{position:absolute;top:calc(50% - 50px);left:calc(50% - 50px)}.orgchart>.spinner::before,.orgchart~.mask .spinner::before{width:100px;height:100px;border-width:10px;border-radius:50px;border-top-color:rgba(68,157,68,.8);border-bottom-color:rgba(68,157,68,.8);border-left-color:rgba(68,157,68,.8)}.orgchart .nodes{display:flex;list-style:none;padding-left:0;margin:0}.orgchart .hierarchy{position:relative}.orgchart .hierarchy::before{content:"";position:absolute;top:-11px;left:0;width:100%;border-top:2px solid rgba(217,83,79,.8);box-sizing:border-box}.orgchart .hierarchy.isSiblingsCollapsed.left-sibs::before,.orgchart .hierarchy:first-child::before{left:calc(50% - 1px);width:calc(50% + 1px)}.orgchart .hierarchy.isSiblingsCollapsed.right-sibs::before,.orgchart .hierarchy:last-child::before{width:calc(50% + 1px)}.orgchart .hierarchy:not(.hidden):only-child::before{width:2px}.orgchart .isAncestorsCollapsed:only-child::before,.orgchart .isAncestorsCollapsed>.node::before,.orgchart .isChildrenCollapsed>.node:not(:only-child)::after,.orgchart .isCollapsedDescendant::before,.orgchart .isCollapsedDescendant>.node::after,.orgchart .isCollapsedDescendant>.node::before,.orgchart .isCollapsedSibling .hierarchy::before,.orgchart .isCollapsedSibling::before,.orgchart .isSiblingsCollapsed.left-sibs.right-sibs::before,.orgchart .isSiblingsCollapsed.left-sibs:last-child:before,.orgchart .isSiblingsCollapsed.right-sibs:first-child:before,.orgchart .isSiblingsCollapsed:not(.left-sibs):not(.right-sibs)::before,.orgchart>.nodes>.hierarchy::before{content:none}.orgchart .node:not(:only-child)::after{content:"";position:absolute;bottom:-11px;left:calc(50% - 1px);width:2px;height:9px;background-color:rgba(217,83,79,.8)}.orgchart ul li .node.allowedDrop{border-color:rgba(68,157,68,.9)}.orgchart ul li .node.currentDropTarget{background-color:rgba(68,157,68,.9)}.orgchart ul li .node.selected{background-color:rgba(238,217,54,.5)}.orgchart ul li .node:hover{background-color:rgba(238,217,54,.5)}.orgchart>ul>li>ul li>.node::before{content:"";position:absolute;top:-11px;left:calc(50% - 1px);width:2px;height:9px;background-color:rgba(217,83,79,.8)}.orgchart>ul>li>ul li.isSiblingsCollapsed>.node::before{top:-13px;height:11px}.orgchart .node{box-sizing:border-box;display:inline-block;position:relative;margin:0 0 20px 0;padding:3px;border:2px dashed transparent;text-align:center}.orgchart.l2r .node,.orgchart.r2l .node{width:50px;height:140px}.orgchart .node:hover{background-color:rgba(238,217,54,.5);transition:.5s;cursor:default;z-index:20}.orgchart .node.focused{background-color:rgba(238,217,54,.5)}.orgchart .ghost-node{position:fixed;left:-10000px;top:-10000px}.orgchart .ghost-node rect{fill:#fff;stroke:#bf0000}.orgchart .node.allowedDrop{border-color:rgba(68,157,68,.9)}.orgchart .node>.spinner{position:absolute;top:calc(50% - 1rem);left:calc(50% - 1rem)}.orgchart .node>.spinner::before{width:2rem;height:2rem;border-width:.2rem;border-radius:1rem;border-top-color:rgba(68,157,68,.8);border-bottom-color:rgba(68,157,68,.8);border-left-color:rgba(68,157,68,.8)}.orgchart .node .title{box-sizing:border-box;padding:2px;width:130px;text-align:center;font-size:.75rem;font-weight:700;height:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background-color:rgba(217,83,79,.8);color:#fff;border-radius:4px 4px 0 0}.orgchart.b2t .node .title{transform:rotate(-180deg);transform-origin:center bottom}.orgchart.l2r .node .title{transform:rotate(-90deg) translate(-45px,-45px) rotateY(180deg);transform-origin:bottom center}.orgchart.r2l .node .title{transform:rotate(-90deg) translate(-45px,-45px);transform-origin:bottom center}.orgchart .node .title .symbol{float:left;margin-top:12px;margin-left:2px}.orgchart .node .title .symbol::before{background-color:#fff;border-color:rgba(217,83,79,.8)}.orgchart .node .title .symbol::after{background-color:#fff}.orgchart .node .content{box-sizing:border-box;padding:2px;height:20px;font-size:.625rem;border:1px solid rgba(217,83,79,.8);border-radius:0 0 4px 4px;text-align:center;background-color:#fff;color:#333;text-overflow:ellipsis;white-space:nowrap}.orgchart.b2t .node .content{transform:rotate(180deg);transform-origin:center top}.orgchart.l2r .node .content{transform:rotate(-90deg) translate(-45px,-45px) rotateY(180deg);transform-origin:top center;width:130px}.orgchart.r2l .node .content{transform:rotate(-90deg) translate(-45px,-45px);transform-origin:top center;width:130px}.orgchart .node .edge{position:absolute;cursor:default;transition:.2s}.orgchart .node .edge::before{border-color:rgba(68,157,68,.5)}.orgchart.noncollapsable .node .edge{display:none}.orgchart .node .edge:hover{cursor:pointer}.orgchart .edge:hover::before{border-color:#449d44}.orgchart .node .verticalEdge{width:calc(100% - 6px);width:-webkit-calc(100% - 6px);width:-moz-calc(100% - 6px);height:10px;left:3px}.orgchart .node .verticalEdge::before{position:absolute;left:calc(50% - .3125rem)}.orgchart .node .topEdge{top:-2px}.orgchart .node .topEdge.oci-chevron-up::before{top:2px}.orgchart .node .topEdge.oci-chevron-down::before{bottom:3px}.orgchart .node .bottomEdge{bottom:-2px}.orgchart .node .bottomEdge.oci-chevron-up::before{bottom:-3px}.orgchart .node .bottomEdge.oci-chevron-down::before{bottom:1px}.orgchart .node .horizontalEdge{width:10px;height:calc(100% - 6px);height:-webkit-calc(100% - 6px);height:-moz-calc(100% - 6px);top:3px}.orgchart .node .rightEdge{right:-2px}.orgchart .node .leftEdge{left:-2px}.orgchart .node .horizontalEdge::before{position:absolute;top:calc(50% - .3125rem)}.orgchart .node .rightEdge.oci-chevron-left::before{right:-3px}.orgchart .node .rightEdge.oci-chevron-right::before{right:1px}.orgchart .node .leftEdge.oci-chevron-right::before{left:-3px}.orgchart .node .leftEdge.oci-chevron-left::before{left:1px}.orgchart .node .toggleBtn{position:absolute;left:5px;bottom:-2px}.orgchart .node .toggleBtn::before{background-color:rgba(68,157,68,.6)}.orgchart .node .toggleBtn:hover::before{background-color:#449d44}.oc-export-btn{margin-left:.5rem;padding:.5rem 1rem}.orgchart .node{transition:transform .3s,opacity .3s}.orgchart .slide-down{opacity:0;transform:translateY(40px)}.orgchart.l2r .node.slide-down,.orgchart.r2l .node.slide-down{transform:translateY(130px)}.orgchart .slide-up{opacity:0;transform:translateY(-40px)}.orgchart.l2r .node.slide-up,.orgchart.r2l .node.slide-up{transform:translateY(-130px)}.orgchart .slide-right{opacity:0;transform:translateX(130px)}.orgchart.l2r .node.slide-right,.orgchart.r2l .node.slide-right{transform:translateX(40px)}.orgchart .slide-left{opacity:0;transform:translateX(-130px)}.orgchart.l2r .node.slide-left,.orgchart.r2l .node.slide-left{transform:translateX(-40px)}.orgchart .hierarchy.hybrid>.node{margin-bottom:0}.orgchart .hierarchy.hybrid>.node::after{content:none}.orgchart .nodes.vertical{display:block;margin:0;padding-left:18px}.orgchart .nodes.vertical .nodes{list-style:none;display:block;margin:0;padding-left:18px;text-align:left}.orgchart .nodes.vertical .node{margin-bottom:0}.orgchart .nodes.vertical .node::after,.orgchart .nodes.vertical .node::before{content:none}.orgchart .nodes.vertical::before{content:'';display:inline-block;position:relative;height:14px;width:2px;left:-9px;background-color:rgba(217,83,79,.8)}.orgchart .nodes.vertical>.hierarchy:first-child::before{box-sizing:border-box;top:-4px;height:30px;width:calc(50% - 2px);border-width:2px 0 0 2px}.orgchart .nodes.vertical .hierarchy{position:relative;text-align:left}.orgchart .nodes.vertical .hierarchy::after,.orgchart .nodes.vertical .hierarchy::before{box-sizing:border-box;content:'';position:absolute;left:-6px;border-color:rgba(217,83,79,.8);border-style:solid;border-width:0 0 2px 2px}.orgchart .nodes.vertical .hierarchy::before{top:-4px;height:30px;width:11px}.orgchart .nodes.vertical .hierarchy::after{top:1px;height:100%}.orgchart .nodes.vertical .hierarchy:first-child::after{box-sizing:border-box;top:24px;width:11px;border-width:2px 0 0 2px}.orgchart .nodes.vertical .hierarchy:last-child::after{box-sizing:border-box;border-width:2px 0 0}.oci{display:inline-block;position:relative;font-style:normal;font-family:Arial}.oci-chevron-up::before{content:"";display:inline-block;box-sizing:border-box;vertical-align:text-bottom;width:.625rem;height:.625rem;border-width:0 .2rem .2rem 0;border-style:solid;border-color:#000;background:0 0;transform:rotate(-135deg)}.oci-chevron-right::before{content:"";display:inline-block;box-sizing:border-box;width:.625rem;height:.625rem;border-width:0 .2rem .2rem 0;border-style:solid;border-color:#000;background:0 0;transform:rotate(-45deg)}.oci-chevron-down::before{content:"";display:inline-block;box-sizing:border-box;width:.625rem;height:.625rem;border-width:0 .2rem .2rem 0;border-style:solid;border-color:#000;background:0 0;transform:rotate(45deg)}.oci-chevron-left::before{content:"";display:inline-block;box-sizing:border-box;width:.625rem;height:.625rem;border-width:0 .2rem .2rem 0;border-style:solid;border-color:#000;background:0 0;transform:rotate(135deg)}.oci-leader::before{position:absolute;content:"";display:inline-block;width:.4rem;height:.4rem;border-radius:.2rem;background:#000;top:-.75rem;left:.1rem}.oci-leader::after{position:absolute;content:"";display:inline-block;width:.875rem;height:.375rem;border-radius:.25rem .25rem 0 0;background:#000;top:-.3rem;left:-.125rem}.oci-plus-square::before{content:"+";display:inline-block;vertical-align:text-bottom;text-align:center;width:1rem;height:1rem;background-color:#000;color:#fff}.oci-plus-circle::before{content:"+";display:inline-block;vertical-align:text-bottom;text-align:center;width:1rem;height:1rem;border-radius:.5rem;background-color:#000;color:#fff}.oci-minus-square::before{content:"−";display:inline-block;vertical-align:text-bottom;text-align:center;width:1rem;height:1rem;background-color:#000;color:#fff}.oci-minus-circle::before{content:"−";display:inline-block;vertical-align:text-bottom;text-align:center;width:1rem;height:1rem;border-radius:.5rem;background-color:#000;color:#fff}.oci-arrow-circle-up::before{content:"▲";display:inline-block;text-align:center;vertical-align:text-bottom;width:1rem;height:1rem;border-radius:.5rem;background-color:#000;color:#fff;font-size:.875rem}.oci-arrow-circle-down::before{content:"▼";text-align:center;display:inline-block;vertical-align:text-bottom;width:1rem;height:1rem;border-radius:.5rem;background-color:#000;color:#fff;font-size:.875rem}.oci-info-circle::before{content:"i";display:inline-block;vertical-align:text-bottom;width:1rem;height:1rem;border-radius:.5rem;background-color:#000;color:#fff;text-align:center;font-weight:700}.oci-spinner::before{content:"";vertical-align:text-bottom;display:inline-block;box-sizing:border-box;width:1rem;height:1rem;border:.1rem solid #000;border-right-color:transparent;border-radius:.625rem;animation:oci-infinite-spinning .75s linear infinite}@keyframes oci-infinite-spinning{from{transform:rotate(0)}to{transform:rotate(360deg)}}
@@ -89,7 +89,7 @@
89
89
  $chartContainer.append($chart);
90
90
 
91
91
  // append the export button
92
- if (this.options.exportButton && !$chartContainer.find('.oc-export-btn').length) {
92
+ if (this.options.exportButton && !$('.oc-export-btn').length) {
93
93
  this.attachExportButton();
94
94
  }
95
95
 
@@ -136,18 +136,18 @@
136
136
  var initEvent = $.Event('hide-' + rel + '.orgchart');
137
137
  $target.trigger(initEvent);
138
138
  },
139
- //
139
+ // add export button for orgchart
140
140
  attachExportButton: function () {
141
141
  var that = this;
142
142
  var $exportBtn = $('<button>', {
143
- 'class': 'oc-export-btn' + (this.options.chartClass !== '' ? ' ' + this.options.chartClass : ''),
143
+ 'class': 'oc-export-btn',
144
144
  'text': this.options.exportButtonName,
145
145
  'click': function(e) {
146
146
  e.preventDefault();
147
147
  that.export();
148
148
  }
149
149
  });
150
- this.$chartContainer.append($exportBtn);
150
+ this.$chartContainer.after($exportBtn);
151
151
  },
152
152
  setOptions: function (opts, val) {
153
153
  if (typeof opts === 'string') {
@@ -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')) {
@@ -693,7 +702,7 @@
693
702
  $edge.parent().append('<i class="oci oci-spinner spinner"></i>')
694
703
  .children().not('.spinner').css('opacity', 0.2);
695
704
  $chart.data('inAjax', true);
696
- $('.oc-export-btn' + (this.options.chartClass !== '' ? '.' + this.options.chartClass : '')).prop('disabled', true);
705
+ $('.oc-export-btn').prop('disabled', true);
697
706
  return true;
698
707
  },
699
708
  // terminate loading status for requesting new nodes
@@ -703,7 +712,7 @@
703
712
  $node.find('.spinner').remove();
704
713
  $node.children().removeAttr('style');
705
714
  this.$chart.data('inAjax', false);
706
- $('.oc-export-btn' + (this.options.chartClass !== '' ? '.' + this.options.chartClass : '')).prop('disabled', false);
715
+ $('.oc-export-btn').prop('disabled', false);
707
716
  },
708
717
  // whether the cursor is hovering over the node
709
718
  isInAction: function ($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
@@ -1461,7 +1470,7 @@
1461
1470
  .end().end().remove();
1462
1471
  }
1463
1472
  } else { // if $node is root node
1464
- $wrapper.closest('.orgchart').siblings('.oc-export-btn').addBack().remove();
1473
+ $wrapper.closest('.orgchart').remove();
1465
1474
  }
1466
1475
  },
1467
1476
  //
@@ -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 s=this;this.options=p.extend({},this.defaultOptions,this.opts,e);var t=this.$chartContainer;this.$chart&&this.$chart.remove();var i=this.options.data,n=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||n.find(".node.focused").removeClass("focused")}});"undefined"!=typeof MutationObserver&&this.triggerInitEvent();var o=n.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")):(n.append('<i class="oci oci-spinner spinner"></i>'),p.ajax({url:i,dataType:"json"}).done(function(e,t,i){s.buildHierarchy(o,s.options.ajaxURL?e:s.attachRel(e,"00"),0,s.options)}).fail(function(e,t,i){console.log(i)}).always(function(){n.children(".spinner").remove()})),t.append(n),this.options.exportButton&&!t.find(".oc-export-btn").length&&this.attachExportButton(),this.options.pan&&this.bindPan(),this.options.zoom&&this.bindZoom(),this},triggerInitEvent:function(){var n=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")){n.options.initCompleted&&"function"==typeof n.options.initCompleted&&n.options.initCompleted(n.$chart);var s=p.Event("init.orgchart");n.$chart.trigger(s);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"+(""!==this.options.chartClass?" "+this.options.chartClass:""),text:this.options.exportButtonName,click:function(e){e.preventDefault(),t.export()}});this.$chartContainer.append(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,s=o.css("transform");if("none"!==s){var n=s.split(",");i=-1===s.indexOf("3d")?(t=parseInt(n[4]),parseInt(n[5])):(t=parseInt(n[12]),parseInt(n[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 s=o.css("transform");if("none"===s)-1===s.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 n=s.split(",");-1===s.indexOf("3d")?(n[4]=" "+t,n[5]=" "+i+")"):(n[12]=" "+t,n[13]=" "+i),o.css("transform",n.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"),s=e.css("transform"),n="",o=1;"none"===s?e.css("transform","scale("+t+","+t+")"):(n=s.split(","),-1===s.indexOf("3d")?(o=Math.abs(u.parseFloat(n[3])*t))>i.zoomoutLimit&&o<i.zoominLimit&&e.css("transform",s+" scale("+t+","+t+")"):(o=Math.abs(u.parseFloat(n[1])*t))>i.zoomoutLimit&&o<i.zoominLimit&&e.css("transform",s+" 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,s=e.find(".node:first"),n={id:s[0].id};return t&&p.each(s.data("nodeData"),function(e,t){n[e]=t}),s.siblings(".nodes").children().each(function(){n.children||(n.children=[]),n.children.push(i.loopChart(p(this),t))}),n},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={},s=!!e.closest("vertical").length;if("parent"===(t=t||"self")){if(s?(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=s?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=s?e.closest("ul"):e.parent().siblings()).length&&(!s||1<i.children("li").length))return i.is(".hidden")||i.parent().is(".hidden")||s&&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"),s=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||(s.filter(":not(:only-child)").closest(".hierarchy").addClass("isChildrenCollapsed"),s.closest(".hierarchy").removeClass("isCollapsedDescendant")),this.repaint(s.get(0)),s.addClass("sliding").removeClass("slide-up").eq(0).one("transitionend",{node:e,animatedNodes:s},this.showChildrenEnd.bind(this))},hideSiblingsEnd:function(e){var t=e.data.node,i=e.data.nodeContainer,s=e.data.direction,n=s?"left"===s?i.prevAll(":not(.hidden)"):i.nextAll(":not(.hidden)"):i.siblings();e.data.animatedNodes.removeClass("sliding"),n.find(".node:gt(0)").filter(this.isVisibleNode.bind(this)).removeClass("slide-left slide-right").addClass("slide-up"),n.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 s=i.siblings().find(".sliding");s.eq(0).one("transitionend",{node:e,nodeContainer:i,direction:t,animatedNodes:s},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(),s=e.closest(".hierarchy");i=t?"left"===t?s.prevAll().removeClass("hidden"):s.nextAll().removeClass("hidden"):e.closest(".hierarchy").siblings().removeClass("hidden");var n=e.closest(".nodes").siblings(".node");t?(s.removeClass(t+"-sibs"),s.is("[class*=-sibs]")||s.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"),n.removeClass("hidden"),this.repaint(n[0]),n.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"+(""!==this.options.chartClass?"."+this.options.chartClass:"")).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"+(""!==this.options.chartClass?"."+this.options.chartClass:"")).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 s=e.parent().next();s.length&&(s.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 n=e.parent().siblings(),o=!!n.length&&!n.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 s=t.children(".toggleBtn");"mouseenter"===e.type?t.children(".toggleBtn").length&&(i=this.getNodeState(t,"children").visible,s.toggleClass("oci-plus-square",!i).toggleClass("oci-minus-square",i)):s.removeClass("oci-plus-square oci-minus-square")}else{var n=t.children(".topEdge"),o=(t.children(".rightEdge"),t.children(".bottomEdge")),a=t.children(".leftEdge");"mouseenter"===e.type?(n.length&&(i=this.getNodeState(t,"parent").visible,n.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 s=this;this.options;p.ajax({url:e,dataType:"json"}).done(function(e){s.$chart.data("inAjax")&&("parent"===t?p.isEmptyObject(e)||s.addParent(i.parent(),e):"children"===t?e.children.length&&s.addChildren(i.parent(),e[t]):s.addSiblings(i.parent(),e.siblings?e.siblings:e),s.triggerLoadEvent(i.parent(),t))}).fail(function(){console.log("Failed to get "+t+" data")}).always(function(){s.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),s=this.getNodeState(i,"parent");if(s.exist){var n=i.closest(".nodes").siblings(".node");if(n.is(".sliding"))return;s.visible?(this.hideParent(i),n.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),s=this.getNodeState(i,"children");if(s.exist){if(i.siblings(".nodes").children().children(".node").is(".sliding"))return;s.visible?(this.hideChildren(i),this.triggerHideEvent(i,"children")):(this.showChildren(i),this.triggerShowEvent(i,"children"))}else if(this.startLoading(t)){var n=this.options,o=p.isFunction(n.ajaxURL.children)?n.ajaxURL.children(i.data("nodeData")):n.ajaxURL.children+i[0].id;this.loadNodes("children",o,t)}},hEdgeClickHandler:function(e){e.stopPropagation();var t=p(e.target),i=p(e.delegateTarget),s=this.options,n=this.getNodeState(i,"siblings");if(n.exist){if(i.closest(".hierarchy").siblings().find(".sliding").length)return;if(s.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 n.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(s.ajaxURL.siblings)?s.ajaxURL.siblings(i.data("nodeData")):s.ajaxURL.siblings+r:p.isFunction(s.ajaxURL.families)?s.ajaxURL.families(i.data("nodeData")):s.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(),s=i.find(".node"),n=i.children().children(".node");n.is(".sliding")||(t.toggleClass("oci-plus-square oci-minus-square"),s.eq(0).is(".slide-up")?(i.removeClass("hidden"),this.repaint(n.get(0)),n.addClass("sliding").removeClass("slide-up").eq(0).one("transitionend",{vNodes:n},this.expandVNodesEnd)):(s.addClass("sliding slide-up").eq(0).one("transitionend",{vNodes:s},this.collapseVNodesEnd),s.find(".toggleBtn").removeClass("oci-minus-square").addClass("oci-plus-square")))},createGhostNode:function(e){var t,i,s=p(e.target),n=this.options,o=e.originalEvent,a=/firefox/.test(u.navigator.userAgent.toLowerCase());if(f.querySelector(".ghost-node"))t=s.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),s.closest(".orgchart").append(t)}var r=s.closest(".orgchart").css("transform").split(","),d="t2b"===n.direction||"b2t"===n.direction,l=Math.abs(u.parseFloat(d?r[0].slice(r[0].indexOf("(")+1):r[1]));t.setAttribute("width",d?s.outerWidth(!1):s.outerHeight(!1)),t.setAttribute("height",d?s.outerHeight(!1):s.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"===n.direction?(h=o.offsetY*l,c=o.offsetX*l):"r2l"===n.direction?(h=s.outerWidth(!1)-o.offsetY*l,c=o.offsetX*l):"b2t"===n.direction&&(h=s.outerWidth(!1)-o.offsetX*l,c=s.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 s=this.options,n=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){n&&-1!==a.index(t)||(s.dropCriteria?s.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 s=i.closest(".nodes").siblings(".node"),n=p.Event("nodedrop.orgchart");if(this.$chart.trigger(n,{draggedNode:i,dragZone:s,dropZone:t}),!n.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===s.siblings(".nodes").children(".hierarchy").length?s.siblings(".nodes").children(".hierarchy").find(".node:first").find(".horizontalEdge").remove():0===s.siblings(".nodes").children(".hierarchy").length&&s.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],s=f.createEvent("MouseEvents");s.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(s)}this.touchHandled=!1}},createDragImage:function(e,t){var i=t.cloneNode(!0);this.copyStyle(t,i),i.style.top=i.style.left="-9999px";var s=t.getBoundingClientRect(),n=this.getTouchPoint(e);return this.touchDragImageOffset={x:n.x-s.left,y:n.y-s.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,s=t;s.width=i.width,s.height=i.height,s.getContext("2d").drawImage(i,0,0)}for(var n=getComputedStyle(e),o=0;o<n.length;o++){var a=n[o];a.indexOf("transition")<0&&(t.style[a]=n[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,s){if(i&&s){var n=this;requestAnimationFrame(function(){var e=n.getTouchPoint(i),t=s.style;t.position="absolute",t.pointerEvents="none",t.zIndex="999999",n.touchDragImageOffset&&(t.left=Math.round(e.x-n.touchDragImageOffset.x)+"px",t.top=Math.round(e.y-n.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 s=this.options,e=i.level;i.children&&i[s.nodeId]&&p.each(i.children,function(e,t){t.parentId=i[s.nodeId]});var t=p("<div"+(s.draggable?' draggable="true"':"")+(i[s.nodeId]?' id="'+i[s.nodeId]+'"':"")+(i.parentId?' data-parent="'+i.parentId+'"':"")+">").addClass("node "+(i.className||"")+(e>s.visibleLevel?" slide-up":""));s.nodeTemplate?t.append(s.nodeTemplate(i)):t.append('<div class="title">'+i[s.nodeTitle]+"</div>").append(void 0!==s.nodeContent?'<div class="content">'+(i[s.nodeContent]||"")+"</div>":"");var n=p.extend({},i);delete n.children,t.data("nodeData",n);var o=i.relationship||"";return s.verticalLevel&&e>=s.verticalLevel?e+1>s.verticalLevel&&Number(o.substr(2,1))&&t.append('<i class="toggleBtn oci"></i>').children(".title").prepend('<i class="oci '+s.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 '+s.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)),s.draggable&&(this.bindDragDrop(t),this.touchHandled=!1,this.touchMoved=!1,this.touchTargetNode=null),s.createNode&&s.createNode(t,i),t},buildHierarchy:function(e,t){var i=this,s=this.options,n=0;if(n=t.level?t.level:t.level=e.parentsUntil(".orgchart",".nodes").length,2<Object.keys(t).length){var o=this.createNode(t);s.verticalLevel&&s.verticalLevel,e.append(o)}if(t.children&&t.children.length){var a,r=n+1>s.visibleLevel||t.collapsed!==d&&t.collapsed;s.verticalLevel&&n+1>=s.verticalLevel?(a=p('<ul class="nodes">'),r&&n+1>=s.verticalLevel&&a.addClass("hidden"),n+1===s.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=n+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,s=e.parent().is(".nodes")?e.siblings().length+1:1,n=s+i,o=1<n?Math.floor(n/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<s?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").siblings(".oc-export-btn").addBack().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={},s=Math.floor(e.width),n=Math.floor(e.height);u.jsPDF||(u.jsPDF=u.jspdf.jsPDF),(i=n<s?new jsPDF({orientation:"landscape",unit:"px",format:[s,n]}):new jsPDF({orientation:"portrait",unit:"px",format:[n,s]})).addImage(e.toDataURL(),"png",0,0),i.save(t+".pdf")},exportPNG:function(e,t){var i="WebkitAppearance"in f.documentElement.style,s=!!u.sidebar,n="Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&-1<navigator.appVersion.indexOf("Edge"),o=this.$chartContainer;if(!i&&!s||n)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 s=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 n=this.$chartContainer,e=n.find(".mask");e.length?e.removeClass("hidden"):n.append('<div class="mask"><i class="oci oci-spinner spinner"></i></div>');var o=n.addClass("canvasContainer").find('.orgchart:not(".hidden")').get(0),a="l2r"===s.options.direction||"r2l"===s.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){n.find(".mask").addClass("hidden"),"pdf"===i.toLowerCase()?s.exportPDF(e,t):s.exportPNG(e,t),n.removeClass("canvasContainer")},function(){n.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