orgchart 3.1.2 → 3.1.4

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
@@ -133,6 +133,10 @@ It's not a big deal. You just turn to the method init().
133
133
 
134
134
  No problem. With the help of ES6 Template literals, we can customize the any complex node structure rather than the common title and content sections.
135
135
 
136
+ - [I want to position node in specific level. How can i do that ?](https://dabeng.github.io/OrgChart/level-offset.html)
137
+
138
+ You need the solution based on new datasource structure with levelOffset prop + callback createNode() + CSS custom properties(variables)
139
+
136
140
  ### how to start up demos locally
137
141
 
138
142
  - you have to install node.js v6+ because our unit tests are based on jsdom v11
package/demo/index.html CHANGED
@@ -141,6 +141,7 @@
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
143
  <li><a href="get-related-nodes.html" target="_blank">Highlight related nodes</a></li>
144
+ <li><a href="level-offset.html" target="_blank">position node in specific level</a></li>
144
145
  </ol>
145
146
  </section>
146
147
  </body>
@@ -0,0 +1,57 @@
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
+ </head>
10
+ <body>
11
+ <div id="chart-container"></div>
12
+
13
+ <script type="text/javascript" src="js/jquery.min.js"></script>
14
+ <script type="text/javascript" src="js/jquery.orgchart.js"></script>
15
+ <script type="text/javascript">
16
+ $(function() {
17
+
18
+ var datasource = {
19
+ 'name': 'Lao Lao',
20
+ 'title': 'general manager',
21
+ 'children': [
22
+ { 'name': 'Bo Miao', 'title': 'department manager', 'levelOffset': 1 },
23
+ { 'name': 'Su Miao', 'title': 'department manager',
24
+ 'children': [
25
+ { 'name': 'Tie Hua', 'title': 'senior engineer' },
26
+ { 'name': 'Hei Hei', 'title': 'senior engineer',
27
+ 'children': [
28
+ { 'name': 'Dan Dan', 'title': 'engineer' }
29
+ ]
30
+ },
31
+ { 'name': 'Pang Pang', 'title': 'senior engineer', 'levelOffset': 1 }
32
+ ]
33
+ },
34
+ { 'name': 'Hong Miao', 'title': 'department manager', 'levelOffset': 2 }
35
+ ]
36
+ };
37
+
38
+ $('#chart-container').orgchart({
39
+ 'data' : datasource,
40
+ 'nodeContent': 'title',
41
+ 'createNode': function(node, data) {
42
+ if (data.levelOffset) {
43
+ node.css({
44
+ 'margin-top': (data.levelOffset * 70) + 'px',
45
+ '--top': (-11 - data.levelOffset * 70) + 'px',
46
+ '--height': (9 + data.levelOffset * 70) + 'px',
47
+ '--top-cross-point': (-13 - data.levelOffset * 70) + 'px',
48
+ '--height-cross-point': (11 + data.levelOffset * 70) + 'px'
49
+ });
50
+ }
51
+ }
52
+ });
53
+
54
+ });
55
+ </script>
56
+ </body>
57
+ </html>
@@ -155,16 +155,16 @@
155
155
  .orgchart > ul > li > ul li > .node::before {
156
156
  content: "";
157
157
  position: absolute;
158
- top: -11px;
158
+ top: var(--top, -11px);
159
159
  left: calc(50% - 1px);
160
160
  width: 2px;
161
- height: 9px;
161
+ height: var(--height, 9px);
162
162
  background-color: rgba(217, 83, 79, 0.8);
163
163
  }
164
164
 
165
165
  .orgchart > ul > li > ul li.isSiblingsCollapsed > .node::before {
166
- top: -13px;
167
- height: 11px;
166
+ top: var(--top-cross-point, -13px);
167
+ height: var(--height-cross-point, 11px);
168
168
  }
169
169
 
170
170
  /* node styling */
@@ -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{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)}}
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:var(--top,-11px);left:calc(50% - 1px);width:2px;height:var(--height,9px);background-color:rgba(217,83,79,.8)}.orgchart>ul>li>ul li.isSiblingsCollapsed>.node::before{top:var(--top-cross-point,-13px);height:var(--height-cross-point,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)}}
@@ -1015,6 +1015,40 @@
1015
1015
  origEvent.dataTransfer.setDragImage(ghostNode, xOffset, yOffset);
1016
1016
  }
1017
1017
  },
1018
+ // get the level amount of a hierachy
1019
+ getUpperLevel: function ($node) {
1020
+ if (!$node.is('.node')) {
1021
+ return 0;
1022
+ }
1023
+ return $node.parents('.hierarchy').length;
1024
+ },
1025
+ // get the level amount of a hierachy
1026
+ getLowerLevel: function ($node) {
1027
+ if (!$node.is('.node')) {
1028
+ return 0;
1029
+ }
1030
+ return $node.closest('.hierarchy').find('.nodes').length + 1;
1031
+ },
1032
+ // get nodes in level order traversal
1033
+ getLevelOrderNodes: function ($root) {
1034
+ if(!$root) return [];
1035
+ var queue = [];
1036
+ var output = [];
1037
+ queue.push($root);
1038
+ while(queue.length) {
1039
+ var row = [];
1040
+ for(var i = 0; i < queue.length; i++) {
1041
+ var cur = queue.shift();
1042
+ var children = this.getChildren(cur);
1043
+ if(children.length) {
1044
+ queue.push(children.toArray().flat());
1045
+ }
1046
+ row.push($(cur));
1047
+ }
1048
+ output.push(row);
1049
+ }
1050
+ return output;
1051
+ },
1018
1052
  //
1019
1053
  filterAllowedDropNodes: function ($dragged) {
1020
1054
  var opts = this.options;
@@ -1,2 +1,2 @@
1
- "use strict";!function(e){"object"==typeof module&&"object"==typeof module.exports?e(require("jquery"),window,document):e(jQuery,window,document)}(function(p,u,f,d){function t(e,t){this.$chartContainer=p(e),this.opts=t,this.defaultOptions={nodeTitle:"name",nodeId:"id",toggleSiblingsResp:!1,visibleLevel:999,chartClass:"",exportButton:!1,exportButtonName:"Export",exportFilename:"OrgChart",exportFileextension:"png",parentNodeSymbol:"oci-leader",draggable:!1,direction:"t2b",pan:!1,zoom:!1,zoominLimit:7,zoomoutLimit:.5}}t.prototype={init:function(e){var n=this;this.options=p.extend({},this.defaultOptions,this.opts,e);var t=this.$chartContainer;this.$chart&&this.$chart.remove();var i=this.options.data,s=this.$chart=p("<div>",{data:{options:this.options},class:"orgchart"+(""!==this.options.chartClass?" "+this.options.chartClass:"")+("t2b"!==this.options.direction?" "+this.options.direction:""),click:function(e){p(e.target).closest(".node").length||s.find(".node.focused").removeClass("focused")}});"undefined"!=typeof MutationObserver&&this.triggerInitEvent();var o=s.append(p('<ul class="nodes"><li class="hierarchy"></li></ul>')).find(".hierarchy");return"object"===p.type(i)?i instanceof p?this.buildHierarchy(o,this.buildJsonDS(i.children()),0,this.options):this.buildHierarchy(o,this.options.ajaxURL?i:this.attachRel(i,"00")):(s.append('<i class="oci oci-spinner spinner"></i>'),p.ajax({url:i,dataType:"json"}).done(function(e,t,i){n.buildHierarchy(o,n.options.ajaxURL?e:n.attachRel(e,"00"),0,n.options)}).fail(function(e,t,i){console.log(i)}).always(function(){s.children(".spinner").remove()})),t.append(s),this.options.exportButton&&!p(".oc-export-btn").length&&this.attachExportButton(),this.options.pan&&this.bindPan(),this.options.zoom&&this.bindZoom(),this},triggerInitEvent:function(){var s=this,o=new MutationObserver(function(e){o.disconnect();e:for(var t=0;t<e.length;t++)for(var i=0;i<e[t].addedNodes.length;i++)if(e[t].addedNodes[i].classList.contains("orgchart")){s.options.initCompleted&&"function"==typeof s.options.initCompleted&&s.options.initCompleted(s.$chart);var n=p.Event("init.orgchart");s.$chart.trigger(n);break e}});o.observe(this.$chartContainer[0],{childList:!0})},triggerLoadEvent:function(e,t){var i=p.Event("load-"+t+".orgchart");e.trigger(i)},triggerShowEvent:function(e,t){var i=p.Event("show-"+t+".orgchart");e.trigger(i)},triggerHideEvent:function(e,t){var i=p.Event("hide-"+t+".orgchart");e.trigger(i)},attachExportButton:function(){var t=this,e=p("<button>",{class:"oc-export-btn",text:this.options.exportButtonName,click:function(e){e.preventDefault(),t.export()}});this.$chartContainer.after(e)},setOptions:function(e,t){return"string"==typeof e&&("pan"===e&&(t?this.bindPan():this.unbindPan()),"zoom"===e&&(t?this.bindZoom():this.unbindZoom())),"object"==typeof e&&(e.data?this.init(e):(void 0!==e.pan&&(e.pan?this.bindPan():this.unbindPan()),void 0!==e.zoom&&(e.zoom?this.bindZoom():this.unbindZoom()))),this},panStartHandler:function(e){var o=p(e.delegateTarget);if(p(e.target).closest(".node").length||e.touches&&1<e.touches.length)o.data("panning",!1);else{o.css("cursor","move").data("panning",!0);var t=0,i=0,n=o.css("transform");if("none"!==n){var s=n.split(",");i=-1===n.indexOf("3d")?(t=parseInt(s[4]),parseInt(s[5])):(t=parseInt(s[12]),parseInt(s[13]))}var a=0,r=0;if(e.targetTouches){if(1===e.targetTouches.length)a=e.targetTouches[0].pageX-t,r=e.targetTouches[0].pageY-i;else if(1<e.targetTouches.length)return}else a=e.pageX-t,r=e.pageY-i;o.on("mousemove touchmove",function(e){if(o.data("panning")){var t=0,i=0;if(e.targetTouches){if(1===e.targetTouches.length)t=e.targetTouches[0].pageX-a,i=e.targetTouches[0].pageY-r;else if(1<e.targetTouches.length)return}else t=e.pageX-a,i=e.pageY-r;var n=o.css("transform");if("none"===n)-1===n.indexOf("3d")?o.css("transform","matrix(1, 0, 0, 1, "+t+", "+i+")"):o.css("transform","matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, "+t+", "+i+", 0, 1)");else{var s=n.split(",");-1===n.indexOf("3d")?(s[4]=" "+t,s[5]=" "+i+")"):(s[12]=" "+t,s[13]=" "+i),o.css("transform",s.join(","))}}})}},panEndHandler:function(e){e.data.chart.data("panning")&&e.data.chart.data("panning",!1).css("cursor","default").off("mousemove")},bindPan:function(){this.$chartContainer.css("overflow","hidden"),this.$chart.on("mousedown touchstart",this.panStartHandler),p(f).on("mouseup touchend",{chart:this.$chart},this.panEndHandler)},unbindPan:function(){this.$chartContainer.css("overflow","auto"),this.$chart.off("mousedown touchstart",this.panStartHandler),p(f).off("mouseup touchend",this.panEndHandler)},zoomWheelHandler:function(e){var t=e.data.oc;e.preventDefault();var i=1+(0<e.originalEvent.deltaY?-.2:.2);t.setChartScale(t.$chart,i)},zoomStartHandler:function(e){if(e.touches&&2===e.touches.length){var t=e.data.oc;t.$chart.data("pinching",!0);var i=t.getPinchDist(e);t.$chart.data("pinchDistStart",i)}},zoomingHandler:function(e){var t=e.data.oc;if(t.$chart.data("pinching")){var i=t.getPinchDist(e);t.$chart.data("pinchDistEnd",i)}},zoomEndHandler:function(e){var t=e.data.oc;if(t.$chart.data("pinching")){t.$chart.data("pinching",!1);var i=t.$chart.data("pinchDistEnd")-t.$chart.data("pinchDistStart");0<i?t.setChartScale(t.$chart,1.2):i<0&&t.setChartScale(t.$chart,.8)}},bindZoom:function(){this.$chartContainer.on("wheel",{oc:this},this.zoomWheelHandler),this.$chartContainer.on("touchstart",{oc:this},this.zoomStartHandler),p(f).on("touchmove",{oc:this},this.zoomingHandler),p(f).on("touchend",{oc:this},this.zoomEndHandler)},unbindZoom:function(){this.$chartContainer.off("wheel",this.zoomWheelHandler),this.$chartContainer.off("touchstart",this.zoomStartHandler),p(f).off("touchmove",this.zoomingHandler),p(f).off("touchend",this.zoomEndHandler)},getPinchDist:function(e){return Math.sqrt((e.touches[0].clientX-e.touches[1].clientX)*(e.touches[0].clientX-e.touches[1].clientX)+(e.touches[0].clientY-e.touches[1].clientY)*(e.touches[0].clientY-e.touches[1].clientY))},setChartScale:function(e,t){var i=e.data("options"),n=e.css("transform"),s="",o=1;"none"===n?e.css("transform","scale("+t+","+t+")"):(s=n.split(","),-1===n.indexOf("3d")?(o=Math.abs(u.parseFloat(s[3])*t))>i.zoomoutLimit&&o<i.zoominLimit&&e.css("transform",n+" scale("+t+","+t+")"):(o=Math.abs(u.parseFloat(s[1])*t))>i.zoomoutLimit&&o<i.zoominLimit&&e.css("transform",n+" scale3d("+t+","+t+", 1)"))},buildJsonDS:function(e){var t=this,i={name:e.contents().eq(0).text().trim(),relationship:(e.parent().parent().is("li")?"1":"0")+(e.siblings("li").length?1:0)+(e.children("ul").length?1:0)};return p.each(e.data(),function(e,t){i[e]=t}),e.children("ul").children().each(function(){i.children||(i.children=[]),i.children.push(t.buildJsonDS(p(this)))}),i},attachRel:function(t,e){var i=this;return t.relationship=e+(t.children&&0<t.children.length?1:0),t.children&&t.children.forEach(function(e){i.attachRel(e,"1"+(1<t.children.length?1:0))}),t},loopChart:function(e,t){t=null!==t&&t!==d&&t;var i=this,n=e.find(".node:first"),s={id:n[0].id};return t&&p.each(n.data("nodeData"),function(e,t){s[e]=t}),n.siblings(".nodes").children().each(function(){s.children||(s.children=[]),s.children.push(i.loopChart(p(this),t))}),s},getHierarchy:function(e){if(e=null!==e&&e!==d&&e,void 0===this.$chart)return"Error: orgchart does not exist";if(!this.$chart.find(".node").length)return"Error: nodes do not exist";var t=!0;return this.$chart.find(".node").each(function(){if(!this.id)return t=!1}),t?this.loopChart(this.$chart,e):"Error: All nodes of orghcart to be exported must have data-id attribute!"},getNodeState:function(e,t){var i={},n=!!e.closest("vertical").length;if("parent"===(t=t||"self")){if(n?(i=e.closest("ul").parents("ul")).length||(i=e.closest(".nodes")).length||(i=e.closest(".vertical").siblings(":first")):i=e.closest(".nodes").siblings(".node"),i.length)return i.is(".hidden")||!i.is(".hidden")&&i.closest(".nodes").is(".hidden")||!i.is(".hidden")&&i.closest(".vertical").is(".hidden")?{exist:!0,visible:!1}:{exist:!0,visible:!0}}else if("children"===t){if((i=n?e.parent().children("ul"):e.siblings(".nodes")).length)return i.is(".hidden")?{exist:!0,visible:!1}:{exist:!0,visible:!0}}else if("siblings"===t){if((i=n?e.closest("ul"):e.parent().siblings()).length&&(!n||1<i.children("li").length))return i.is(".hidden")||i.parent().is(".hidden")||n&&i.closest(".vertical").is(".hidden")?{exist:!0,visible:!1}:{exist:!0,visible:!0}}else if((i=e).length)return i.closest(".nodes").length&&i.closest(".nodes").is(".hidden")||i.closest(".hierarchy").length&&i.closest(".hierarchy").is(".hidden")||i.closest(".vertical").length&&(i.closest(".nodes").is(".hidden")||i.closest(".vertical").is(".hidden"))?{exist:!0,visible:!1}:{exist:!0,visible:!0};return{exist:!1,visible:!1}},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()}});
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)},getUpperLevel:function(e){return e.is(".node")?e.parents(".hierarchy").length:0},getLowerLevel:function(e){return e.is(".node")?e.closest(".hierarchy").find(".nodes").length+1:0},getLevelOrderNodes:function(e){if(!e)return[];var t=[],i=[];for(t.push(e);t.length;){for(var n=[],s=0;s<t.length;s++){var o=t.shift(),a=this.getChildren(o);a.length&&t.push(a.toArray().flat()),n.push(p(o))}i.push(n)}return i},filterAllowedDropNodes:function(i){var n=this.options,s=i.closest("[draggable]").hasClass("node"),o=i.closest(".nodes").siblings(".node"),a=i.closest(".hierarchy").find(".node");this.$chart.data("dragged",i).find(".node").each(function(e,t){s&&-1!==a.index(t)||(n.dropCriteria?n.dropCriteria(i,o,p(t))&&p(t).addClass("allowedDrop"):p(t).addClass("allowedDrop"))})},dragstartHandler:function(e){e.originalEvent.dataTransfer.setData("text/html","hack for firefox"),"none"!==this.$chart.css("transform")&&this.createGhostNode(e),this.filterAllowedDropNodes(p(e.target))},dragoverHandler:function(e){p(e.delegateTarget).is(".allowedDrop")?e.preventDefault():e.originalEvent.dataTransfer.dropEffect="none"},dragendHandler:function(e){this.$chart.find(".allowedDrop").removeClass("allowedDrop")},dropHandler:function(e){var t=p(e.delegateTarget),i=this.$chart.data("dragged");if(i.hasClass("node")){if(t.hasClass("allowedDrop")){var n=i.closest(".nodes").siblings(".node"),s=p.Event("nodedrop.orgchart");if(this.$chart.trigger(s,{draggedNode:i,dragZone:n,dropZone:t}),!s.isDefaultPrevented()){if(t.siblings(".nodes").length){var o='<i class="edge horizontalEdge rightEdge oci"></i><i class="edge horizontalEdge leftEdge oci"></i>';i.find(".horizontalEdge").length||i.append(o),t.siblings(".nodes").append(i.closest(".hierarchy"));var a=i.closest(".hierarchy").siblings().find(".node:first");1===a.length&&a.append(o)}else t.append('<i class="edge verticalEdge bottomEdge oci"></i>').after('<ul class="nodes"></ul>').siblings(".nodes").append(i.find(".horizontalEdge").remove().end().closest(".hierarchy")),t.children(".title").length&&t.children(".title").prepend('<i class="oci '+this.$chart.data("options").parentNodeSymbol+' symbol"></i>');1===n.siblings(".nodes").children(".hierarchy").length?n.siblings(".nodes").children(".hierarchy").find(".node:first").find(".horizontalEdge").remove():0===n.siblings(".nodes").children(".hierarchy").length&&n.find(".bottomEdge, .symbol").remove().end().siblings(".nodes").remove()}}}else this.$chart.triggerHandler({type:"otherdropped.orgchart",draggedItem:i,dropZone:t})},touchstartHandler:function(e){this.touchHandled||e.touches&&1<e.touches.length||(this.touchHandled=!0,this.touchMoved=!1,e.preventDefault())},touchmoveHandler:function(e){if(this.touchHandled&&!(e.touches&&1<e.touches.length)){e.preventDefault(),this.touchMoved||(this.filterAllowedDropNodes(p(e.currentTarget)),this.touchDragImage=this.createDragImage(e,this.$chart.data("dragged")[0])),this.touchMoved=!0,this.moveDragImage(e,this.touchDragImage);var t=p(f.elementFromPoint(e.touches[0].clientX,e.touches[0].clientY)).closest("div.node");if(0<t.length){var i=t[0];t.is(".allowedDrop")?this.touchTargetNode=i:this.touchTargetNode=null}else this.touchTargetNode=null}},touchendHandler:function(e){if(this.touchHandled){if(this.destroyDragImage(),this.touchMoved){if(this.touchTargetNode){var t={delegateTarget:this.touchTargetNode};this.dropHandler(t),this.touchTargetNode=null}this.dragendHandler(e)}else{var i=e.changedTouches[0],n=f.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,u,1,i.screenX,i.screenY,i.clientX,i.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,0,null),e.target.dispatchEvent(n)}this.touchHandled=!1}},createDragImage:function(e,t){var i=t.cloneNode(!0);this.copyStyle(t,i),i.style.top=i.style.left="-9999px";var n=t.getBoundingClientRect(),s=this.getTouchPoint(e);return this.touchDragImageOffset={x:s.x-n.left,y:s.y-n.top},i.style.opacity="0.5",f.body.appendChild(i),i},destroyDragImage:function(){this.touchDragImage&&this.touchDragImage.parentElement&&this.touchDragImage.parentElement.removeChild(this.touchDragImage),this.touchDragImageOffset=null,this.touchDragImage=null},copyStyle:function(e,t){if(["id","class","style","draggable"].forEach(function(e){t.removeAttribute(e)}),e instanceof HTMLCanvasElement){var i=e,n=t;n.width=i.width,n.height=i.height,n.getContext("2d").drawImage(i,0,0)}for(var s=getComputedStyle(e),o=0;o<s.length;o++){var a=s[o];a.indexOf("transition")<0&&(t.style[a]=s[a])}t.style.pointerEvents="none";for(o=0;o<e.children.length;o++)this.copyStyle(e.children[o],t.children[o])},getTouchPoint:function(e){return e&&e.touches&&(e=e.touches[0]),{x:e.clientX,y:e.clientY}},moveDragImage:function(i,n){if(i&&n){var s=this;requestAnimationFrame(function(){var e=s.getTouchPoint(i),t=n.style;t.position="absolute",t.pointerEvents="none",t.zIndex="999999",s.touchDragImageOffset&&(t.left=Math.round(e.x-s.touchDragImageOffset.x)+"px",t.top=Math.round(e.y-s.touchDragImageOffset.y)+"px")})}},bindDragDrop:function(e){e.on("dragstart",this.dragstartHandler.bind(this)).on("dragover",this.dragoverHandler.bind(this)).on("dragend",this.dragendHandler.bind(this)).on("drop",this.dropHandler.bind(this)).on("touchstart",this.touchstartHandler.bind(this)).on("touchmove",this.touchmoveHandler.bind(this)).on("touchend",this.touchendHandler.bind(this))},createNode:function(i){var n=this.options,e=i.level;i.children&&i[n.nodeId]&&p.each(i.children,function(e,t){t.parentId=i[n.nodeId]});var t=p("<div"+(n.draggable?' draggable="true"':"")+(i[n.nodeId]?' id="'+i[n.nodeId]+'"':"")+(i.parentId?' data-parent="'+i.parentId+'"':"")+">").addClass("node "+(i.className||"")+(e>n.visibleLevel?" slide-up":""));n.nodeTemplate?t.append(n.nodeTemplate(i)):t.append('<div class="title">'+i[n.nodeTitle]+"</div>").append(void 0!==n.nodeContent?'<div class="content">'+(i[n.nodeContent]||"")+"</div>":"");var s=p.extend({},i);delete s.children,t.data("nodeData",s);var o=i.relationship||"";return n.verticalLevel&&e>=n.verticalLevel?e+1>n.verticalLevel&&Number(o.substr(2,1))&&t.append('<i class="toggleBtn oci"></i>').children(".title").prepend('<i class="oci '+n.parentNodeSymbol+' symbol"></i>'):(Number(o.substr(0,1))&&t.append('<i class="edge verticalEdge topEdge oci"></i>'),Number(o.substr(1,1))&&t.append('<i class="edge horizontalEdge rightEdge oci"></i><i class="edge horizontalEdge leftEdge oci"></i>'),Number(o.substr(2,1))&&t.append('<i class="edge verticalEdge bottomEdge oci"></i>').children(".title").prepend('<i class="oci '+n.parentNodeSymbol+' symbol"></i>')),t.on("mouseenter mouseleave",this.nodeEnterLeaveHandler.bind(this)),t.on("click",this.nodeClickHandler.bind(this)),t.on("click",".topEdge",this.topEdgeClickHandler.bind(this)),t.on("click",".bottomEdge",this.bottomEdgeClickHandler.bind(this)),t.on("click",".leftEdge, .rightEdge",this.hEdgeClickHandler.bind(this)),t.on("click",".toggleBtn",this.toggleVNodes.bind(this)),n.draggable&&(this.bindDragDrop(t),this.touchHandled=!1,this.touchMoved=!1,this.touchTargetNode=null),n.createNode&&n.createNode(t,i),t},buildHierarchy:function(e,t){var i=this,n=this.options,s=0;if(s=t.level?t.level:t.level=e.parentsUntil(".orgchart",".nodes").length,2<Object.keys(t).length){var o=this.createNode(t);n.verticalLevel&&n.verticalLevel,e.append(o)}if(t.children&&t.children.length){var a,r=s+1>n.visibleLevel||t.collapsed!==d&&t.collapsed;n.verticalLevel&&s+1>=n.verticalLevel?(a=p('<ul class="nodes">'),r&&s+1>=n.verticalLevel&&a.addClass("hidden"),s+1===n.verticalLevel?e.addClass("hybrid").append(a.addClass("vertical")):e.append(a)):(a=p('<ul class="nodes'+(r?" hidden":"")+'">'),2===Object.keys(t).length||r&&e.addClass("isChildrenCollapsed"),e.append(a)),p.each(t.children,function(){var e=p('<li class="hierarchy">');a.append(e),this.level=s+1,i.buildHierarchy(e,this)})}},buildChildNode:function(e,t){this.buildHierarchy(e,{children:t})},addChildren:function(e,t){this.buildChildNode(e.closest(".hierarchy"),t),e.find(".symbol").length||e.children(".title").prepend('<i class="oci '+this.options.parentNodeSymbol+' symbol"></i>'),e.closest(".nodes.vertical").length?e.children(".toggleBtn").length||e.append('<i class="toggleBtn oci"></i>'):e.children(".bottomEdge").length||e.append('<i class="edge verticalEdge bottomEdge oci"></i>'),this.isInAction(e)&&this.switchVerticalArrow(e.children(".bottomEdge"))},buildParentNode:function(e,t){t.relationship=t.relationship||"001";var i=p('<ul class="nodes"><li class="hierarchy"></li></ul>').find(".hierarchy").append(this.createNode(t)).end();this.$chart.prepend(i).find(".hierarchy:first").append(e.closest("ul").addClass("nodes"))},addParent:function(e,t){this.buildParentNode(e,t),e.children(".topEdge").length||e.children(".title").after('<i class="edge verticalEdge topEdge oci"></i>'),this.isInAction(e)&&this.switchVerticalArrow(e.children(".topEdge"))},buildSiblingNode:function(e,t){var i=p.isArray(t)?t.length:t.children.length,n=e.parent().is(".nodes")?e.siblings().length+1:1,s=n+i,o=1<s?Math.floor(s/2-1):0;if(e.closest(".nodes").parent().is(".hierarchy")){this.buildChildNode(e.parent().closest(".hierarchy"),t);var a=e.parent().closest(".hierarchy").children(".nodes:last").children(".hierarchy");1<n?a.eq(0).before(e.siblings().addBack().unwrap()):a.eq(o).after(e.unwrap())}else this.buildHierarchy(e.parent().prepend(p('<li class="hierarchy">')).children(".hierarchy:first"),t),e.prevAll(".hierarchy").children(".nodes").children().eq(o).after(e)},addSiblings:function(e,t){this.buildSiblingNode(e.closest(".hierarchy"),t),e.closest(".nodes").data("siblingsLoaded",!0),e.children(".leftEdge").length||e.children(".topEdge").after('<i class="edge horizontalEdge rightEdge oci"></i><i class="edge horizontalEdge leftEdge oci"></i>'),this.isInAction(e)&&(this.switchHorizontalArrow(e),e.children(".topEdge").removeClass("oci-chevron-up").addClass("oci-chevron-down"))},removeNodes:function(e){var t=e.closest(".hierarchy").parent();t.parent().is(".hierarchy")?this.getNodeState(e,"siblings").exist?(e.closest(".hierarchy").remove(),1===t.children().length&&t.find(".node:first .horizontalEdge").remove()):t.siblings(".node").find(".bottomEdge").remove().end().end().remove():t.closest(".orgchart").remove()},hideDropZones:function(){this.$chart.find(".allowedDrop").removeClass("allowedDrop")},showDropZones:function(e){this.$chart.find(".node").each(function(e,t){p(t).addClass("allowedDrop")}),this.$chart.data("dragged",p(e))},processExternalDrop:function(e,t){t&&this.$chart.data("dragged",p(t)),e.closest(".node").triggerHandler({type:"drop"})},exportPDF:function(e,t){var i={},n=Math.floor(e.width),s=Math.floor(e.height);u.jsPDF||(u.jsPDF=u.jspdf.jsPDF),(i=s<n?new jsPDF({orientation:"landscape",unit:"px",format:[n,s]}):new jsPDF({orientation:"portrait",unit:"px",format:[s,n]})).addImage(e.toDataURL(),"png",0,0),i.save(t+".pdf")},exportPNG:function(e,t){var i="WebkitAppearance"in f.documentElement.style,n=!!u.sidebar,s="Microsoft Internet Explorer"===navigator.appName||"Netscape"===navigator.appName&&-1<navigator.appVersion.indexOf("Edge"),o=this.$chartContainer;if(!i&&!n||s)u.navigator.msSaveBlob(e.msToBlob(),t+".png");else{var a=".oci-download-btn"+(""!==this.options.chartClass?"."+this.options.chartClass:"");o.find(a).length||o.append('<a class="oci-download-btn'+(""!==this.options.chartClass?" "+this.options.chartClass:"")+'" download="'+t+'.png"></a>'),o.find(a).attr("href",e.toDataURL())[0].click()}},export:function(t,i){var n=this;if(t=void 0!==t?t:this.options.exportFilename,i=void 0!==i?i:this.options.exportFileextension,p(this).children(".spinner").length)return!1;var s=this.$chartContainer,e=s.find(".mask");e.length?e.removeClass("hidden"):s.append('<div class="mask"><i class="oci oci-spinner spinner"></i></div>');var o=s.addClass("canvasContainer").find('.orgchart:not(".hidden")').get(0),a="l2r"===n.options.direction||"r2l"===n.options.direction;html2canvas(o,{width:a?o.clientHeight:o.clientWidth,height:a?o.clientWidth:o.clientHeight,onclone:function(e){p(e).find(".canvasContainer").css("overflow","visible").find('.orgchart:not(".hidden"):first').css("transform","")}}).then(function(e){s.find(".mask").addClass("hidden"),"pdf"===i.toLowerCase()?n.exportPDF(e,t):n.exportPNG(e,t),s.removeClass("canvasContainer")},function(){s.removeClass("canvasContainer")})}},p.fn.orgchart=function(e){return new t(this,e).init()}});
2
2
  //# sourceMappingURL=jquery.orgchart.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["jquery.orgchart.js"],"names":["factory","module","exports","require","window","document","jQuery","$","undefined","OrgChart","elem","opts","this","$chartContainer","defaultOptions","nodeTitle","nodeId","toggleSiblingsResp","visibleLevel","chartClass","exportButton","exportButtonName","exportFilename","exportFileextension","parentNodeSymbol","draggable","direction","pan","zoom","zoominLimit","zoomoutLimit","prototype","init","that","options","extend","$chart","remove","data","class","click","event","target","closest","length","find","removeClass","MutationObserver","triggerInitEvent","$root","append","type","buildHierarchy","buildJsonDS","children","ajaxURL","attachRel","ajax","url","dataType","done","textStatus","jqXHR","fail","errorThrown","console","log","always","attachExportButton","bindPan","bindZoom","mo","mutations","disconnect","initTime","i","j","addedNodes","classList","contains","initCompleted","initEvent","Event","trigger","observe","childList","triggerLoadEvent","$target","rel","triggerShowEvent","triggerHideEvent","$exportBtn","text","e","preventDefault","export","after","setOptions","val","unbindPan","unbindZoom","panStartHandler","delegateTarget","touches","css","lastX","lastY","lastTf","temp","split","indexOf","parseInt","startX","startY","targetTouches","pageX","pageY","on","newX","newY","matrix","join","panEndHandler","chart","off","zoomWheelHandler","oc","newScale","originalEvent","deltaY","setChartScale","zoomStartHandler","dist","getPinchDist","zoomingHandler","zoomEndHandler","diff","Math","sqrt","clientX","clientY","targetScale","abs","parseFloat","$li","subObj","name","contents","eq","trim","relationship","parent","is","siblings","each","key","value","push","flags","forEach","item","loopChart","includeNodeData","$node","id","getHierarchy","valid","getNodeState","relation","isVerticalNode","parents","exist","visible","getParent","getRelatedNodes","getChildren","getSiblings","hideParentEnd","addClass","hideParent","$parent","hideSiblings","one","showParentEnd","node","isInAction","switchVerticalArrow","showParent","repaint","bind","stopAjax","$nodeLevel","isVisibleNode","index","hideChildrenEnd","animatedNodes","hideChildren","$lowerLevel","$animatedNodes","filter","get","lowerLevel","showChildrenEnd","showChildren","$levels","isVerticalDesc","hideSiblingsEnd","$nodeContainer","nodeContainer","$siblings","prevAll","nextAll","end","switchHorizontalArrow","showSiblingsEnd","visibleNodes","showRelatedParentEnd","showSiblings","$upperLevel","$visibleNodes","startLoading","$edge","not","prop","endLoading","removeAttr","attr","$arrow","toggleClass","$prevSib","prev","$nextSib","next","$sibs","sibsVisible","style","offsetWidth","nodeEnterLeaveHandler","flag","$toggleBtn","$topEdge","$bottomEdge","$leftEdge","nodeClickHandler","loadNodes","isEmptyObject","addParent","addChildren","addSiblings","HideFirstParentEnd","topEdge","topEdgeClickHandler","stopPropagation","parentState","isFunction","bottomEdgeClickHandler","childrenState","hEdgeClickHandler","$hEdge","siblingsState","families","expandVNodesEnd","vNodes","collapseVNodesEnd","toggleVNodes","$descWrapper","$descendants","$children","createGhostNode","ghostNode","nodeCover","$nodeDiv","origEvent","isFirefox","test","navigator","userAgent","toLowerCase","querySelector","createElementNS","add","appendChild","transValues","isHorizontal","scale","slice","setAttribute","outerWidth","outerHeight","xOffset","offsetX","yOffset","offsetY","ghostNodeWrapper","createElement","src","XMLSerializer","serializeToString","dataTransfer","setDragImage","filterAllowedDropNodes","$dragged","draggingNode","hasClass","$dragZone","$dragHier","dropCriteria","dragstartHandler","setData","dragoverHandler","dropEffect","dragendHandler","dropHandler","$dropZone","dropEvent","draggedNode","dragZone","dropZone","isDefaultPrevented","horizontalEdges","$dropSibs","prepend","triggerHandler","draggedItem","touchstartHandler","touchHandled","touchMoved","touchmoveHandler","currentTarget","touchDragImage","createDragImage","moveDragImage","$touchingNodes","elementFromPoint","touchingNodeElement","touchTargetNode","touchendHandler","destroyDragImage","fakeEventForDropHandler","firstTouch","changedTouches","fakeMouseClickEvent","createEvent","initMouseEvent","screenX","screenY","ctrlKey","altKey","shiftKey","metaKey","dispatchEvent","source","dragImage","cloneNode","copyStyle","top","left","sourceRectangle","getBoundingClientRect","sourcePoint","getTouchPoint","touchDragImageOffset","x","y","opacity","body","parentElement","removeChild","dst","att","removeAttribute","HTMLCanvasElement","cSrc","cDst","width","height","getContext","drawImage","cs","getComputedStyle","pointerEvents","image","orgChartMaster","requestAnimationFrame","pt","s","position","zIndex","round","bindDragDrop","createNode","level","child","parentId","className","nodeTemplate","nodeContent","nodeData","verticalLevel","Number","substr","$appendTo","parentsUntil","Object","keys","$nodesLayer","isHidden","collapsed","$nodeCell","buildChildNode","buildParentNode","$currentRoot","$newRootWrapper","buildSiblingNode","$nodeChart","newSiblingCount","isArray","existingSibligCount","siblingCount","insertPostion","floor","before","addBack","unwrap","removeNodes","$wrapper","hideDropZones","showDropZones","dragged","processExternalDrop","exportPDF","canvas","doc","docWidth","docHeight","jsPDF","jspdf","orientation","unit","format","addImage","toDataURL","save","exportPNG","isWebkit","documentElement","isFf","sidebar","isEdge","appName","appVersion","msSaveBlob","msToBlob","selector","$mask","sourceChart","html2canvas","clientHeight","clientWidth","onclone","cloneDoc","then","fn","orgchart"],"mappings":"AAUA,cAEC,SAAUA,GACa,iBAAXC,QAAiD,iBAAnBA,OAAOC,QAC9CF,EAAQG,QAAQ,UAAWC,OAAQC,UAEnCL,EAAQM,OAAQF,OAAQC,UAJ5B,CAME,SAAUE,EAAGH,EAAQC,EAAUG,GAChB,SAAXC,EAAqBC,EAAMC,GAC7BC,KAAKC,gBAAkBN,EAAEG,GACzBE,KAAKD,KAAOA,EACZC,KAAKE,eAAiB,CACpBC,UAAa,OACbC,OAAU,KACVC,oBAAsB,EACtBC,aAAgB,IAChBC,WAAc,GACdC,cAAgB,EAChBC,iBAAoB,SACpBC,eAAkB,WAClBC,oBAAuB,MACvBC,iBAAoB,aACpBC,WAAa,EACbC,UAAa,MACbC,KAAO,EACPC,MAAQ,EACRC,YAAe,EACfC,aAAgB,IAIpBrB,EAASsB,UAAY,CAEnBC,KAAM,SAAUrB,GACd,IAAIsB,EAAOrB,KACXA,KAAKsB,QAAU3B,EAAE4B,OAAO,GAAIvB,KAAKE,eAAgBF,KAAKD,KAAMA,GAE5D,IAAIE,EAAkBD,KAAKC,gBACvBD,KAAKwB,QACPxB,KAAKw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GAAU/Z,KAAK,oBAAoB2D,IAAI,WAAY,WAClD3D,KAAK,kCAAkC2D,IAAI,YAAa,OAG9DqW,KAAK,SAAU9B,GACdla,EAAgBgC,KAAK,SAASqI,SAAS,UAEG,QAAtC3J,EAAoB8P,cACtBpP,EAAK6Y,UAAUC,EAAQzZ,GAEvBW,EAAK0Z,UAAUZ,EAAQzZ,GAGzBT,EAAgBiC,YAAY,oBAC3B,WACDjC,EAAgBiC,YAAY,uBAKlCvC,EAAEuc,GAAGC,SAAW,SAAUpc,GACxB,OAAO,IAAIF,EAASG,KAAMD,GAAMqB","file":"jquery.orgchart.min.js","sourcesContent":["/*\n * jQuery OrgChart Plugin\n * https://github.com/dabeng/OrgChart\n *\n * Copyright 2016, dabeng\n * https://github.com/dabeng\n *\n * Licensed under the MIT license:\n * http://www.opensource.org/licenses/MIT\n */\n'use strict';\n\n(function (factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n factory(require('jquery'), window, document);\n } else {\n factory(jQuery, window, document);\n }\n}(function ($, window, document, undefined) {\n var OrgChart = function (elem, opts) {\n this.$chartContainer = $(elem);\n this.opts = opts;\n this.defaultOptions = {\n 'nodeTitle': 'name',\n 'nodeId': 'id',\n 'toggleSiblingsResp': false,\n 'visibleLevel': 999,\n 'chartClass': '',\n 'exportButton': false,\n 'exportButtonName': 'Export',\n 'exportFilename': 'OrgChart',\n 'exportFileextension': 'png',\n 'parentNodeSymbol': 'oci-leader',\n 'draggable': false,\n 'direction': 't2b',\n 'pan': false,\n 'zoom': false,\n 'zoominLimit': 7,\n 'zoomoutLimit': 0.5\n };\n };\n //\n OrgChart.prototype = {\n //\n init: function (opts) {\n var that = this;\n this.options = $.extend({}, this.defaultOptions, this.opts, opts);\n // build the org-chart\n var $chartContainer = this.$chartContainer;\n if (this.$chart) {\n this.$chart.remove();\n }\n var data = this.options.data;\n var $chart = this.$chart = $('<div>', {\n 'data': { 'options': this.options },\n 'class': 'orgchart' + (this.options.chartClass !== '' ? ' ' + this.options.chartClass : '') + (this.options.direction !== 't2b' ? ' ' + this.options.direction : ''),\n 'click': function(event) {\n if (!$(event.target).closest('.node').length) {\n $chart.find('.node.focused').removeClass('focused');\n }\n }\n });\n if (typeof MutationObserver !== 'undefined') {\n this.triggerInitEvent();\n }\n var $root = $chart.append($('<ul class=\"nodes\"><li class=\"hierarchy\"></li></ul>')).find('.hierarchy');\n if ($.type(data) === 'object') {\n if (data instanceof $) { // ul datasource\n this.buildHierarchy($root, this.buildJsonDS(data.children()), 0, this.options);\n } else { // local json datasource\n this.buildHierarchy($root, this.options.ajaxURL ? data : this.attachRel(data, '00'));\n }\n } else {\n $chart.append('<i class=\"oci oci-spinner spinner\"></i>');\n $.ajax({\n 'url': data,\n 'dataType': 'json'\n })\n .done(function(data, textStatus, jqXHR) {\n that.buildHierarchy($root, that.options.ajaxURL ? data : that.attachRel(data, '00'), 0, that.options);\n })\n .fail(function(jqXHR, textStatus, errorThrown) {\n console.log(errorThrown);\n })\n .always(function() {\n $chart.children('.spinner').remove();\n });\n }\n $chartContainer.append($chart);\n\n // append the export button\n if (this.options.exportButton && !$('.oc-export-btn').length) {\n this.attachExportButton();\n }\n\n if (this.options.pan) {\n this.bindPan();\n }\n\n if (this.options.zoom) {\n this.bindZoom();\n }\n\n return this;\n },\n //\n triggerInitEvent: function () {\n var that = this;\n var mo = new MutationObserver(function (mutations) {\n mo.disconnect();\n initTime:\n for (var i = 0; i < mutations.length; i++) {\n for (var j = 0; j < mutations[i].addedNodes.length; j++) {\n if (mutations[i].addedNodes[j].classList.contains('orgchart')) {\n if (that.options.initCompleted && typeof that.options.initCompleted === 'function') {\n that.options.initCompleted(that.$chart);\n }\n var initEvent = $.Event('init.orgchart');\n that.$chart.trigger(initEvent);\n break initTime;\n }\n }\n }\n });\n mo.observe(this.$chartContainer[0], { childList: true });\n },\n triggerLoadEvent: function ($target, rel) {\n var initEvent = $.Event('load-' + rel +'.orgchart');\n $target.trigger(initEvent);\n },\n triggerShowEvent: function ($target, rel) {\n var initEvent = $.Event('show-' + rel + '.orgchart');\n $target.trigger(initEvent);\n },\n triggerHideEvent: function ($target, rel) {\n var initEvent = $.Event('hide-' + rel + '.orgchart');\n $target.trigger(initEvent);\n },\n // add export button for orgchart\n attachExportButton: function () {\n var that = this;\n var $exportBtn = $('<button>', {\n 'class': 'oc-export-btn',\n 'text': this.options.exportButtonName,\n 'click': function(e) {\n e.preventDefault();\n that.export();\n }\n });\n this.$chartContainer.after($exportBtn);\n },\n setOptions: function (opts, val) {\n if (typeof opts === 'string') {\n if (opts === 'pan') {\n if (val) {\n this.bindPan();\n } else {\n this.unbindPan();\n }\n }\n if (opts === 'zoom') {\n if (val) {\n this.bindZoom();\n } else {\n this.unbindZoom();\n }\n }\n }\n if (typeof opts === 'object') {\n if (opts.data) {\n this.init(opts);\n } else {\n if (typeof opts.pan !== 'undefined') {\n if (opts.pan) {\n this.bindPan();\n } else {\n this.unbindPan();\n }\n }\n if (typeof opts.zoom !== 'undefined') {\n if (opts.zoom) {\n this.bindZoom();\n } else {\n this.unbindZoom();\n }\n }\n }\n }\n\n return this;\n },\n //\n panStartHandler: function (e) {\n var $chart = $(e.delegateTarget);\n if ($(e.target).closest('.node').length || (e.touches && e.touches.length > 1)) {\n $chart.data('panning', false);\n return;\n } else {\n $chart.css('cursor', 'move').data('panning', true);\n }\n var lastX = 0;\n var lastY = 0;\n var lastTf = $chart.css('transform');\n if (lastTf !== 'none') {\n var temp = lastTf.split(',');\n if (lastTf.indexOf('3d') === -1) {\n lastX = parseInt(temp[4]);\n lastY = parseInt(temp[5]);\n } else {\n lastX = parseInt(temp[12]);\n lastY = parseInt(temp[13]);\n }\n }\n var startX = 0;\n var startY = 0;\n if (!e.targetTouches) { // pand on desktop\n startX = e.pageX - lastX;\n startY = e.pageY - lastY;\n } else if (e.targetTouches.length === 1) { // pan on mobile device\n startX = e.targetTouches[0].pageX - lastX;\n startY = e.targetTouches[0].pageY - lastY;\n } else if (e.targetTouches.length > 1) {\n return;\n }\n $chart.on('mousemove touchmove',function(e) {\n if (!$chart.data('panning')) {\n return;\n }\n var newX = 0;\n var newY = 0;\n if (!e.targetTouches) { // pand on desktop\n newX = e.pageX - startX;\n newY = e.pageY - startY;\n } else if (e.targetTouches.length === 1) { // pan on mobile device\n newX = e.targetTouches[0].pageX - startX;\n newY = e.targetTouches[0].pageY - startY;\n } else if (e.targetTouches.length > 1) {\n return;\n }\n var lastTf = $chart.css('transform');\n if (lastTf === 'none') {\n if (lastTf.indexOf('3d') === -1) {\n $chart.css('transform', 'matrix(1, 0, 0, 1, ' + newX + ', ' + newY + ')');\n } else {\n $chart.css('transform', 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, ' + newX + ', ' + newY + ', 0, 1)');\n }\n } else {\n var matrix = lastTf.split(',');\n if (lastTf.indexOf('3d') === -1) {\n matrix[4] = ' ' + newX;\n matrix[5] = ' ' + newY + ')';\n } else {\n matrix[12] = ' ' + newX;\n matrix[13] = ' ' + newY;\n }\n $chart.css('transform', matrix.join(','));\n }\n });\n },\n //\n panEndHandler: function (e) {\n if (e.data.chart.data('panning')) {\n e.data.chart.data('panning', false).css('cursor', 'default').off('mousemove');\n }\n },\n //\n bindPan: function () {\n this.$chartContainer.css('overflow', 'hidden');\n this.$chart.on('mousedown touchstart', this.panStartHandler);\n $(document).on('mouseup touchend', { 'chart': this.$chart }, this.panEndHandler);\n },\n //\n unbindPan: function () {\n this.$chartContainer.css('overflow', 'auto');\n this.$chart.off('mousedown touchstart', this.panStartHandler);\n $(document).off('mouseup touchend', this.panEndHandler);\n },\n //\n zoomWheelHandler: function (e) {\n var oc = e.data.oc;\n e.preventDefault();\n var newScale = 1 + (e.originalEvent.deltaY > 0 ? -0.2 : 0.2);\n oc.setChartScale(oc.$chart, newScale);\n },\n //\n zoomStartHandler: function (e) {\n if(e.touches && e.touches.length === 2) {\n var oc = e.data.oc;\n oc.$chart.data('pinching', true);\n var dist = oc.getPinchDist(e);\n oc.$chart.data('pinchDistStart', dist);\n }\n },\n zoomingHandler: function (e) {\n var oc = e.data.oc;\n if(oc.$chart.data('pinching')) {\n var dist = oc.getPinchDist(e);\n oc.$chart.data('pinchDistEnd', dist);\n }\n },\n zoomEndHandler: function (e) {\n var oc = e.data.oc;\n if(oc.$chart.data('pinching')) {\n oc.$chart.data('pinching', false);\n var diff = oc.$chart.data('pinchDistEnd') - oc.$chart.data('pinchDistStart');\n if (diff > 0) {\n oc.setChartScale(oc.$chart, 1.2);\n } else if (diff < 0) {\n oc.setChartScale(oc.$chart, 0.8);\n }\n }\n },\n //\n bindZoom: function () {\n this.$chartContainer.on('wheel', { 'oc': this }, this.zoomWheelHandler);\n this.$chartContainer.on('touchstart', { 'oc': this }, this.zoomStartHandler);\n $(document).on('touchmove', { 'oc': this }, this.zoomingHandler);\n $(document).on('touchend', { 'oc': this }, this.zoomEndHandler);\n },\n unbindZoom: function () {\n this.$chartContainer.off('wheel', this.zoomWheelHandler);\n this.$chartContainer.off('touchstart', this.zoomStartHandler);\n $(document).off('touchmove', this.zoomingHandler);\n $(document).off('touchend', this.zoomEndHandler);\n },\n //\n getPinchDist: function (e) {\n return Math.sqrt((e.touches[0].clientX - e.touches[1].clientX) * (e.touches[0].clientX - e.touches[1].clientX) +\n (e.touches[0].clientY - e.touches[1].clientY) * (e.touches[0].clientY - e.touches[1].clientY));\n },\n //\n setChartScale: function ($chart, newScale) {\n var opts = $chart.data('options');\n var lastTf = $chart.css('transform');\n var matrix = '';\n var targetScale = 1;\n if (lastTf === 'none') {\n $chart.css('transform', 'scale(' + newScale + ',' + newScale + ')');\n } else {\n matrix = lastTf.split(',');\n if (lastTf.indexOf('3d') === -1) {\n targetScale = Math.abs(window.parseFloat(matrix[3]) * newScale);\n if (targetScale > opts.zoomoutLimit && targetScale < opts.zoominLimit) {\n $chart.css('transform', lastTf + ' scale(' + newScale + ',' + newScale + ')');\n }\n } else {\n targetScale = Math.abs(window.parseFloat(matrix[1]) * newScale);\n if (targetScale > opts.zoomoutLimit && targetScale < opts.zoominLimit) {\n $chart.css('transform', lastTf + ' scale3d(' + newScale + ',' + newScale + ', 1)');\n }\n }\n }\n },\n //\n buildJsonDS: function ($li) {\n var that = this;\n var subObj = {\n 'name': $li.contents().eq(0).text().trim(),\n 'relationship': ($li.parent().parent().is('li') ? '1': '0') + ($li.siblings('li').length ? 1: 0) + ($li.children('ul').length ? 1 : 0)\n };\n $.each($li.data(), function(key, value) {\n subObj[key] = value;\n });\n $li.children('ul').children().each(function() {\n if (!subObj.children) { subObj.children = []; }\n subObj.children.push(that.buildJsonDS($(this)));\n });\n return subObj;\n },\n //\n attachRel: function (data, flags) {\n var that = this;\n data.relationship = flags + (data.children && data.children.length > 0 ? 1 : 0);\n if (data.children) {\n data.children.forEach(function(item) {\n that.attachRel(item, '1' + (data.children.length > 1 ? 1 : 0));\n });\n }\n return data;\n },\n //\n loopChart: function ($chart, includeNodeData) {\n includeNodeData = (includeNodeData !== null && includeNodeData !== undefined) ? includeNodeData : false;\n var that = this;\n var $node = $chart.find('.node:first');\n var subObj = { 'id': $node[0].id };\n if (includeNodeData) {\n $.each($node.data('nodeData'), function (key, value) {\n subObj[key] = value;\n });\n }\n $node.siblings('.nodes').children().each(function() {\n if (!subObj.children) { subObj.children = []; }\n subObj.children.push(that.loopChart($(this), includeNodeData));\n });\n return subObj;\n },\n //\n getHierarchy: function (includeNodeData) {\n includeNodeData = (includeNodeData !== null && includeNodeData !== undefined) ? includeNodeData : false;\n if (typeof this.$chart === 'undefined') {\n return 'Error: orgchart does not exist'\n } else {\n if (!this.$chart.find('.node').length) {\n return 'Error: nodes do not exist'\n } else {\n var valid = true;\n this.$chart.find('.node').each(function () {\n if (!this.id) {\n valid = false;\n return false;\n }\n });\n if (!valid) {\n return 'Error: All nodes of orghcart to be exported must have data-id attribute!';\n }\n }\n }\n return this.loopChart(this.$chart, includeNodeData);\n },\n // detect the exist/display state of related node\n getNodeState: function ($node, relation) {\n var $target = {};\n var isVerticalNode = !!$node.closest('vertical').length;\n var relation = relation || 'self';\n if (relation === 'parent') {\n if (isVerticalNode) {\n $target = $node.closest('ul').parents('ul');\n if (!$target.length) {\n $target = $node.closest('.nodes');\n if (!$target.length) {\n $target = $node.closest('.vertical').siblings(':first');\n }\n }\n } else {\n $target = $node.closest('.nodes').siblings('.node');\n }\n if ($target.length) {\n if ($target.is('.hidden') || (!$target.is('.hidden') && $target.closest('.nodes').is('.hidden')) || (!$target.is('.hidden') && $target.closest('.vertical').is('.hidden'))) {\n return { 'exist': true, 'visible': false };\n }\n return { 'exist': true, 'visible': true };\n }\n } else if (relation === 'children') {\n $target = isVerticalNode ? $node.parent().children('ul') : $node.siblings('.nodes');\n if ($target.length) {\n if (!$target.is('.hidden')) {\n return { 'exist': true, 'visible': true };\n }\n return { 'exist': true, 'visible': false };\n }\n } else if (relation === 'siblings') {\n $target = isVerticalNode ? $node.closest('ul') : $node.parent().siblings();\n if ($target.length && (!isVerticalNode || $target.children('li').length > 1)) {\n if (!$target.is('.hidden') && !$target.parent().is('.hidden') && (!isVerticalNode || !$target.closest('.vertical').is('.hidden'))) {\n return { 'exist': true, 'visible': true };\n }\n return { 'exist': true, 'visible': false };\n }\n } else {\n $target = $node;\n if ($target.length) {\n if (!(($target.closest('.nodes').length && $target.closest('.nodes').is('.hidden')) ||\n ($target.closest('.hierarchy').length && $target.closest('.hierarchy').is('.hidden')) ||\n ($target.closest('.vertical').length && ($target.closest('.nodes').is('.hidden') || $target.closest('.vertical').is('.hidden')))\n )) {\n return { 'exist': true, 'visible': true };\n }\n return { 'exist': true, 'visible': false };\n }\n }\n return { 'exist': false, 'visible': false };\n },\n getParent: function ($node) {\n return this.getRelatedNodes($node, 'parent');\n },\n getChildren: function ($node) {\n return this.getRelatedNodes($node, 'children');\n },\n getSiblings: function ($node) {\n return this.getRelatedNodes($node, 'siblings');\n },\n // find the related nodes\n getRelatedNodes: function ($node, relation) {\n if (!$node || !($node instanceof $) || !$node.is('.node')) {\n return $();\n }\n if (relation === 'parent') {\n return $node.closest('.nodes').siblings('.node');\n } else if (relation === 'children') {\n return $node.siblings('.nodes').children('.hierarchy').find('.node:first');\n } else if (relation === 'siblings') {\n return $node.closest('.hierarchy').siblings().find('.node:first');\n } else {\n return $();\n }\n },\n hideParentEnd: function (event) {\n $(event.target).removeClass('sliding');\n event.data.parent.addClass('hidden');\n },\n // recursively hide the ancestor node and sibling nodes of the specified node\n hideParent: function ($node) {\n var $parent = $node.closest('.nodes').siblings('.node');\n if ($parent.find('.spinner').length) {\n $node.closest('.orgchart').data('inAjax', false);\n }\n // hide the sibling nodes\n if (this.getNodeState($node, 'siblings').visible) {\n this.hideSiblings($node);\n }\n // hide the lines\n $node.parent().addClass('isAncestorsCollapsed');\n // hide the superior nodes with transition\n if (this.getNodeState($parent).visible) {\n $parent.addClass('sliding slide-down').one('transitionend', { 'parent': $parent }, this.hideParentEnd);\n }\n // if the current node has the parent node, hide it recursively\n if (this.getNodeState($parent, 'parent').visible) {\n this.hideParent($parent);\n }\n },\n showParentEnd: function (event) {\n var $node = event.data.node;\n $(event.target).removeClass('sliding');\n if (this.isInAction($node)) {\n this.switchVerticalArrow($node.children('.topEdge'));\n }\n },\n // show the parent node of the specified node\n showParent: function ($node) {\n // just show only one superior level\n var $parent = $node.closest('.nodes').siblings('.node').removeClass('hidden');\n // just show only one line\n $node.closest('.hierarchy').removeClass('isAncestorsCollapsed');\n // show parent node with animation\n this.repaint($parent[0]);\n $parent.addClass('sliding').removeClass('slide-down').one('transitionend', { 'node': $node }, this.showParentEnd.bind(this));\n },\n stopAjax: function ($nodeLevel) {\n if ($nodeLevel.find('.spinner').length) {\n $nodeLevel.closest('.orgchart').data('inAjax', false);\n }\n },\n isVisibleNode: function (index, elem) {\n return this.getNodeState($(elem)).visible;\n },\n // do some necessary cleanup tasks when hide animation is finished\n hideChildrenEnd: function (event) {\n var $node = event.data.node;\n event.data.animatedNodes.removeClass('sliding');\n event.data.animatedNodes.closest('.nodes').addClass('hidden');\n if (this.isInAction($node)) {\n this.switchVerticalArrow($node.children('.bottomEdge'));\n }\n },\n // recursively hide the descendant nodes of the specified node\n hideChildren: function ($node) {\n $node.closest('.hierarchy').addClass('isChildrenCollapsed');\n var $lowerLevel = $node.siblings('.nodes');\n this.stopAjax($lowerLevel);\n var $animatedNodes = $lowerLevel.find('.node').filter(this.isVisibleNode.bind(this));\n var isVerticalDesc = $lowerLevel.is('.vertical');\n if (!isVerticalDesc) {\n $animatedNodes.closest('.hierarchy').addClass('isCollapsedDescendant');\n }\n if ($lowerLevel.is('.vertical') || $lowerLevel.find('.vertical').length) {\n $animatedNodes.find('.oci-minus-square').removeClass('oci-minus-square').addClass('oci-plus-square');\n }\n this.repaint($animatedNodes.get(0));\n $animatedNodes.addClass('sliding slide-up').eq(0).one('transitionend', { 'animatedNodes': $animatedNodes, 'lowerLevel': $lowerLevel, 'node': $node }, this.hideChildrenEnd.bind(this));\n },\n //\n showChildrenEnd: function (event) {\n var $node = event.data.node;\n event.data.animatedNodes.removeClass('sliding');\n if (this.isInAction($node)) {\n this.switchVerticalArrow($node.children('.bottomEdge'));\n }\n },\n // show the children nodes of the specified node\n showChildren: function ($node) {\n var that = this;\n $node.closest('.hierarchy').removeClass('isChildrenCollapsed');\n var $levels = $node.siblings('.nodes');\n var isVerticalDesc = $levels.is('.vertical');\n var $animatedNodes = isVerticalDesc\n ? $levels.removeClass('hidden').find('.node').filter(this.isVisibleNode.bind(this))\n : $levels.removeClass('hidden').children('.hierarchy').find('.node:first').filter(this.isVisibleNode.bind(this));\n if (!isVerticalDesc) {\n $animatedNodes.filter(':not(:only-child)').closest('.hierarchy').addClass('isChildrenCollapsed');\n $animatedNodes.closest('.hierarchy').removeClass('isCollapsedDescendant');\n }\n // the two following statements are used to enforce browser to repaint\n this.repaint($animatedNodes.get(0));\n $animatedNodes.addClass('sliding').removeClass('slide-up').eq(0).one('transitionend', { 'node': $node, 'animatedNodes': $animatedNodes }, this.showChildrenEnd.bind(this));\n },\n //\n hideSiblingsEnd: function (event) {\n var $node = event.data.node;\n var $nodeContainer = event.data.nodeContainer;\n var direction = event.data.direction;\n var $siblings = direction ? (direction === 'left' ? $nodeContainer.prevAll(':not(.hidden)') : $nodeContainer.nextAll(':not(.hidden)')) : $nodeContainer.siblings();\n event.data.animatedNodes.removeClass('sliding');\n $siblings.find('.node:gt(0)').filter(this.isVisibleNode.bind(this))\n .removeClass('slide-left slide-right').addClass('slide-up');\n $siblings.find('.nodes, .vertical').addClass('hidden')\n .end().addClass('hidden');\n\n if (this.isInAction($node)) {\n this.switchHorizontalArrow($node);\n }\n },\n // hide the sibling nodes of the specified node\n hideSiblings: function ($node, direction) {\n var that = this;\n var $nodeContainer = $node.closest('.hierarchy').addClass('isSiblingsCollapsed');\n if ($nodeContainer.siblings().find('.spinner').length) {\n $node.closest('.orgchart').data('inAjax', false);\n }\n if (direction) {\n if (direction === 'left') {\n $nodeContainer.addClass('left-sibs')\n .prevAll('.isSiblingsCollapsed').removeClass('isSiblingsCollapsed left-sibs').end()\n .prevAll().addClass('isCollapsedSibling isChildrenCollapsed')\n .find('.node').filter(this.isVisibleNode.bind(this)).addClass('sliding slide-right');\n } else {\n $nodeContainer.addClass('right-sibs')\n .nextAll('.isSiblingsCollapsed').removeClass('isSiblingsCollapsed right-sibs').end()\n .nextAll().addClass('isCollapsedSibling isChildrenCollapsed')\n .find('.node').filter(this.isVisibleNode.bind(this)).addClass('sliding slide-left');\n }\n } else {\n $nodeContainer.prevAll().find('.node').filter(this.isVisibleNode.bind(this)).addClass('sliding slide-right');\n $nodeContainer.nextAll().find('.node').filter(this.isVisibleNode.bind(this)).addClass('sliding slide-left');\n $nodeContainer.siblings().addClass('isCollapsedSibling isChildrenCollapsed');\n }\n var $animatedNodes = $nodeContainer.siblings().find('.sliding');\n $animatedNodes.eq(0).one('transitionend', { 'node': $node, 'nodeContainer': $nodeContainer, 'direction': direction, 'animatedNodes': $animatedNodes }, this.hideSiblingsEnd.bind(this));\n },\n //\n showSiblingsEnd: function (event) {\n var $node = event.data.node;\n event.data.visibleNodes.removeClass('sliding');\n if (this.isInAction($node)) {\n this.switchHorizontalArrow($node);\n $node.children('.topEdge').removeClass('oci-chevron-up').addClass('oci-chevron-down');\n }\n },\n //\n showRelatedParentEnd: function(event) {\n $(event.target).removeClass('sliding');\n },\n // show the sibling nodes of the specified node\n showSiblings: function ($node, direction) {\n var that = this;\n // firstly, show the sibling nodes\n var $siblings = $();\n var $nodeContainer = $node.closest('.hierarchy');\n if (direction) {\n if (direction === 'left') {\n $siblings = $nodeContainer.prevAll().removeClass('hidden');\n } else {\n $siblings = $nodeContainer.nextAll().removeClass('hidden');\n }\n } else {\n $siblings = $node.closest('.hierarchy').siblings().removeClass('hidden');\n }\n // secondly, show the lines\n var $upperLevel = $node.closest('.nodes').siblings('.node');\n if (direction) {\n $nodeContainer.removeClass(direction + '-sibs');\n if (!$nodeContainer.is('[class*=-sibs]')) {\n $nodeContainer.removeClass('isSiblingsCollapsed');\n }\n $siblings.removeClass('isCollapsedSibling ' + direction + '-sibs');\n } else {\n $node.closest('.hierarchy').removeClass('isSiblingsCollapsed');\n $siblings.removeClass('isCollapsedSibling');\n }\n // thirdly, show parent node if it is collapsed\n if (!this.getNodeState($node, 'parent').visible) {\n $node.closest('.hierarchy').removeClass('isAncestorsCollapsed');\n $upperLevel.removeClass('hidden');\n this.repaint($upperLevel[0]);\n $upperLevel.addClass('sliding').removeClass('slide-down').one('transitionend', this.showRelatedParentEnd);\n }\n // lastly, show the sibling nodes with animation\n var $visibleNodes = $siblings.find('.node').filter(this.isVisibleNode.bind(this));\n this.repaint($visibleNodes.get(0));\n $visibleNodes.addClass('sliding').removeClass('slide-left slide-right');\n $visibleNodes.eq(0).one('transitionend', { 'node': $node, 'visibleNodes': $visibleNodes }, this.showSiblingsEnd.bind(this));\n },\n // start up loading status for requesting new nodes\n startLoading: function ($edge) {\n var $chart = this.$chart;\n if (typeof $chart.data('inAjax') !== 'undefined' && $chart.data('inAjax') === true) {\n return false;\n }\n\n $edge.addClass('hidden');\n $edge.parent().append('<i class=\"oci oci-spinner spinner\"></i>')\n .children().not('.spinner').css('opacity', 0.2);\n $chart.data('inAjax', true);\n $('.oc-export-btn').prop('disabled', true);\n return true;\n },\n // terminate loading status for requesting new nodes\n endLoading: function ($edge) {\n var $node = $edge.parent();\n $edge.removeClass('hidden');\n $node.find('.spinner').remove();\n $node.children().removeAttr('style');\n this.$chart.data('inAjax', false);\n $('.oc-export-btn').prop('disabled', false);\n },\n // whether the cursor is hovering over the node\n isInAction: function ($node) {\n return $node.children('.edge').attr('class').indexOf('oci-') > -1 ? true : false;\n },\n //\n switchVerticalArrow: function ($arrow) {\n $arrow.toggleClass('oci-chevron-up').toggleClass('oci-chevron-down');\n },\n //\n switchHorizontalArrow: function ($node) {\n var opts = this.options;\n if (opts.toggleSiblingsResp && (typeof opts.ajaxURL === 'undefined' || $node.closest('.nodes').data('siblingsLoaded'))) {\n var $prevSib = $node.parent().prev();\n if ($prevSib.length) {\n if ($prevSib.is('.hidden')) {\n $node.children('.leftEdge').addClass('oci-chevron-left').removeClass('oci-chevron-right');\n } else {\n $node.children('.leftEdge').addClass('oci-chevron-right').removeClass('oci-chevron-left');\n }\n }\n var $nextSib = $node.parent().next();\n if ($nextSib.length) {\n if ($nextSib.is('.hidden')) {\n $node.children('.rightEdge').addClass('oci-chevron-right').removeClass('oci-chevron-left');\n } else {\n $node.children('.rightEdge').addClass('oci-chevron-left').removeClass('oci-chevron-right');\n }\n }\n } else {\n var $sibs = $node.parent().siblings();\n var sibsVisible = $sibs.length ? !$sibs.is('.hidden') : false;\n $node.children('.leftEdge').toggleClass('oci-chevron-right', sibsVisible).toggleClass('oci-chevron-left', !sibsVisible);\n $node.children('.rightEdge').toggleClass('oci-chevron-left', sibsVisible).toggleClass('oci-chevron-right', !sibsVisible);\n }\n },\n //\n repaint: function (node) {\n if (node) {\n node.style.offsetWidth = node.offsetWidth;\n }\n },\n // determines how to show arrow buttons \n nodeEnterLeaveHandler: function (event) {\n var $node = $(event.delegateTarget);\n var flag = false;\n if ($node.closest('.nodes.vertical').length) {\n var $toggleBtn = $node.children('.toggleBtn');\n if (event.type === 'mouseenter') {\n if ($node.children('.toggleBtn').length) {\n flag = this.getNodeState($node, 'children').visible;\n $toggleBtn.toggleClass('oci-plus-square', !flag).toggleClass('oci-minus-square', flag);\n }\n } else {\n $toggleBtn.removeClass('oci-plus-square oci-minus-square');\n }\n } else {\n var $topEdge = $node.children('.topEdge');\n var $rightEdge = $node.children('.rightEdge');\n var $bottomEdge = $node.children('.bottomEdge');\n var $leftEdge = $node.children('.leftEdge');\n if (event.type === 'mouseenter') {\n if ($topEdge.length) {\n flag = this.getNodeState($node, 'parent').visible;\n $topEdge.toggleClass('oci-chevron-up', !flag).toggleClass('oci-chevron-down', flag);\n }\n if ($bottomEdge.length) {\n flag = this.getNodeState($node, 'children').visible;\n $bottomEdge.toggleClass('oci-chevron-down', !flag).toggleClass('oci-chevron-up', flag);\n }\n if ($leftEdge.length) {\n this.switchHorizontalArrow($node);\n }\n } else {\n $node.children('.edge').removeClass('oci-chevron-up oci-chevron-down oci-chevron-right oci-chevron-left');\n }\n }\n },\n //\n nodeClickHandler: function (event) {\n this.$chart.find('.focused').removeClass('focused');\n $(event.delegateTarget).addClass('focused');\n },\n // load new nodes by ajax\n loadNodes: function (rel, url, $edge) {\n var that = this;\n var opts = this.options;\n $.ajax({ 'url': url, 'dataType': 'json' })\n .done(function (data) {\n if (that.$chart.data('inAjax')) {\n if (rel === 'parent') {\n if (!$.isEmptyObject(data)) {\n that.addParent($edge.parent(), data);\n }\n } else if (rel === 'children') {\n if (data.children.length) {\n that.addChildren($edge.parent(), data[rel]);\n }\n } else {\n that.addSiblings($edge.parent(), data.siblings ? data.siblings : data);\n }\n that.triggerLoadEvent($edge.parent(), rel);\n }\n })\n .fail(function () {\n console.log('Failed to get ' + rel + ' data');\n })\n .always(function () {\n that.endLoading($edge);\n });\n },\n //\n HideFirstParentEnd: function (event) {\n var $topEdge = event.data.topEdge;\n var $node = $topEdge.parent();\n if (this.isInAction($node)) {\n this.switchVerticalArrow($topEdge);\n this.switchHorizontalArrow($node);\n }\n },\n // actions on clinking top edge of a node\n topEdgeClickHandler: function (event) {\n event.stopPropagation();\n var that = this;\n var $topEdge = $(event.target);\n var $node = $(event.delegateTarget);\n var parentState = this.getNodeState($node, 'parent');\n if (parentState.exist) {\n var $parent = $node.closest('.nodes').siblings('.node');\n if ($parent.is('.sliding')) { return; }\n // hide the ancestor nodes and sibling nodes of the specified node\n if (parentState.visible) {\n this.hideParent($node);\n $parent.one('transitionend', { 'topEdge': $topEdge }, this.HideFirstParentEnd.bind(this));\n this.triggerHideEvent($node, 'parent');\n } else { // show the ancestors and siblings\n this.showParent($node);\n this.triggerShowEvent($node, 'parent');\n }\n } else { // load the new parent node of the specified node by ajax request\n // start up loading status\n if (this.startLoading($topEdge)) {\n var opts = this.options;\n var url = $.isFunction(opts.ajaxURL.parent) ? opts.ajaxURL.parent($node.data('nodeData')) : opts.ajaxURL.parent + $node[0].id;\n this.loadNodes('parent', url, $topEdge);\n }\n }\n },\n // actions on clinking bottom edge of a node\n bottomEdgeClickHandler: function (event) {\n event.stopPropagation();\n var $bottomEdge = $(event.target);\n var $node = $(event.delegateTarget);\n var childrenState = this.getNodeState($node, 'children');\n if (childrenState.exist) {\n var $children = $node.siblings('.nodes').children().children('.node');\n if ($children.is('.sliding')) { return; }\n // hide the descendant nodes of the specified node\n if (childrenState.visible) {\n this.hideChildren($node);\n this.triggerHideEvent($node, 'children');\n } else { // show the descendants\n this.showChildren($node);\n this.triggerShowEvent($node, 'children');\n }\n } else { // load the new children nodes of the specified node by ajax request\n if (this.startLoading($bottomEdge)) {\n var opts = this.options;\n var url = $.isFunction(opts.ajaxURL.children) ? opts.ajaxURL.children($node.data('nodeData')) : opts.ajaxURL.children + $node[0].id;\n this.loadNodes('children', url, $bottomEdge);\n }\n }\n },\n // actions on clicking horizontal edges\n hEdgeClickHandler: function (event) {\n event.stopPropagation();\n var $hEdge = $(event.target);\n var $node = $(event.delegateTarget);\n var opts = this.options;\n var siblingsState = this.getNodeState($node, 'siblings');\n if (siblingsState.exist) {\n var $siblings = $node.closest('.hierarchy').siblings();\n if ($siblings.find('.sliding').length) { return; }\n if (opts.toggleSiblingsResp) {\n var $prevSib = $node.closest('.hierarchy').prev();\n var $nextSib = $node.closest('.hierarchy').next();\n if ($hEdge.is('.leftEdge')) {\n if ($prevSib.is('.hidden')) {\n this.showSiblings($node, 'left');\n this.triggerShowEvent($node,'siblings');\n } else {\n this.hideSiblings($node, 'left');\n this.triggerHideEvent($node, 'siblings');\n }\n } else {\n if ($nextSib.is('.hidden')) {\n this.showSiblings($node, 'right');\n this.triggerShowEvent($node,'siblings');\n } else {\n this.hideSiblings($node, 'right');\n this.triggerHideEvent($node, 'siblings');\n }\n }\n } else {\n if (siblingsState.visible) {\n this.hideSiblings($node);\n this.triggerHideEvent($node, 'siblings');\n } else {\n this.showSiblings($node);\n this.triggerShowEvent($node, 'siblings');\n }\n }\n } else {\n // load the new sibling nodes of the specified node by ajax request\n if (this.startLoading($hEdge)) {\n var nodeId = $node[0].id;\n var url = (this.getNodeState($node, 'parent').exist) ?\n ($.isFunction(opts.ajaxURL.siblings) ? opts.ajaxURL.siblings($node.data('nodeData')) : opts.ajaxURL.siblings + nodeId) :\n ($.isFunction(opts.ajaxURL.families) ? opts.ajaxURL.families($node.data('nodeData')) : opts.ajaxURL.families + nodeId);\n this.loadNodes('siblings', url, $hEdge);\n }\n }\n },\n //\n expandVNodesEnd: function (event) {\n event.data.vNodes.removeClass('sliding');\n },\n //\n collapseVNodesEnd: function (event) {\n event.data.vNodes.removeClass('sliding').closest('ul').addClass('hidden');\n },\n // event handler for toggle buttons in Hybrid(horizontal + vertical) OrgChart\n toggleVNodes: function (event) {\n var $toggleBtn = $(event.target);\n var $descWrapper = $toggleBtn.parent().next();\n var $descendants = $descWrapper.find('.node');\n var $children = $descWrapper.children().children('.node');\n if ($children.is('.sliding')) { return; }\n $toggleBtn.toggleClass('oci-plus-square oci-minus-square');\n if ($descendants.eq(0).is('.slide-up')) {\n $descWrapper.removeClass('hidden');\n this.repaint($children.get(0));\n $children.addClass('sliding').removeClass('slide-up').eq(0).one('transitionend', { 'vNodes': $children }, this.expandVNodesEnd);\n } else {\n $descendants.addClass('sliding slide-up').eq(0).one('transitionend', { 'vNodes': $descendants }, this.collapseVNodesEnd);\n $descendants.find('.toggleBtn').removeClass('oci-minus-square').addClass('oci-plus-square');\n }\n },\n //\n createGhostNode: function (event) {\n var $nodeDiv = $(event.target);\n var opts = this.options;\n var origEvent = event.originalEvent;\n var isFirefox = /firefox/.test(window.navigator.userAgent.toLowerCase());\n var ghostNode, nodeCover;\n if (!document.querySelector('.ghost-node')) {\n ghostNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n if (!ghostNode.classList) return;\n ghostNode.classList.add('ghost-node');\n nodeCover = document.createElementNS('http://www.w3.org/2000/svg','rect');\n ghostNode.appendChild(nodeCover);\n $nodeDiv.closest('.orgchart').append(ghostNode);\n } else {\n ghostNode = $nodeDiv.closest('.orgchart').children('.ghost-node').get(0);\n nodeCover = $(ghostNode).children().get(0);\n }\n var transValues = $nodeDiv.closest('.orgchart').css('transform').split(',');\n var isHorizontal = opts.direction === 't2b' || opts.direction === 'b2t';\n var scale = Math.abs(window.parseFloat(isHorizontal ? transValues[0].slice(transValues[0].indexOf('(') + 1) : transValues[1]));\n ghostNode.setAttribute('width', isHorizontal ? $nodeDiv.outerWidth(false) : $nodeDiv.outerHeight(false));\n ghostNode.setAttribute('height', isHorizontal ? $nodeDiv.outerHeight(false) : $nodeDiv.outerWidth(false));\n nodeCover.setAttribute('x',5 * scale);\n nodeCover.setAttribute('y',5 * scale);\n nodeCover.setAttribute('width', 120 * scale);\n nodeCover.setAttribute('height', 40 * scale);\n nodeCover.setAttribute('rx', 4 * scale);\n nodeCover.setAttribute('ry', 4 * scale);\n nodeCover.setAttribute('stroke-width', 1 * scale);\n var xOffset = origEvent.offsetX * scale;\n var yOffset = origEvent.offsetY * scale;\n if (opts.direction === 'l2r') {\n xOffset = origEvent.offsetY * scale;\n yOffset = origEvent.offsetX * scale;\n } else if (opts.direction === 'r2l') {\n xOffset = $nodeDiv.outerWidth(false) - origEvent.offsetY * scale;\n yOffset = origEvent.offsetX * scale;\n } else if (opts.direction === 'b2t') {\n xOffset = $nodeDiv.outerWidth(false) - origEvent.offsetX * scale;\n yOffset = $nodeDiv.outerHeight(false) - origEvent.offsetY * scale;\n }\n if (isFirefox) { // hack for old version of Firefox(< 48.0)\n nodeCover.setAttribute('fill', 'rgb(255, 255, 255)');\n nodeCover.setAttribute('stroke', 'rgb(191, 0, 0)');\n var ghostNodeWrapper = document.createElement('img');\n ghostNodeWrapper.src = 'data:image/svg+xml;utf8,' + (new XMLSerializer()).serializeToString(ghostNode);\n origEvent.dataTransfer.setDragImage(ghostNodeWrapper, xOffset, yOffset);\n } else {\n // IE/Edge do not support this, so only use it if we can\n if (origEvent.dataTransfer.setDragImage)\n origEvent.dataTransfer.setDragImage(ghostNode, xOffset, yOffset);\n }\n },\n //\n filterAllowedDropNodes: function ($dragged) {\n var opts = this.options;\n // what is being dragged? a node, or something within a node?\n var draggingNode = $dragged.closest('[draggable]').hasClass('node');\n var $dragZone = $dragged.closest('.nodes').siblings('.node'); // parent node\n var $dragHier = $dragged.closest('.hierarchy').find('.node'); // this node, and its children\n this.$chart.data('dragged', $dragged)\n .find('.node').each(function (index, node) {\n if (!draggingNode || $dragHier.index(node) === -1) {\n if (opts.dropCriteria) {\n if (opts.dropCriteria($dragged, $dragZone, $(node))) {\n $(node).addClass('allowedDrop');\n }\n } else {\n $(node).addClass('allowedDrop');\n }\n }\n });\n },\n //\n dragstartHandler: function (event) {\n event.originalEvent.dataTransfer.setData('text/html', 'hack for firefox');\n // if users enable zoom or direction options\n if (this.$chart.css('transform') !== 'none') {\n this.createGhostNode(event);\n }\n this.filterAllowedDropNodes($(event.target));\n },\n //\n dragoverHandler: function (event) {\n if (!$(event.delegateTarget).is('.allowedDrop')) {\n event.originalEvent.dataTransfer.dropEffect = 'none';\n } else {\n // default action for drag-and-drop of div is not to drop, so preventing default action for nodes which have allowedDrop class\n //to fix drag and drop on IE and Edge\n event.preventDefault();\n }\n },\n //\n dragendHandler: function (event) {\n this.$chart.find('.allowedDrop').removeClass('allowedDrop');\n },\n // when user drops the node, it will be removed from original parent node and be added to new parent node\n dropHandler: function (event) {\n var $dropZone = $(event.delegateTarget);\n var $dragged = this.$chart.data('dragged');\n\n // Pass on drops which are not nodes (since they are not our doing)\n if (!$dragged.hasClass('node')) {\n this.$chart.triggerHandler({ 'type': 'otherdropped.orgchart', 'draggedItem': $dragged, 'dropZone': $dropZone });\n return;\n }\n\n if (!$dropZone.hasClass('allowedDrop')) {\n // We are trying to drop a node into a node which isn't allowed\n // IE/Edge have a habit of allowing this, so we need our own double-check\n return;\n }\n\n var $dragZone = $dragged.closest('.nodes').siblings('.node');\n var dropEvent = $.Event('nodedrop.orgchart');\n this.$chart.trigger(dropEvent, { 'draggedNode': $dragged, 'dragZone': $dragZone, 'dropZone': $dropZone });\n if (dropEvent.isDefaultPrevented()) {\n return;\n }\n // firstly, deal with the hierarchy of drop zone\n if (!$dropZone.siblings('.nodes').length) { // if the drop zone is a leaf node\n $dropZone.append('<i class=\"edge verticalEdge bottomEdge oci\"></i>')\n .after('<ul class=\"nodes\"></ul>')\n .siblings('.nodes').append($dragged.find('.horizontalEdge').remove().end().closest('.hierarchy'));\n if ($dropZone.children('.title').length) {\n $dropZone.children('.title').prepend('<i class=\"oci '+ this.$chart.data('options').parentNodeSymbol + ' symbol\"></i>');\n }\n } else {\n var horizontalEdges = '<i class=\"edge horizontalEdge rightEdge oci\"></i><i class=\"edge horizontalEdge leftEdge oci\"></i>';\n if (!$dragged.find('.horizontalEdge').length) {\n $dragged.append(horizontalEdges);\n }\n $dropZone.siblings('.nodes').append($dragged.closest('.hierarchy'));\n var $dropSibs = $dragged.closest('.hierarchy').siblings().find('.node:first');\n if ($dropSibs.length === 1) {\n $dropSibs.append(horizontalEdges);\n }\n }\n // secondly, deal with the hierarchy of dragged node\n if ($dragZone.siblings('.nodes').children('.hierarchy').length === 1) { // if there is only one sibling node left\n $dragZone.siblings('.nodes').children('.hierarchy').find('.node:first')\n .find('.horizontalEdge').remove();\n } else if ($dragZone.siblings('.nodes').children('.hierarchy').length === 0) {\n $dragZone.find('.bottomEdge, .symbol').remove()\n .end().siblings('.nodes').remove();\n }\n },\n //\n touchstartHandler: function (event) {\n if (this.touchHandled)\n return;\n\n if (event.touches && event.touches.length > 1)\n return;\n\n this.touchHandled = true;\n this.touchMoved = false; // this is so we can work out later if this was a 'press' or a 'drag' touch\n event.preventDefault();\n },\n //\n touchmoveHandler: function (event) {\n if (!this.touchHandled)\n return;\n\n if (event.touches && event.touches.length > 1)\n return;\n\n event.preventDefault();\n\n if (!this.touchMoved) {\n // we do not bother with createGhostNode (dragstart does) since the touch event does not have a dataTransfer property\n this.filterAllowedDropNodes($(event.currentTarget)); // will also set 'this.$chart.data('dragged')' for us\n // create an image which can be used to illustrate the drag (our own createGhostNode)\n this.touchDragImage = this.createDragImage(event, this.$chart.data('dragged')[0]);\n }\n this.touchMoved = true;\n\n // move our dragimage so it follows our finger\n this.moveDragImage(event, this.touchDragImage);\n\n var $touching = $(document.elementFromPoint(event.touches[0].clientX, event.touches[0].clientY));\n var $touchingNodes = $touching.closest('div.node');\n if ($touchingNodes.length > 0) {\n var touchingNodeElement = $touchingNodes[0];\n if ($touchingNodes.is('.allowedDrop')) {\n this.touchTargetNode = touchingNodeElement;\n }\n else {\n this.touchTargetNode = null;\n }\n }\n else {\n this.touchTargetNode = null;\n }\n },\n //\n touchendHandler: function (event) {\n if (!this.touchHandled) {\n return;\n }\n this.destroyDragImage();\n if (this.touchMoved) {\n // we've had movement, so this was a 'drag' touch\n if (this.touchTargetNode) {\n var fakeEventForDropHandler = { delegateTarget: this.touchTargetNode };\n this.dropHandler(fakeEventForDropHandler);\n this.touchTargetNode = null;\n }\n this.dragendHandler(event);\n }\n else {\n // we did not move, so this was a 'press' touch (fake a click)\n var firstTouch = event.changedTouches[0];\n var fakeMouseClickEvent = document.createEvent('MouseEvents');\n fakeMouseClickEvent.initMouseEvent('click', true, true, window, 1, firstTouch.screenX, firstTouch.screenY, firstTouch.clientX, firstTouch.clientY, event.ctrlKey, event.altKey, event.shiftKey, event.metaKey, 0, null);\n event.target.dispatchEvent(fakeMouseClickEvent);\n }\n this.touchHandled = false;\n },\n //\n createDragImage: function (event, source) {\n var dragImage = source.cloneNode(true);\n this.copyStyle(source, dragImage);\n dragImage.style.top = dragImage.style.left = '-9999px';\n var sourceRectangle = source.getBoundingClientRect();\n var sourcePoint = this.getTouchPoint(event);\n this.touchDragImageOffset = { x: sourcePoint.x - sourceRectangle.left, y: sourcePoint.y - sourceRectangle.top };\n dragImage.style.opacity = '0.5';\n document.body.appendChild(dragImage);\n return dragImage;\n },\n //\n destroyDragImage: function () {\n if (this.touchDragImage && this.touchDragImage.parentElement)\n this.touchDragImage.parentElement.removeChild(this.touchDragImage);\n this.touchDragImageOffset = null;\n this.touchDragImage = null;\n },\n //\n copyStyle: function (src, dst) {\n // remove potentially troublesome attributes\n var badAttributes = ['id', 'class', 'style', 'draggable'];\n badAttributes.forEach(function (att) {\n dst.removeAttribute(att);\n });\n // copy canvas content\n if (src instanceof HTMLCanvasElement) {\n var cSrc = src, cDst = dst;\n cDst.width = cSrc.width;\n cDst.height = cSrc.height;\n cDst.getContext('2d').drawImage(cSrc, 0, 0);\n }\n // copy style (without transitions)\n var cs = getComputedStyle(src);\n for (var i = 0; i < cs.length; i++) {\n var key = cs[i];\n if (key.indexOf('transition') < 0) {\n dst.style[key] = cs[key];\n }\n }\n dst.style.pointerEvents = 'none';\n // and repeat for all children\n for (var i = 0; i < src.children.length; i++) {\n this.copyStyle(src.children[i], dst.children[i]);\n }\n },\n //\n getTouchPoint: function (event) {\n if (event && event.touches) {\n event = event.touches[0];\n }\n return {\n x: event.clientX,\n y: event.clientY\n };\n },\n //\n moveDragImage: function (event, image) {\n if (!event || !image)\n return;\n var orgChartMaster = this;\n requestAnimationFrame(function () {\n var pt = orgChartMaster.getTouchPoint(event);\n var s = image.style;\n s.position = 'absolute';\n s.pointerEvents = 'none';\n s.zIndex = '999999';\n if (orgChartMaster.touchDragImageOffset) {\n s.left = Math.round(pt.x - orgChartMaster.touchDragImageOffset.x) + 'px';\n s.top = Math.round(pt.y - orgChartMaster.touchDragImageOffset.y) + 'px';\n }\n });\n },\n //\n bindDragDrop: function ($node) {\n $node.on('dragstart', this.dragstartHandler.bind(this))\n .on('dragover', this.dragoverHandler.bind(this))\n .on('dragend', this.dragendHandler.bind(this))\n .on('drop', this.dropHandler.bind(this))\n .on('touchstart', this.touchstartHandler.bind(this))\n .on('touchmove', this.touchmoveHandler.bind(this))\n .on('touchend', this.touchendHandler.bind(this));\n },\n // create node\n createNode: function (data) {\n var that = this;\n var opts = this.options;\n var level = data.level;\n if (data.children && data[opts.nodeId]) {\n $.each(data.children, function (index, child) {\n child.parentId = data[opts.nodeId]\n });\n }\n // construct the content of node\n var $nodeDiv = $('<div' + (opts.draggable ? ' draggable=\"true\"' : '') + (data[opts.nodeId] ? ' id=\"' + data[opts.nodeId] + '\"' : '') + (data.parentId ? ' data-parent=\"' + data.parentId + '\"' : '') + '>')\n .addClass('node ' + (data.className || '') + (level > opts.visibleLevel ? ' slide-up' : ''));\n if (opts.nodeTemplate) {\n $nodeDiv.append(opts.nodeTemplate(data));\n } else {\n $nodeDiv.append('<div class=\"title\">' + data[opts.nodeTitle] + '</div>')\n .append(typeof opts.nodeContent !== 'undefined' ? '<div class=\"content\">' + (data[opts.nodeContent] || '') + '</div>' : '');\n }\n //\n var nodeData = $.extend({}, data);\n delete nodeData.children;\n $nodeDiv.data('nodeData', nodeData);\n // append 4 direction arrows or expand/collapse buttons\n var flags = data.relationship || '';\n if (opts.verticalLevel && level >= opts.verticalLevel) {\n if ((level + 1) > opts.verticalLevel && Number(flags.substr(2,1))) {\n $nodeDiv.append('<i class=\"toggleBtn oci\"></i>')\n .children('.title').prepend('<i class=\"oci '+ opts.parentNodeSymbol + ' symbol\"></i>');\n }\n } else {\n if (Number(flags.substr(0,1))) {\n $nodeDiv.append('<i class=\"edge verticalEdge topEdge oci\"></i>');\n }\n if(Number(flags.substr(1,1))) {\n $nodeDiv.append('<i class=\"edge horizontalEdge rightEdge oci\"></i>' +\n '<i class=\"edge horizontalEdge leftEdge oci\"></i>');\n }\n if(Number(flags.substr(2,1))) {\n $nodeDiv.append('<i class=\"edge verticalEdge bottomEdge oci\"></i>')\n .children('.title').prepend('<i class=\"oci '+ opts.parentNodeSymbol + ' symbol\"></i>');\n }\n }\n\n $nodeDiv.on('mouseenter mouseleave', this.nodeEnterLeaveHandler.bind(this));\n $nodeDiv.on('click', this.nodeClickHandler.bind(this));\n $nodeDiv.on('click', '.topEdge', this.topEdgeClickHandler.bind(this));\n $nodeDiv.on('click', '.bottomEdge', this.bottomEdgeClickHandler.bind(this));\n $nodeDiv.on('click', '.leftEdge, .rightEdge', this.hEdgeClickHandler.bind(this));\n $nodeDiv.on('click', '.toggleBtn', this.toggleVNodes.bind(this));\n\n if (opts.draggable) {\n this.bindDragDrop($nodeDiv);\n this.touchHandled = false;\n this.touchMoved = false;\n this.touchTargetNode = null;\n }\n // allow user to append dom modification after finishing node create of orgchart\n if (opts.createNode) {\n opts.createNode($nodeDiv, data);\n }\n\n return $nodeDiv;\n },\n // recursively build the tree\n buildHierarchy: function ($appendTo, data) {\n var that = this;\n var opts = this.options;\n var level = 0;\n if (data.level) {\n level = data.level;\n } else {\n level = data.level = $appendTo.parentsUntil('.orgchart', '.nodes').length;\n }\n // Construct the node\n if (Object.keys(data).length > 2) {\n var $nodeDiv = this.createNode(data);\n if (opts.verticalLevel && level >= opts.verticalLevel) {\n $appendTo.append($nodeDiv);\n } else {\n $appendTo.append($nodeDiv);\n }\n }\n // Construct the \"inferior nodes\"\n if (data.children && data.children.length) {\n var isHidden = level + 1 > opts.visibleLevel || (data.collapsed !== undefined && data.collapsed);\n var isVerticalLayer = opts.verticalLevel && (level + 1) >= opts.verticalLevel;\n var $nodesLayer;\n if (isVerticalLayer) {\n $nodesLayer = $('<ul class=\"nodes\">');\n if (isHidden && level + 1 >= opts.verticalLevel) {\n $nodesLayer.addClass('hidden');\n }\n if (level + 1 === opts.verticalLevel) {\n $appendTo.addClass('hybrid').append($nodesLayer.addClass('vertical'));\n } else {\n $appendTo.append($nodesLayer);\n }\n } else {\n $nodesLayer = $('<ul class=\"nodes' + (isHidden ? ' hidden' : '') + '\">');\n if (Object.keys(data).length === 2) {\n $appendTo.append($nodesLayer);\n } else {\n if (isHidden) {\n $appendTo.addClass('isChildrenCollapsed');\n }\n $appendTo.append($nodesLayer);\n }\n }\n // recurse through children nodes\n $.each(data.children, function () {\n var $nodeCell = $('<li class=\"hierarchy\">');\n $nodesLayer.append($nodeCell);\n this.level = level + 1;\n that.buildHierarchy($nodeCell, this);\n });\n }\n },\n // build the child nodes of specific node\n buildChildNode: function ($appendTo, data) {\n this.buildHierarchy($appendTo, { 'children': data });\n },\n // exposed method\n addChildren: function ($node, data) {\n this.buildChildNode($node.closest('.hierarchy'), data);\n if (!$node.find('.symbol').length) {\n $node.children('.title').prepend('<i class=\"oci '+ this.options.parentNodeSymbol + ' symbol\"></i>');\n }\n if ($node.closest('.nodes.vertical').length) {\n if (!$node.children('.toggleBtn').length) {\n $node.append('<i class=\"toggleBtn oci\"></i>');\n }\n } else {\n if (!$node.children('.bottomEdge').length) {\n $node.append('<i class=\"edge verticalEdge bottomEdge oci\"></i>');\n }\n }\n if (this.isInAction($node)) {\n this.switchVerticalArrow($node.children('.bottomEdge'));\n }\n },\n // build the parent node of specific node\n buildParentNode: function ($currentRoot, data) {\n data.relationship = data.relationship || '001';\n var $newRootWrapper = $('<ul class=\"nodes\"><li class=\"hierarchy\"></li></ul>')\n .find('.hierarchy').append(this.createNode(data)).end();\n this.$chart.prepend($newRootWrapper)\n .find('.hierarchy:first').append($currentRoot.closest('ul').addClass('nodes'));\n },\n // exposed method\n addParent: function ($currentRoot, data) {\n this.buildParentNode($currentRoot, data);\n if (!$currentRoot.children('.topEdge').length) {\n $currentRoot.children('.title').after('<i class=\"edge verticalEdge topEdge oci\"></i>');\n }\n if (this.isInAction($currentRoot)) {\n this.switchVerticalArrow($currentRoot.children('.topEdge'));\n }\n },\n // build the sibling nodes of specific node\n buildSiblingNode: function ($nodeChart, data) {\n var newSiblingCount = $.isArray(data) ? data.length : data.children.length;\n var existingSibligCount = $nodeChart.parent().is('.nodes') ? $nodeChart.siblings().length + 1 : 1;\n var siblingCount = existingSibligCount + newSiblingCount;\n var insertPostion = (siblingCount > 1) ? Math.floor(siblingCount/2 - 1) : 0;\n // just build the sibling nodes for the specific node\n if ($nodeChart.closest('.nodes').parent().is('.hierarchy')) {\n this.buildChildNode($nodeChart.parent().closest('.hierarchy'), data);\n var $siblings = $nodeChart.parent().closest('.hierarchy').children('.nodes:last').children('.hierarchy');\n if (existingSibligCount > 1) {\n $siblings.eq(0).before($nodeChart.siblings().addBack().unwrap());\n } else {\n $siblings.eq(insertPostion).after($nodeChart.unwrap());\n }\n } else { // build the sibling nodes and parent node for the specific ndoe\n this.buildHierarchy($nodeChart.parent().prepend($('<li class=\"hierarchy\">')).children('.hierarchy:first'), data);\n $nodeChart.prevAll('.hierarchy').children('.nodes').children().eq(insertPostion).after($nodeChart);\n }\n },\n //\n addSiblings: function ($node, data) {\n this.buildSiblingNode($node.closest('.hierarchy'), data);\n $node.closest('.nodes').data('siblingsLoaded', true);\n if (!$node.children('.leftEdge').length) {\n $node.children('.topEdge').after('<i class=\"edge horizontalEdge rightEdge oci\"></i><i class=\"edge horizontalEdge leftEdge oci\"></i>');\n }\n if (this.isInAction($node)) {\n this.switchHorizontalArrow($node);\n $node.children('.topEdge').removeClass('oci-chevron-up').addClass('oci-chevron-down');\n }\n },\n // remove node and its descendent nodes\n removeNodes: function ($node) {\n var $wrapper = $node.closest('.hierarchy').parent();\n if ($wrapper.parent().is('.hierarchy')) {\n if (this.getNodeState($node, 'siblings').exist) {\n $node.closest('.hierarchy').remove();\n if ($wrapper.children().length === 1) {\n $wrapper.find('.node:first .horizontalEdge').remove();\n }\n } else {\n $wrapper.siblings('.node').find('.bottomEdge').remove()\n .end().end().remove();\n }\n } else { // if $node is root node\n $wrapper.closest('.orgchart').remove();\n }\n },\n //\n hideDropZones: function () {\n // Remove all the 'this is a drop zone' indicators\n var orgChartObj = this;\n orgChartObj.$chart.find('.allowedDrop')\n .removeClass('allowedDrop');\n },\n //\n showDropZones: function (dragged) {\n // Highlight all the 'drop zones', and set dragged, so that the drop/enter can work out what happens later\n // TODO: This assumes all nodes are droppable: it doesn't run the custom isDroppable function - it should!\n var orgChartObj = this;\n orgChartObj.$chart.find('.node')\n .each(function (index, node) {\n $(node).addClass('allowedDrop');\n });\n orgChartObj.$chart.data('dragged', $(dragged));\n },\n //\n processExternalDrop: function (dropZone, dragged) {\n // Allow an external drop event to be handled by one of our nodes\n if (dragged) {\n this.$chart.data('dragged', $(dragged));\n }\n var droppedOnNode = dropZone.closest('.node');\n // would like to just call 'dropZoneHandler', but I can't reach it from here\n // instead raise a drop event on the node element\n droppedOnNode.triggerHandler({ 'type': 'drop' });\n },\n //\n exportPDF: function(canvas, exportFilename){\n var doc = {};\n var docWidth = Math.floor(canvas.width);\n var docHeight = Math.floor(canvas.height);\n if (!window.jsPDF) {\n window.jsPDF = window.jspdf.jsPDF;\n }\n\n if (docWidth > docHeight) {\n doc = new jsPDF({\n orientation: 'landscape',\n unit: 'px',\n format: [docWidth, docHeight]\n });\n } else {\n doc = new jsPDF({\n orientation: 'portrait',\n unit: 'px',\n format: [docHeight, docWidth]\n });\n }\n doc.addImage(canvas.toDataURL(), 'png', 0, 0);\n doc.save(exportFilename + '.pdf');\n },\n //\n exportPNG: function(canvas, exportFilename){\n var that = this;\n var isWebkit = 'WebkitAppearance' in document.documentElement.style;\n var isFf = !!window.sidebar;\n var isEdge = navigator.appName === 'Microsoft Internet Explorer' || (navigator.appName === \"Netscape\" && navigator.appVersion.indexOf('Edge') > -1);\n var $chartContainer = this.$chartContainer;\n\n if ((!isWebkit && !isFf) || isEdge) {\n window.navigator.msSaveBlob(canvas.msToBlob(), exportFilename + '.png');\n } else {\n var selector = '.oci-download-btn' + (that.options.chartClass !== '' ? '.' + that.options.chartClass : '');\n\n if (!$chartContainer.find(selector).length) {\n $chartContainer.append('<a class=\"oci-download-btn' + (that.options.chartClass !== '' ? ' ' + that.options.chartClass : '') + '\"'\n + ' download=\"' + exportFilename + '.png\"></a>');\n }\n\n $chartContainer.find(selector).attr('href', canvas.toDataURL())[0].click();\n }\n },\n //\n export: function (exportFilename, exportFileextension) {\n var that = this;\n exportFilename = (typeof exportFilename !== 'undefined') ? exportFilename : this.options.exportFilename;\n exportFileextension = (typeof exportFileextension !== 'undefined') ? exportFileextension : this.options.exportFileextension;\n if ($(this).children('.spinner').length) {\n return false;\n }\n var $chartContainer = this.$chartContainer;\n var $mask = $chartContainer.find('.mask');\n if (!$mask.length) {\n $chartContainer.append('<div class=\"mask\"><i class=\"oci oci-spinner spinner\"></i></div>');\n } else {\n $mask.removeClass('hidden');\n }\n var sourceChart = $chartContainer.addClass('canvasContainer').find('.orgchart:not(\".hidden\")').get(0);\n var flag = that.options.direction === 'l2r' || that.options.direction === 'r2l';\n html2canvas(sourceChart, {\n 'width': flag ? sourceChart.clientHeight : sourceChart.clientWidth,\n 'height': flag ? sourceChart.clientWidth : sourceChart.clientHeight,\n 'onclone': function (cloneDoc) {\n $(cloneDoc).find('.canvasContainer').css('overflow', 'visible')\n .find('.orgchart:not(\".hidden\"):first').css('transform', '');\n }\n })\n .then(function (canvas) {\n $chartContainer.find('.mask').addClass('hidden');\n\n if (exportFileextension.toLowerCase() === 'pdf') {\n that.exportPDF(canvas, exportFilename);\n } else {\n that.exportPNG(canvas, exportFilename);\n }\n\n $chartContainer.removeClass('canvasContainer');\n }, function () {\n $chartContainer.removeClass('canvasContainer');\n });\n }\n };\n\n $.fn.orgchart = function (opts) {\n return new OrgChart(this, opts).init();\n };\n\n}));\n"]}
1
+ {"version":3,"sources":["jquery.orgchart.js"],"names":["factory","module","exports","require","window","document","jQuery","$","undefined","OrgChart","elem","opts","this","$chartContainer","defaultOptions","nodeTitle","nodeId","toggleSiblingsResp","visibleLevel","chartClass","exportButton","exportButtonName","exportFilename","exportFileextension","parentNodeSymbol","draggable","direction","pan","zoom","zoominLimit","zoomoutLimit","prototype","init","that","options","extend","$chart","remove","data","class","click","event","target","closest","length","find","removeClass","MutationObserver","triggerInitEvent","$root","append","type","buildHierarchy","buildJsonDS","children","ajaxURL","attachRel","ajax","url","dataType","done","textStatus","jqXHR","fail","errorThrown","console","log","always","attachExportButton","bindPan","bindZoom","mo","mutations","disconnect","initTime","i","j","addedNodes","classList","contains","initCompleted","initEvent","Event","trigger","observe","childList","triggerLoadEvent","$target","rel","triggerShowEvent","triggerHideEvent","$exportBtn","text","e","preventDefault","export","after","setOptions","val","unbindPan","unbindZoom","panStartHandler","delegateTarget","touches","css","lastX","lastY","lastTf","temp","split","indexOf","parseInt","startX","startY","targetTouches","pageX","pageY","on","newX","newY","matrix","join","panEndHandler","chart","off","zoomWheelHandler","oc","newScale","originalEvent","deltaY","setChartScale","zoomStartHandler","dist","getPinchDist","zoomingHandler","zoomEndHandler","diff","Math","sqrt","clientX","clientY","targetScale","abs","parseFloat","$li","subObj","name","contents","eq","trim","relationship","parent","is","siblings","each","key","value","push","flags","forEach","item","loopChart","includeNodeData","$node","id","getHierarchy","valid","getNodeState","relation","isVerticalNode","parents","exist","visible","getParent","getRelatedNodes","getChildren","getSiblings","hideParentEnd","addClass","hideParent","$parent","hideSiblings","one","showParentEnd","node","isInAction","switchVerticalArrow","showParent","repaint","bind","stopAjax","$nodeLevel","isVisibleNode","index","hideChildrenEnd","animatedNodes","hideChildren","$lowerLevel","$animatedNodes","filter","get","lowerLevel","showChildrenEnd","showChildren","$levels","isVerticalDesc","hideSiblingsEnd","$nodeContainer","nodeContainer","$siblings","prevAll","nextAll","end","switchHorizontalArrow","showSiblingsEnd","visibleNodes","showRelatedParentEnd","showSiblings","$upperLevel","$visibleNodes","startLoading","$edge","not","prop","endLoading","removeAttr","attr","$arrow","toggleClass","$prevSib","prev","$nextSib","next","$sibs","sibsVisible","style","offsetWidth","nodeEnterLeaveHandler","flag","$toggleBtn","$topEdge","$bottomEdge","$leftEdge","nodeClickHandler","loadNodes","isEmptyObject","addParent","addChildren","addSiblings","HideFirstParentEnd","topEdge","topEdgeClickHandler","stopPropagation","parentState","isFunction","bottomEdgeClickHandler","childrenState","hEdgeClickHandler","$hEdge","siblingsState","families","expandVNodesEnd","vNodes","collapseVNodesEnd","toggleVNodes","$descWrapper","$descendants","$children","createGhostNode","ghostNode","nodeCover","$nodeDiv","origEvent","isFirefox","test","navigator","userAgent","toLowerCase","querySelector","createElementNS","add","appendChild","transValues","isHorizontal","scale","slice","setAttribute","outerWidth","outerHeight","xOffset","offsetX","yOffset","offsetY","ghostNodeWrapper","createElement","src","XMLSerializer","serializeToString","dataTransfer","setDragImage","getUpperLevel","getLowerLevel","getLevelOrderNodes","queue","output","row","cur","shift","toArray","flat","filterAllowedDropNodes","$dragged","draggingNode","hasClass","$dragZone","$dragHier","dropCriteria","dragstartHandler","setData","dragoverHandler","dropEffect","dragendHandler","dropHandler","$dropZone","dropEvent","draggedNode","dragZone","dropZone","isDefaultPrevented","horizontalEdges","$dropSibs","prepend","triggerHandler","draggedItem","touchstartHandler","touchHandled","touchMoved","touchmoveHandler","currentTarget","touchDragImage","createDragImage","moveDragImage","$touchingNodes","elementFromPoint","touchingNodeElement","touchTargetNode","touchendHandler","destroyDragImage","fakeEventForDropHandler","firstTouch","changedTouches","fakeMouseClickEvent","createEvent","initMouseEvent","screenX","screenY","ctrlKey","altKey","shiftKey","metaKey","dispatchEvent","source","dragImage","cloneNode","copyStyle","top","left","sourceRectangle","getBoundingClientRect","sourcePoint","getTouchPoint","touchDragImageOffset","x","y","opacity","body","parentElement","removeChild","dst","att","removeAttribute","HTMLCanvasElement","cSrc","cDst","width","height","getContext","drawImage","cs","getComputedStyle","pointerEvents","image","orgChartMaster","requestAnimationFrame","pt","s","position","zIndex","round","bindDragDrop","createNode","level","child","parentId","className","nodeTemplate","nodeContent","nodeData","verticalLevel","Number","substr","$appendTo","parentsUntil","Object","keys","$nodesLayer","isHidden","collapsed","$nodeCell","buildChildNode","buildParentNode","$currentRoot","$newRootWrapper","buildSiblingNode","$nodeChart","newSiblingCount","isArray","existingSibligCount","siblingCount","insertPostion","floor","before","addBack","unwrap","removeNodes","$wrapper","hideDropZones","showDropZones","dragged","processExternalDrop","exportPDF","canvas","doc","docWidth","docHeight","jsPDF","jspdf","orientation","unit","format","addImage","toDataURL","save","exportPNG","isWebkit","documentElement","isFf","sidebar","isEdge","appName","appVersion","msSaveBlob","msToBlob","selector","$mask","sourceChart","html2canvas","clientHeight","clientWidth","onclone","cloneDoc","then","fn","orgchart"],"mappings":"AAUA,cAEC,SAAUA,GACa,iBAAXC,QAAiD,iBAAnBA,OAAOC,QAC9CF,EAAQG,QAAQ,UAAWC,OAAQC,UAEnCL,EAAQM,OAAQF,OAAQC,UAJ5B,CAME,SAAUE,EAAGH,EAAQC,EAAUG,GAChB,SAAXC,EAAqBC,EAAMC,GAC7BC,KAAKC,gBAAkBN,EAAEG,GACzBE,KAAKD,KAAOA,EACZC,KAAKE,eAAiB,CACpBC,UAAa,OACbC,OAAU,KACVC,oBAAsB,EACtBC,aAAgB,IAChBC,WAAc,GACdC,cAAgB,EAChBC,iBAAoB,SACpBC,eAAkB,WAClBC,oBAAuB,MACvBC,iBAAoB,aACpBC,WAAa,EACbC,UAAa,MACbC,KAAO,EACPC,MAAQ,EACRC,YAAe,EACfC,aAAgB,IAIpBrB,EAASsB,UAAY,CAEnBC,KAAM,SAAUrB,GACd,IAAIsB,EAAOrB,KACXA,KAAKsB,QAAU3B,EAAE4B,OAAO,GAA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AAOU,aAAa,GAAG3Z,UAIvEuD,OAAQ,SAAUzE,EAAgBC,GAChC,IAAIU,EAAOrB,KAGX,GAFAU,OAA4C,IAAnBA,EAAmCA,EAAiBV,KAAKsB,QAAQZ,eAC1FC,OAAsD,IAAxBA,EAAwCA,EAAsBX,KAAKsB,QAAQX,oBACrGhB,EAAEK,MAAM0C,SAAS,YAAYV,OAC/B,OAAO,EAET,IAAI/B,EAAkBD,KAAKC,gBACvBmc,EAAQnc,EAAgBgC,KAAK,SAC5Bma,EAAMpa,OAGToa,EAAMla,YAAY,UAFlBjC,EAAgBqC,OAAO,mEAIzB,IAAI+Z,EAAcpc,EAAgBqK,SAAS,mBAAmBrI,KAAK,4BAA4B2J,IAAI,GAC/FsC,EAAkC,QAA3B7M,EAAKC,QAAQR,WAAkD,QAA3BO,EAAKC,QAAQR,UAC5Dwb,YAAYD,EAAa,CACvBjF,MAASlJ,EAAOmO,EAAYE,aAAeF,EAAYG,YACvDnF,OAAUnJ,EAAOmO,EAAYG,YAAcH,EAAYE,aACvDE,QAAW,SAAUC,GACnB/c,EAAE+c,GAAUza,KAAK,oBAAoB2D,IAAI,WAAY,WAClD3D,KAAK,kCAAkC2D,IAAI,YAAa,OAG9D+W,KAAK,SAAU9B,GACd5a,EAAgBgC,KAAK,SAASqI,SAAS,UAEG,QAAtC3J,EAAoB8P,cACtBpP,EAAKuZ,UAAUC,EAAQna,GAEvBW,EAAKoa,UAAUZ,EAAQna,GAGzBT,EAAgBiC,YAAY,oBAC3B,WACDjC,EAAgBiC,YAAY,uBAKlCvC,EAAEid,GAAGC,SAAW,SAAU9c,GACxB,OAAO,IAAIF,EAASG,KAAMD,GAAMqB","file":"jquery.orgchart.min.js","sourcesContent":["/*\n * jQuery OrgChart Plugin\n * https://github.com/dabeng/OrgChart\n *\n * Copyright 2016, dabeng\n * https://github.com/dabeng\n *\n * Licensed under the MIT license:\n * http://www.opensource.org/licenses/MIT\n */\n'use strict';\n\n(function (factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n factory(require('jquery'), window, document);\n } else {\n factory(jQuery, window, document);\n }\n}(function ($, window, document, undefined) {\n var OrgChart = function (elem, opts) {\n this.$chartContainer = $(elem);\n this.opts = opts;\n this.defaultOptions = {\n 'nodeTitle': 'name',\n 'nodeId': 'id',\n 'toggleSiblingsResp': false,\n 'visibleLevel': 999,\n 'chartClass': '',\n 'exportButton': false,\n 'exportButtonName': 'Export',\n 'exportFilename': 'OrgChart',\n 'exportFileextension': 'png',\n 'parentNodeSymbol': 'oci-leader',\n 'draggable': false,\n 'direction': 't2b',\n 'pan': false,\n 'zoom': false,\n 'zoominLimit': 7,\n 'zoomoutLimit': 0.5\n };\n };\n //\n OrgChart.prototype = {\n //\n init: function (opts) {\n var that = this;\n this.options = $.extend({}, this.defaultOptions, this.opts, opts);\n // build the org-chart\n var $chartContainer = this.$chartContainer;\n if (this.$chart) {\n this.$chart.remove();\n }\n var data = this.options.data;\n var $chart = this.$chart = $('<div>', {\n 'data': { 'options': this.options },\n 'class': 'orgchart' + (this.options.chartClass !== '' ? ' ' + this.options.chartClass : '') + (this.options.direction !== 't2b' ? ' ' + this.options.direction : ''),\n 'click': function(event) {\n if (!$(event.target).closest('.node').length) {\n $chart.find('.node.focused').removeClass('focused');\n }\n }\n });\n if (typeof MutationObserver !== 'undefined') {\n this.triggerInitEvent();\n }\n var $root = $chart.append($('<ul class=\"nodes\"><li class=\"hierarchy\"></li></ul>')).find('.hierarchy');\n if ($.type(data) === 'object') {\n if (data instanceof $) { // ul datasource\n this.buildHierarchy($root, this.buildJsonDS(data.children()), 0, this.options);\n } else { // local json datasource\n this.buildHierarchy($root, this.options.ajaxURL ? data : this.attachRel(data, '00'));\n }\n } else {\n $chart.append('<i class=\"oci oci-spinner spinner\"></i>');\n $.ajax({\n 'url': data,\n 'dataType': 'json'\n })\n .done(function(data, textStatus, jqXHR) {\n that.buildHierarchy($root, that.options.ajaxURL ? data : that.attachRel(data, '00'), 0, that.options);\n })\n .fail(function(jqXHR, textStatus, errorThrown) {\n console.log(errorThrown);\n })\n .always(function() {\n $chart.children('.spinner').remove();\n });\n }\n $chartContainer.append($chart);\n\n // append the export button\n if (this.options.exportButton && !$('.oc-export-btn').length) {\n this.attachExportButton();\n }\n\n if (this.options.pan) {\n this.bindPan();\n }\n\n if (this.options.zoom) {\n this.bindZoom();\n }\n\n return this;\n },\n //\n triggerInitEvent: function () {\n var that = this;\n var mo = new MutationObserver(function (mutations) {\n mo.disconnect();\n initTime:\n for (var i = 0; i < mutations.length; i++) {\n for (var j = 0; j < mutations[i].addedNodes.length; j++) {\n if (mutations[i].addedNodes[j].classList.contains('orgchart')) {\n if (that.options.initCompleted && typeof that.options.initCompleted === 'function') {\n that.options.initCompleted(that.$chart);\n }\n var initEvent = $.Event('init.orgchart');\n that.$chart.trigger(initEvent);\n break initTime;\n }\n }\n }\n });\n mo.observe(this.$chartContainer[0], { childList: true });\n },\n triggerLoadEvent: function ($target, rel) {\n var initEvent = $.Event('load-' + rel +'.orgchart');\n $target.trigger(initEvent);\n },\n triggerShowEvent: function ($target, rel) {\n var initEvent = $.Event('show-' + rel + '.orgchart');\n $target.trigger(initEvent);\n },\n triggerHideEvent: function ($target, rel) {\n var initEvent = $.Event('hide-' + rel + '.orgchart');\n $target.trigger(initEvent);\n },\n // add export button for orgchart\n attachExportButton: function () {\n var that = this;\n var $exportBtn = $('<button>', {\n 'class': 'oc-export-btn',\n 'text': this.options.exportButtonName,\n 'click': function(e) {\n e.preventDefault();\n that.export();\n }\n });\n this.$chartContainer.after($exportBtn);\n },\n setOptions: function (opts, val) {\n if (typeof opts === 'string') {\n if (opts === 'pan') {\n if (val) {\n this.bindPan();\n } else {\n this.unbindPan();\n }\n }\n if (opts === 'zoom') {\n if (val) {\n this.bindZoom();\n } else {\n this.unbindZoom();\n }\n }\n }\n if (typeof opts === 'object') {\n if (opts.data) {\n this.init(opts);\n } else {\n if (typeof opts.pan !== 'undefined') {\n if (opts.pan) {\n this.bindPan();\n } else {\n this.unbindPan();\n }\n }\n if (typeof opts.zoom !== 'undefined') {\n if (opts.zoom) {\n this.bindZoom();\n } else {\n this.unbindZoom();\n }\n }\n }\n }\n\n return this;\n },\n //\n panStartHandler: function (e) {\n var $chart = $(e.delegateTarget);\n if ($(e.target).closest('.node').length || (e.touches && e.touches.length > 1)) {\n $chart.data('panning', false);\n return;\n } else {\n $chart.css('cursor', 'move').data('panning', true);\n }\n var lastX = 0;\n var lastY = 0;\n var lastTf = $chart.css('transform');\n if (lastTf !== 'none') {\n var temp = lastTf.split(',');\n if (lastTf.indexOf('3d') === -1) {\n lastX = parseInt(temp[4]);\n lastY = parseInt(temp[5]);\n } else {\n lastX = parseInt(temp[12]);\n lastY = parseInt(temp[13]);\n }\n }\n var startX = 0;\n var startY = 0;\n if (!e.targetTouches) { // pand on desktop\n startX = e.pageX - lastX;\n startY = e.pageY - lastY;\n } else if (e.targetTouches.length === 1) { // pan on mobile device\n startX = e.targetTouches[0].pageX - lastX;\n startY = e.targetTouches[0].pageY - lastY;\n } else if (e.targetTouches.length > 1) {\n return;\n }\n $chart.on('mousemove touchmove',function(e) {\n if (!$chart.data('panning')) {\n return;\n }\n var newX = 0;\n var newY = 0;\n if (!e.targetTouches) { // pand on desktop\n newX = e.pageX - startX;\n newY = e.pageY - startY;\n } else if (e.targetTouches.length === 1) { // pan on mobile device\n newX = e.targetTouches[0].pageX - startX;\n newY = e.targetTouches[0].pageY - startY;\n } else if (e.targetTouches.length > 1) {\n return;\n }\n var lastTf = $chart.css('transform');\n if (lastTf === 'none') {\n if (lastTf.indexOf('3d') === -1) {\n $chart.css('transform', 'matrix(1, 0, 0, 1, ' + newX + ', ' + newY + ')');\n } else {\n $chart.css('transform', 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, ' + newX + ', ' + newY + ', 0, 1)');\n }\n } else {\n var matrix = lastTf.split(',');\n if (lastTf.indexOf('3d') === -1) {\n matrix[4] = ' ' + newX;\n matrix[5] = ' ' + newY + ')';\n } else {\n matrix[12] = ' ' + newX;\n matrix[13] = ' ' + newY;\n }\n $chart.css('transform', matrix.join(','));\n }\n });\n },\n //\n panEndHandler: function (e) {\n if (e.data.chart.data('panning')) {\n e.data.chart.data('panning', false).css('cursor', 'default').off('mousemove');\n }\n },\n //\n bindPan: function () {\n this.$chartContainer.css('overflow', 'hidden');\n this.$chart.on('mousedown touchstart', this.panStartHandler);\n $(document).on('mouseup touchend', { 'chart': this.$chart }, this.panEndHandler);\n },\n //\n unbindPan: function () {\n this.$chartContainer.css('overflow', 'auto');\n this.$chart.off('mousedown touchstart', this.panStartHandler);\n $(document).off('mouseup touchend', this.panEndHandler);\n },\n //\n zoomWheelHandler: function (e) {\n var oc = e.data.oc;\n e.preventDefault();\n var newScale = 1 + (e.originalEvent.deltaY > 0 ? -0.2 : 0.2);\n oc.setChartScale(oc.$chart, newScale);\n },\n //\n zoomStartHandler: function (e) {\n if(e.touches && e.touches.length === 2) {\n var oc = e.data.oc;\n oc.$chart.data('pinching', true);\n var dist = oc.getPinchDist(e);\n oc.$chart.data('pinchDistStart', dist);\n }\n },\n zoomingHandler: function (e) {\n var oc = e.data.oc;\n if(oc.$chart.data('pinching')) {\n var dist = oc.getPinchDist(e);\n oc.$chart.data('pinchDistEnd', dist);\n }\n },\n zoomEndHandler: function (e) {\n var oc = e.data.oc;\n if(oc.$chart.data('pinching')) {\n oc.$chart.data('pinching', false);\n var diff = oc.$chart.data('pinchDistEnd') - oc.$chart.data('pinchDistStart');\n if (diff > 0) {\n oc.setChartScale(oc.$chart, 1.2);\n } else if (diff < 0) {\n oc.setChartScale(oc.$chart, 0.8);\n }\n }\n },\n //\n bindZoom: function () {\n this.$chartContainer.on('wheel', { 'oc': this }, this.zoomWheelHandler);\n this.$chartContainer.on('touchstart', { 'oc': this }, this.zoomStartHandler);\n $(document).on('touchmove', { 'oc': this }, this.zoomingHandler);\n $(document).on('touchend', { 'oc': this }, this.zoomEndHandler);\n },\n unbindZoom: function () {\n this.$chartContainer.off('wheel', this.zoomWheelHandler);\n this.$chartContainer.off('touchstart', this.zoomStartHandler);\n $(document).off('touchmove', this.zoomingHandler);\n $(document).off('touchend', this.zoomEndHandler);\n },\n //\n getPinchDist: function (e) {\n return Math.sqrt((e.touches[0].clientX - e.touches[1].clientX) * (e.touches[0].clientX - e.touches[1].clientX) +\n (e.touches[0].clientY - e.touches[1].clientY) * (e.touches[0].clientY - e.touches[1].clientY));\n },\n //\n setChartScale: function ($chart, newScale) {\n var opts = $chart.data('options');\n var lastTf = $chart.css('transform');\n var matrix = '';\n var targetScale = 1;\n if (lastTf === 'none') {\n $chart.css('transform', 'scale(' + newScale + ',' + newScale + ')');\n } else {\n matrix = lastTf.split(',');\n if (lastTf.indexOf('3d') === -1) {\n targetScale = Math.abs(window.parseFloat(matrix[3]) * newScale);\n if (targetScale > opts.zoomoutLimit && targetScale < opts.zoominLimit) {\n $chart.css('transform', lastTf + ' scale(' + newScale + ',' + newScale + ')');\n }\n } else {\n targetScale = Math.abs(window.parseFloat(matrix[1]) * newScale);\n if (targetScale > opts.zoomoutLimit && targetScale < opts.zoominLimit) {\n $chart.css('transform', lastTf + ' scale3d(' + newScale + ',' + newScale + ', 1)');\n }\n }\n }\n },\n //\n buildJsonDS: function ($li) {\n var that = this;\n var subObj = {\n 'name': $li.contents().eq(0).text().trim(),\n 'relationship': ($li.parent().parent().is('li') ? '1': '0') + ($li.siblings('li').length ? 1: 0) + ($li.children('ul').length ? 1 : 0)\n };\n $.each($li.data(), function(key, value) {\n subObj[key] = value;\n });\n $li.children('ul').children().each(function() {\n if (!subObj.children) { subObj.children = []; }\n subObj.children.push(that.buildJsonDS($(this)));\n });\n return subObj;\n },\n //\n attachRel: function (data, flags) {\n var that = this;\n data.relationship = flags + (data.children && data.children.length > 0 ? 1 : 0);\n if (data.children) {\n data.children.forEach(function(item) {\n that.attachRel(item, '1' + (data.children.length > 1 ? 1 : 0));\n });\n }\n return data;\n },\n //\n loopChart: function ($chart, includeNodeData) {\n includeNodeData = (includeNodeData !== null && includeNodeData !== undefined) ? includeNodeData : false;\n var that = this;\n var $node = $chart.find('.node:first');\n var subObj = { 'id': $node[0].id };\n if (includeNodeData) {\n $.each($node.data('nodeData'), function (key, value) {\n subObj[key] = value;\n });\n }\n $node.siblings('.nodes').children().each(function() {\n if (!subObj.children) { subObj.children = []; }\n subObj.children.push(that.loopChart($(this), includeNodeData));\n });\n return subObj;\n },\n //\n getHierarchy: function (includeNodeData) {\n includeNodeData = (includeNodeData !== null && includeNodeData !== undefined) ? includeNodeData : false;\n if (typeof this.$chart === 'undefined') {\n return 'Error: orgchart does not exist'\n } else {\n if (!this.$chart.find('.node').length) {\n return 'Error: nodes do not exist'\n } else {\n var valid = true;\n this.$chart.find('.node').each(function () {\n if (!this.id) {\n valid = false;\n return false;\n }\n });\n if (!valid) {\n return 'Error: All nodes of orghcart to be exported must have data-id attribute!';\n }\n }\n }\n return this.loopChart(this.$chart, includeNodeData);\n },\n // detect the exist/display state of related node\n getNodeState: function ($node, relation) {\n var $target = {};\n var isVerticalNode = !!$node.closest('vertical').length;\n var relation = relation || 'self';\n if (relation === 'parent') {\n if (isVerticalNode) {\n $target = $node.closest('ul').parents('ul');\n if (!$target.length) {\n $target = $node.closest('.nodes');\n if (!$target.length) {\n $target = $node.closest('.vertical').siblings(':first');\n }\n }\n } else {\n $target = $node.closest('.nodes').siblings('.node');\n }\n if ($target.length) {\n if ($target.is('.hidden') || (!$target.is('.hidden') && $target.closest('.nodes').is('.hidden')) || (!$target.is('.hidden') && $target.closest('.vertical').is('.hidden'))) {\n return { 'exist': true, 'visible': false };\n }\n return { 'exist': true, 'visible': true };\n }\n } else if (relation === 'children') {\n $target = isVerticalNode ? $node.parent().children('ul') : $node.siblings('.nodes');\n if ($target.length) {\n if (!$target.is('.hidden')) {\n return { 'exist': true, 'visible': true };\n }\n return { 'exist': true, 'visible': false };\n }\n } else if (relation === 'siblings') {\n $target = isVerticalNode ? $node.closest('ul') : $node.parent().siblings();\n if ($target.length && (!isVerticalNode || $target.children('li').length > 1)) {\n if (!$target.is('.hidden') && !$target.parent().is('.hidden') && (!isVerticalNode || !$target.closest('.vertical').is('.hidden'))) {\n return { 'exist': true, 'visible': true };\n }\n return { 'exist': true, 'visible': false };\n }\n } else {\n $target = $node;\n if ($target.length) {\n if (!(($target.closest('.nodes').length && $target.closest('.nodes').is('.hidden')) ||\n ($target.closest('.hierarchy').length && $target.closest('.hierarchy').is('.hidden')) ||\n ($target.closest('.vertical').length && ($target.closest('.nodes').is('.hidden') || $target.closest('.vertical').is('.hidden')))\n )) {\n return { 'exist': true, 'visible': true };\n }\n return { 'exist': true, 'visible': false };\n }\n }\n return { 'exist': false, 'visible': false };\n },\n getParent: function ($node) {\n return this.getRelatedNodes($node, 'parent');\n },\n getChildren: function ($node) {\n return this.getRelatedNodes($node, 'children');\n },\n getSiblings: function ($node) {\n return this.getRelatedNodes($node, 'siblings');\n },\n // find the related nodes\n getRelatedNodes: function ($node, relation) {\n if (!$node || !($node instanceof $) || !$node.is('.node')) {\n return $();\n }\n if (relation === 'parent') {\n return $node.closest('.nodes').siblings('.node');\n } else if (relation === 'children') {\n return $node.siblings('.nodes').children('.hierarchy').find('.node:first');\n } else if (relation === 'siblings') {\n return $node.closest('.hierarchy').siblings().find('.node:first');\n } else {\n return $();\n }\n },\n hideParentEnd: function (event) {\n $(event.target).removeClass('sliding');\n event.data.parent.addClass('hidden');\n },\n // recursively hide the ancestor node and sibling nodes of the specified node\n hideParent: function ($node) {\n var $parent = $node.closest('.nodes').siblings('.node');\n if ($parent.find('.spinner').length) {\n $node.closest('.orgchart').data('inAjax', false);\n }\n // hide the sibling nodes\n if (this.getNodeState($node, 'siblings').visible) {\n this.hideSiblings($node);\n }\n // hide the lines\n $node.parent().addClass('isAncestorsCollapsed');\n // hide the superior nodes with transition\n if (this.getNodeState($parent).visible) {\n $parent.addClass('sliding slide-down').one('transitionend', { 'parent': $parent }, this.hideParentEnd);\n }\n // if the current node has the parent node, hide it recursively\n if (this.getNodeState($parent, 'parent').visible) {\n this.hideParent($parent);\n }\n },\n showParentEnd: function (event) {\n var $node = event.data.node;\n $(event.target).removeClass('sliding');\n if (this.isInAction($node)) {\n this.switchVerticalArrow($node.children('.topEdge'));\n }\n },\n // show the parent node of the specified node\n showParent: function ($node) {\n // just show only one superior level\n var $parent = $node.closest('.nodes').siblings('.node').removeClass('hidden');\n // just show only one line\n $node.closest('.hierarchy').removeClass('isAncestorsCollapsed');\n // show parent node with animation\n this.repaint($parent[0]);\n $parent.addClass('sliding').removeClass('slide-down').one('transitionend', { 'node': $node }, this.showParentEnd.bind(this));\n },\n stopAjax: function ($nodeLevel) {\n if ($nodeLevel.find('.spinner').length) {\n $nodeLevel.closest('.orgchart').data('inAjax', false);\n }\n },\n isVisibleNode: function (index, elem) {\n return this.getNodeState($(elem)).visible;\n },\n // do some necessary cleanup tasks when hide animation is finished\n hideChildrenEnd: function (event) {\n var $node = event.data.node;\n event.data.animatedNodes.removeClass('sliding');\n event.data.animatedNodes.closest('.nodes').addClass('hidden');\n if (this.isInAction($node)) {\n this.switchVerticalArrow($node.children('.bottomEdge'));\n }\n },\n // recursively hide the descendant nodes of the specified node\n hideChildren: function ($node) {\n $node.closest('.hierarchy').addClass('isChildrenCollapsed');\n var $lowerLevel = $node.siblings('.nodes');\n this.stopAjax($lowerLevel);\n var $animatedNodes = $lowerLevel.find('.node').filter(this.isVisibleNode.bind(this));\n var isVerticalDesc = $lowerLevel.is('.vertical');\n if (!isVerticalDesc) {\n $animatedNodes.closest('.hierarchy').addClass('isCollapsedDescendant');\n }\n if ($lowerLevel.is('.vertical') || $lowerLevel.find('.vertical').length) {\n $animatedNodes.find('.oci-minus-square').removeClass('oci-minus-square').addClass('oci-plus-square');\n }\n this.repaint($animatedNodes.get(0));\n $animatedNodes.addClass('sliding slide-up').eq(0).one('transitionend', { 'animatedNodes': $animatedNodes, 'lowerLevel': $lowerLevel, 'node': $node }, this.hideChildrenEnd.bind(this));\n },\n //\n showChildrenEnd: function (event) {\n var $node = event.data.node;\n event.data.animatedNodes.removeClass('sliding');\n if (this.isInAction($node)) {\n this.switchVerticalArrow($node.children('.bottomEdge'));\n }\n },\n // show the children nodes of the specified node\n showChildren: function ($node) {\n var that = this;\n $node.closest('.hierarchy').removeClass('isChildrenCollapsed');\n var $levels = $node.siblings('.nodes');\n var isVerticalDesc = $levels.is('.vertical');\n var $animatedNodes = isVerticalDesc\n ? $levels.removeClass('hidden').find('.node').filter(this.isVisibleNode.bind(this))\n : $levels.removeClass('hidden').children('.hierarchy').find('.node:first').filter(this.isVisibleNode.bind(this));\n if (!isVerticalDesc) {\n $animatedNodes.filter(':not(:only-child)').closest('.hierarchy').addClass('isChildrenCollapsed');\n $animatedNodes.closest('.hierarchy').removeClass('isCollapsedDescendant');\n }\n // the two following statements are used to enforce browser to repaint\n this.repaint($animatedNodes.get(0));\n $animatedNodes.addClass('sliding').removeClass('slide-up').eq(0).one('transitionend', { 'node': $node, 'animatedNodes': $animatedNodes }, this.showChildrenEnd.bind(this));\n },\n //\n hideSiblingsEnd: function (event) {\n var $node = event.data.node;\n var $nodeContainer = event.data.nodeContainer;\n var direction = event.data.direction;\n var $siblings = direction ? (direction === 'left' ? $nodeContainer.prevAll(':not(.hidden)') : $nodeContainer.nextAll(':not(.hidden)')) : $nodeContainer.siblings();\n event.data.animatedNodes.removeClass('sliding');\n $siblings.find('.node:gt(0)').filter(this.isVisibleNode.bind(this))\n .removeClass('slide-left slide-right').addClass('slide-up');\n $siblings.find('.nodes, .vertical').addClass('hidden')\n .end().addClass('hidden');\n\n if (this.isInAction($node)) {\n this.switchHorizontalArrow($node);\n }\n },\n // hide the sibling nodes of the specified node\n hideSiblings: function ($node, direction) {\n var that = this;\n var $nodeContainer = $node.closest('.hierarchy').addClass('isSiblingsCollapsed');\n if ($nodeContainer.siblings().find('.spinner').length) {\n $node.closest('.orgchart').data('inAjax', false);\n }\n if (direction) {\n if (direction === 'left') {\n $nodeContainer.addClass('left-sibs')\n .prevAll('.isSiblingsCollapsed').removeClass('isSiblingsCollapsed left-sibs').end()\n .prevAll().addClass('isCollapsedSibling isChildrenCollapsed')\n .find('.node').filter(this.isVisibleNode.bind(this)).addClass('sliding slide-right');\n } else {\n $nodeContainer.addClass('right-sibs')\n .nextAll('.isSiblingsCollapsed').removeClass('isSiblingsCollapsed right-sibs').end()\n .nextAll().addClass('isCollapsedSibling isChildrenCollapsed')\n .find('.node').filter(this.isVisibleNode.bind(this)).addClass('sliding slide-left');\n }\n } else {\n $nodeContainer.prevAll().find('.node').filter(this.isVisibleNode.bind(this)).addClass('sliding slide-right');\n $nodeContainer.nextAll().find('.node').filter(this.isVisibleNode.bind(this)).addClass('sliding slide-left');\n $nodeContainer.siblings().addClass('isCollapsedSibling isChildrenCollapsed');\n }\n var $animatedNodes = $nodeContainer.siblings().find('.sliding');\n $animatedNodes.eq(0).one('transitionend', { 'node': $node, 'nodeContainer': $nodeContainer, 'direction': direction, 'animatedNodes': $animatedNodes }, this.hideSiblingsEnd.bind(this));\n },\n //\n showSiblingsEnd: function (event) {\n var $node = event.data.node;\n event.data.visibleNodes.removeClass('sliding');\n if (this.isInAction($node)) {\n this.switchHorizontalArrow($node);\n $node.children('.topEdge').removeClass('oci-chevron-up').addClass('oci-chevron-down');\n }\n },\n //\n showRelatedParentEnd: function(event) {\n $(event.target).removeClass('sliding');\n },\n // show the sibling nodes of the specified node\n showSiblings: function ($node, direction) {\n var that = this;\n // firstly, show the sibling nodes\n var $siblings = $();\n var $nodeContainer = $node.closest('.hierarchy');\n if (direction) {\n if (direction === 'left') {\n $siblings = $nodeContainer.prevAll().removeClass('hidden');\n } else {\n $siblings = $nodeContainer.nextAll().removeClass('hidden');\n }\n } else {\n $siblings = $node.closest('.hierarchy').siblings().removeClass('hidden');\n }\n // secondly, show the lines\n var $upperLevel = $node.closest('.nodes').siblings('.node');\n if (direction) {\n $nodeContainer.removeClass(direction + '-sibs');\n if (!$nodeContainer.is('[class*=-sibs]')) {\n $nodeContainer.removeClass('isSiblingsCollapsed');\n }\n $siblings.removeClass('isCollapsedSibling ' + direction + '-sibs');\n } else {\n $node.closest('.hierarchy').removeClass('isSiblingsCollapsed');\n $siblings.removeClass('isCollapsedSibling');\n }\n // thirdly, show parent node if it is collapsed\n if (!this.getNodeState($node, 'parent').visible) {\n $node.closest('.hierarchy').removeClass('isAncestorsCollapsed');\n $upperLevel.removeClass('hidden');\n this.repaint($upperLevel[0]);\n $upperLevel.addClass('sliding').removeClass('slide-down').one('transitionend', this.showRelatedParentEnd);\n }\n // lastly, show the sibling nodes with animation\n var $visibleNodes = $siblings.find('.node').filter(this.isVisibleNode.bind(this));\n this.repaint($visibleNodes.get(0));\n $visibleNodes.addClass('sliding').removeClass('slide-left slide-right');\n $visibleNodes.eq(0).one('transitionend', { 'node': $node, 'visibleNodes': $visibleNodes }, this.showSiblingsEnd.bind(this));\n },\n // start up loading status for requesting new nodes\n startLoading: function ($edge) {\n var $chart = this.$chart;\n if (typeof $chart.data('inAjax') !== 'undefined' && $chart.data('inAjax') === true) {\n return false;\n }\n\n $edge.addClass('hidden');\n $edge.parent().append('<i class=\"oci oci-spinner spinner\"></i>')\n .children().not('.spinner').css('opacity', 0.2);\n $chart.data('inAjax', true);\n $('.oc-export-btn').prop('disabled', true);\n return true;\n },\n // terminate loading status for requesting new nodes\n endLoading: function ($edge) {\n var $node = $edge.parent();\n $edge.removeClass('hidden');\n $node.find('.spinner').remove();\n $node.children().removeAttr('style');\n this.$chart.data('inAjax', false);\n $('.oc-export-btn').prop('disabled', false);\n },\n // whether the cursor is hovering over the node\n isInAction: function ($node) {\n return $node.children('.edge').attr('class').indexOf('oci-') > -1 ? true : false;\n },\n //\n switchVerticalArrow: function ($arrow) {\n $arrow.toggleClass('oci-chevron-up').toggleClass('oci-chevron-down');\n },\n //\n switchHorizontalArrow: function ($node) {\n var opts = this.options;\n if (opts.toggleSiblingsResp && (typeof opts.ajaxURL === 'undefined' || $node.closest('.nodes').data('siblingsLoaded'))) {\n var $prevSib = $node.parent().prev();\n if ($prevSib.length) {\n if ($prevSib.is('.hidden')) {\n $node.children('.leftEdge').addClass('oci-chevron-left').removeClass('oci-chevron-right');\n } else {\n $node.children('.leftEdge').addClass('oci-chevron-right').removeClass('oci-chevron-left');\n }\n }\n var $nextSib = $node.parent().next();\n if ($nextSib.length) {\n if ($nextSib.is('.hidden')) {\n $node.children('.rightEdge').addClass('oci-chevron-right').removeClass('oci-chevron-left');\n } else {\n $node.children('.rightEdge').addClass('oci-chevron-left').removeClass('oci-chevron-right');\n }\n }\n } else {\n var $sibs = $node.parent().siblings();\n var sibsVisible = $sibs.length ? !$sibs.is('.hidden') : false;\n $node.children('.leftEdge').toggleClass('oci-chevron-right', sibsVisible).toggleClass('oci-chevron-left', !sibsVisible);\n $node.children('.rightEdge').toggleClass('oci-chevron-left', sibsVisible).toggleClass('oci-chevron-right', !sibsVisible);\n }\n },\n //\n repaint: function (node) {\n if (node) {\n node.style.offsetWidth = node.offsetWidth;\n }\n },\n // determines how to show arrow buttons \n nodeEnterLeaveHandler: function (event) {\n var $node = $(event.delegateTarget);\n var flag = false;\n if ($node.closest('.nodes.vertical').length) {\n var $toggleBtn = $node.children('.toggleBtn');\n if (event.type === 'mouseenter') {\n if ($node.children('.toggleBtn').length) {\n flag = this.getNodeState($node, 'children').visible;\n $toggleBtn.toggleClass('oci-plus-square', !flag).toggleClass('oci-minus-square', flag);\n }\n } else {\n $toggleBtn.removeClass('oci-plus-square oci-minus-square');\n }\n } else {\n var $topEdge = $node.children('.topEdge');\n var $rightEdge = $node.children('.rightEdge');\n var $bottomEdge = $node.children('.bottomEdge');\n var $leftEdge = $node.children('.leftEdge');\n if (event.type === 'mouseenter') {\n if ($topEdge.length) {\n flag = this.getNodeState($node, 'parent').visible;\n $topEdge.toggleClass('oci-chevron-up', !flag).toggleClass('oci-chevron-down', flag);\n }\n if ($bottomEdge.length) {\n flag = this.getNodeState($node, 'children').visible;\n $bottomEdge.toggleClass('oci-chevron-down', !flag).toggleClass('oci-chevron-up', flag);\n }\n if ($leftEdge.length) {\n this.switchHorizontalArrow($node);\n }\n } else {\n $node.children('.edge').removeClass('oci-chevron-up oci-chevron-down oci-chevron-right oci-chevron-left');\n }\n }\n },\n //\n nodeClickHandler: function (event) {\n this.$chart.find('.focused').removeClass('focused');\n $(event.delegateTarget).addClass('focused');\n },\n // load new nodes by ajax\n loadNodes: function (rel, url, $edge) {\n var that = this;\n var opts = this.options;\n $.ajax({ 'url': url, 'dataType': 'json' })\n .done(function (data) {\n if (that.$chart.data('inAjax')) {\n if (rel === 'parent') {\n if (!$.isEmptyObject(data)) {\n that.addParent($edge.parent(), data);\n }\n } else if (rel === 'children') {\n if (data.children.length) {\n that.addChildren($edge.parent(), data[rel]);\n }\n } else {\n that.addSiblings($edge.parent(), data.siblings ? data.siblings : data);\n }\n that.triggerLoadEvent($edge.parent(), rel);\n }\n })\n .fail(function () {\n console.log('Failed to get ' + rel + ' data');\n })\n .always(function () {\n that.endLoading($edge);\n });\n },\n //\n HideFirstParentEnd: function (event) {\n var $topEdge = event.data.topEdge;\n var $node = $topEdge.parent();\n if (this.isInAction($node)) {\n this.switchVerticalArrow($topEdge);\n this.switchHorizontalArrow($node);\n }\n },\n // actions on clinking top edge of a node\n topEdgeClickHandler: function (event) {\n event.stopPropagation();\n var that = this;\n var $topEdge = $(event.target);\n var $node = $(event.delegateTarget);\n var parentState = this.getNodeState($node, 'parent');\n if (parentState.exist) {\n var $parent = $node.closest('.nodes').siblings('.node');\n if ($parent.is('.sliding')) { return; }\n // hide the ancestor nodes and sibling nodes of the specified node\n if (parentState.visible) {\n this.hideParent($node);\n $parent.one('transitionend', { 'topEdge': $topEdge }, this.HideFirstParentEnd.bind(this));\n this.triggerHideEvent($node, 'parent');\n } else { // show the ancestors and siblings\n this.showParent($node);\n this.triggerShowEvent($node, 'parent');\n }\n } else { // load the new parent node of the specified node by ajax request\n // start up loading status\n if (this.startLoading($topEdge)) {\n var opts = this.options;\n var url = $.isFunction(opts.ajaxURL.parent) ? opts.ajaxURL.parent($node.data('nodeData')) : opts.ajaxURL.parent + $node[0].id;\n this.loadNodes('parent', url, $topEdge);\n }\n }\n },\n // actions on clinking bottom edge of a node\n bottomEdgeClickHandler: function (event) {\n event.stopPropagation();\n var $bottomEdge = $(event.target);\n var $node = $(event.delegateTarget);\n var childrenState = this.getNodeState($node, 'children');\n if (childrenState.exist) {\n var $children = $node.siblings('.nodes').children().children('.node');\n if ($children.is('.sliding')) { return; }\n // hide the descendant nodes of the specified node\n if (childrenState.visible) {\n this.hideChildren($node);\n this.triggerHideEvent($node, 'children');\n } else { // show the descendants\n this.showChildren($node);\n this.triggerShowEvent($node, 'children');\n }\n } else { // load the new children nodes of the specified node by ajax request\n if (this.startLoading($bottomEdge)) {\n var opts = this.options;\n var url = $.isFunction(opts.ajaxURL.children) ? opts.ajaxURL.children($node.data('nodeData')) : opts.ajaxURL.children + $node[0].id;\n this.loadNodes('children', url, $bottomEdge);\n }\n }\n },\n // actions on clicking horizontal edges\n hEdgeClickHandler: function (event) {\n event.stopPropagation();\n var $hEdge = $(event.target);\n var $node = $(event.delegateTarget);\n var opts = this.options;\n var siblingsState = this.getNodeState($node, 'siblings');\n if (siblingsState.exist) {\n var $siblings = $node.closest('.hierarchy').siblings();\n if ($siblings.find('.sliding').length) { return; }\n if (opts.toggleSiblingsResp) {\n var $prevSib = $node.closest('.hierarchy').prev();\n var $nextSib = $node.closest('.hierarchy').next();\n if ($hEdge.is('.leftEdge')) {\n if ($prevSib.is('.hidden')) {\n this.showSiblings($node, 'left');\n this.triggerShowEvent($node,'siblings');\n } else {\n this.hideSiblings($node, 'left');\n this.triggerHideEvent($node, 'siblings');\n }\n } else {\n if ($nextSib.is('.hidden')) {\n this.showSiblings($node, 'right');\n this.triggerShowEvent($node,'siblings');\n } else {\n this.hideSiblings($node, 'right');\n this.triggerHideEvent($node, 'siblings');\n }\n }\n } else {\n if (siblingsState.visible) {\n this.hideSiblings($node);\n this.triggerHideEvent($node, 'siblings');\n } else {\n this.showSiblings($node);\n this.triggerShowEvent($node, 'siblings');\n }\n }\n } else {\n // load the new sibling nodes of the specified node by ajax request\n if (this.startLoading($hEdge)) {\n var nodeId = $node[0].id;\n var url = (this.getNodeState($node, 'parent').exist) ?\n ($.isFunction(opts.ajaxURL.siblings) ? opts.ajaxURL.siblings($node.data('nodeData')) : opts.ajaxURL.siblings + nodeId) :\n ($.isFunction(opts.ajaxURL.families) ? opts.ajaxURL.families($node.data('nodeData')) : opts.ajaxURL.families + nodeId);\n this.loadNodes('siblings', url, $hEdge);\n }\n }\n },\n //\n expandVNodesEnd: function (event) {\n event.data.vNodes.removeClass('sliding');\n },\n //\n collapseVNodesEnd: function (event) {\n event.data.vNodes.removeClass('sliding').closest('ul').addClass('hidden');\n },\n // event handler for toggle buttons in Hybrid(horizontal + vertical) OrgChart\n toggleVNodes: function (event) {\n var $toggleBtn = $(event.target);\n var $descWrapper = $toggleBtn.parent().next();\n var $descendants = $descWrapper.find('.node');\n var $children = $descWrapper.children().children('.node');\n if ($children.is('.sliding')) { return; }\n $toggleBtn.toggleClass('oci-plus-square oci-minus-square');\n if ($descendants.eq(0).is('.slide-up')) {\n $descWrapper.removeClass('hidden');\n this.repaint($children.get(0));\n $children.addClass('sliding').removeClass('slide-up').eq(0).one('transitionend', { 'vNodes': $children }, this.expandVNodesEnd);\n } else {\n $descendants.addClass('sliding slide-up').eq(0).one('transitionend', { 'vNodes': $descendants }, this.collapseVNodesEnd);\n $descendants.find('.toggleBtn').removeClass('oci-minus-square').addClass('oci-plus-square');\n }\n },\n //\n createGhostNode: function (event) {\n var $nodeDiv = $(event.target);\n var opts = this.options;\n var origEvent = event.originalEvent;\n var isFirefox = /firefox/.test(window.navigator.userAgent.toLowerCase());\n var ghostNode, nodeCover;\n if (!document.querySelector('.ghost-node')) {\n ghostNode = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n if (!ghostNode.classList) return;\n ghostNode.classList.add('ghost-node');\n nodeCover = document.createElementNS('http://www.w3.org/2000/svg','rect');\n ghostNode.appendChild(nodeCover);\n $nodeDiv.closest('.orgchart').append(ghostNode);\n } else {\n ghostNode = $nodeDiv.closest('.orgchart').children('.ghost-node').get(0);\n nodeCover = $(ghostNode).children().get(0);\n }\n var transValues = $nodeDiv.closest('.orgchart').css('transform').split(',');\n var isHorizontal = opts.direction === 't2b' || opts.direction === 'b2t';\n var scale = Math.abs(window.parseFloat(isHorizontal ? transValues[0].slice(transValues[0].indexOf('(') + 1) : transValues[1]));\n ghostNode.setAttribute('width', isHorizontal ? $nodeDiv.outerWidth(false) : $nodeDiv.outerHeight(false));\n ghostNode.setAttribute('height', isHorizontal ? $nodeDiv.outerHeight(false) : $nodeDiv.outerWidth(false));\n nodeCover.setAttribute('x',5 * scale);\n nodeCover.setAttribute('y',5 * scale);\n nodeCover.setAttribute('width', 120 * scale);\n nodeCover.setAttribute('height', 40 * scale);\n nodeCover.setAttribute('rx', 4 * scale);\n nodeCover.setAttribute('ry', 4 * scale);\n nodeCover.setAttribute('stroke-width', 1 * scale);\n var xOffset = origEvent.offsetX * scale;\n var yOffset = origEvent.offsetY * scale;\n if (opts.direction === 'l2r') {\n xOffset = origEvent.offsetY * scale;\n yOffset = origEvent.offsetX * scale;\n } else if (opts.direction === 'r2l') {\n xOffset = $nodeDiv.outerWidth(false) - origEvent.offsetY * scale;\n yOffset = origEvent.offsetX * scale;\n } else if (opts.direction === 'b2t') {\n xOffset = $nodeDiv.outerWidth(false) - origEvent.offsetX * scale;\n yOffset = $nodeDiv.outerHeight(false) - origEvent.offsetY * scale;\n }\n if (isFirefox) { // hack for old version of Firefox(< 48.0)\n nodeCover.setAttribute('fill', 'rgb(255, 255, 255)');\n nodeCover.setAttribute('stroke', 'rgb(191, 0, 0)');\n var ghostNodeWrapper = document.createElement('img');\n ghostNodeWrapper.src = 'data:image/svg+xml;utf8,' + (new XMLSerializer()).serializeToString(ghostNode);\n origEvent.dataTransfer.setDragImage(ghostNodeWrapper, xOffset, yOffset);\n } else {\n // IE/Edge do not support this, so only use it if we can\n if (origEvent.dataTransfer.setDragImage)\n origEvent.dataTransfer.setDragImage(ghostNode, xOffset, yOffset);\n }\n },\n // get the level amount of a hierachy\n getUpperLevel: function ($node) {\n if (!$node.is('.node')) {\n return 0;\n }\n return $node.parents('.hierarchy').length;\n },\n // get the level amount of a hierachy\n getLowerLevel: function ($node) {\n if (!$node.is('.node')) {\n return 0;\n }\n return $node.closest('.hierarchy').find('.nodes').length + 1;\n },\n // get nodes in level order traversal\n getLevelOrderNodes: function ($root) {\n if(!$root) return [];\n var queue = [];\n var output = [];\n queue.push($root);\n while(queue.length) {\n var row = [];\n for(var i = 0; i < queue.length; i++) {\n var cur = queue.shift();\n var children = this.getChildren(cur);\n if(children.length) {\n queue.push(children.toArray().flat());\n }\n row.push($(cur));\n }\n output.push(row);\n }\n return output;\n },\n //\n filterAllowedDropNodes: function ($dragged) {\n var opts = this.options;\n // what is being dragged? a node, or something within a node?\n var draggingNode = $dragged.closest('[draggable]').hasClass('node');\n var $dragZone = $dragged.closest('.nodes').siblings('.node'); // parent node\n var $dragHier = $dragged.closest('.hierarchy').find('.node'); // this node, and its children\n this.$chart.data('dragged', $dragged)\n .find('.node').each(function (index, node) {\n if (!draggingNode || $dragHier.index(node) === -1) {\n if (opts.dropCriteria) {\n if (opts.dropCriteria($dragged, $dragZone, $(node))) {\n $(node).addClass('allowedDrop');\n }\n } else {\n $(node).addClass('allowedDrop');\n }\n }\n });\n },\n //\n dragstartHandler: function (event) {\n event.originalEvent.dataTransfer.setData('text/html', 'hack for firefox');\n // if users enable zoom or direction options\n if (this.$chart.css('transform') !== 'none') {\n this.createGhostNode(event);\n }\n this.filterAllowedDropNodes($(event.target));\n },\n //\n dragoverHandler: function (event) {\n if (!$(event.delegateTarget).is('.allowedDrop')) {\n event.originalEvent.dataTransfer.dropEffect = 'none';\n } else {\n // default action for drag-and-drop of div is not to drop, so preventing default action for nodes which have allowedDrop class\n //to fix drag and drop on IE and Edge\n event.preventDefault();\n }\n },\n //\n dragendHandler: function (event) {\n this.$chart.find('.allowedDrop').removeClass('allowedDrop');\n },\n // when user drops the node, it will be removed from original parent node and be added to new parent node\n dropHandler: function (event) {\n var $dropZone = $(event.delegateTarget);\n var $dragged = this.$chart.data('dragged');\n\n // Pass on drops which are not nodes (since they are not our doing)\n if (!$dragged.hasClass('node')) {\n this.$chart.triggerHandler({ 'type': 'otherdropped.orgchart', 'draggedItem': $dragged, 'dropZone': $dropZone });\n return;\n }\n\n if (!$dropZone.hasClass('allowedDrop')) {\n // We are trying to drop a node into a node which isn't allowed\n // IE/Edge have a habit of allowing this, so we need our own double-check\n return;\n }\n\n var $dragZone = $dragged.closest('.nodes').siblings('.node');\n var dropEvent = $.Event('nodedrop.orgchart');\n this.$chart.trigger(dropEvent, { 'draggedNode': $dragged, 'dragZone': $dragZone, 'dropZone': $dropZone });\n if (dropEvent.isDefaultPrevented()) {\n return;\n }\n // firstly, deal with the hierarchy of drop zone\n if (!$dropZone.siblings('.nodes').length) { // if the drop zone is a leaf node\n $dropZone.append('<i class=\"edge verticalEdge bottomEdge oci\"></i>')\n .after('<ul class=\"nodes\"></ul>')\n .siblings('.nodes').append($dragged.find('.horizontalEdge').remove().end().closest('.hierarchy'));\n if ($dropZone.children('.title').length) {\n $dropZone.children('.title').prepend('<i class=\"oci '+ this.$chart.data('options').parentNodeSymbol + ' symbol\"></i>');\n }\n } else {\n var horizontalEdges = '<i class=\"edge horizontalEdge rightEdge oci\"></i><i class=\"edge horizontalEdge leftEdge oci\"></i>';\n if (!$dragged.find('.horizontalEdge').length) {\n $dragged.append(horizontalEdges);\n }\n $dropZone.siblings('.nodes').append($dragged.closest('.hierarchy'));\n var $dropSibs = $dragged.closest('.hierarchy').siblings().find('.node:first');\n if ($dropSibs.length === 1) {\n $dropSibs.append(horizontalEdges);\n }\n }\n // secondly, deal with the hierarchy of dragged node\n if ($dragZone.siblings('.nodes').children('.hierarchy').length === 1) { // if there is only one sibling node left\n $dragZone.siblings('.nodes').children('.hierarchy').find('.node:first')\n .find('.horizontalEdge').remove();\n } else if ($dragZone.siblings('.nodes').children('.hierarchy').length === 0) {\n $dragZone.find('.bottomEdge, .symbol').remove()\n .end().siblings('.nodes').remove();\n }\n },\n //\n touchstartHandler: function (event) {\n if (this.touchHandled)\n return;\n\n if (event.touches && event.touches.length > 1)\n return;\n\n this.touchHandled = true;\n this.touchMoved = false; // this is so we can work out later if this was a 'press' or a 'drag' touch\n event.preventDefault();\n },\n //\n touchmoveHandler: function (event) {\n if (!this.touchHandled)\n return;\n\n if (event.touches && event.touches.length > 1)\n return;\n\n event.preventDefault();\n\n if (!this.touchMoved) {\n // we do not bother with createGhostNode (dragstart does) since the touch event does not have a dataTransfer property\n this.filterAllowedDropNodes($(event.currentTarget)); // will also set 'this.$chart.data('dragged')' for us\n // create an image which can be used to illustrate the drag (our own createGhostNode)\n this.touchDragImage = this.createDragImage(event, this.$chart.data('dragged')[0]);\n }\n this.touchMoved = true;\n\n // move our dragimage so it follows our finger\n this.moveDragImage(event, this.touchDragImage);\n\n var $touching = $(document.elementFromPoint(event.touches[0].clientX, event.touches[0].clientY));\n var $touchingNodes = $touching.closest('div.node');\n if ($touchingNodes.length > 0) {\n var touchingNodeElement = $touchingNodes[0];\n if ($touchingNodes.is('.allowedDrop')) {\n this.touchTargetNode = touchingNodeElement;\n }\n else {\n this.touchTargetNode = null;\n }\n }\n else {\n this.touchTargetNode = null;\n }\n },\n //\n touchendHandler: function (event) {\n if (!this.touchHandled) {\n return;\n }\n this.destroyDragImage();\n if (this.touchMoved) {\n // we've had movement, so this was a 'drag' touch\n if (this.touchTargetNode) {\n var fakeEventForDropHandler = { delegateTarget: this.touchTargetNode };\n this.dropHandler(fakeEventForDropHandler);\n this.touchTargetNode = null;\n }\n this.dragendHandler(event);\n }\n else {\n // we did not move, so this was a 'press' touch (fake a click)\n var firstTouch = event.changedTouches[0];\n var fakeMouseClickEvent = document.createEvent('MouseEvents');\n fakeMouseClickEvent.initMouseEvent('click', true, true, window, 1, firstTouch.screenX, firstTouch.screenY, firstTouch.clientX, firstTouch.clientY, event.ctrlKey, event.altKey, event.shiftKey, event.metaKey, 0, null);\n event.target.dispatchEvent(fakeMouseClickEvent);\n }\n this.touchHandled = false;\n },\n //\n createDragImage: function (event, source) {\n var dragImage = source.cloneNode(true);\n this.copyStyle(source, dragImage);\n dragImage.style.top = dragImage.style.left = '-9999px';\n var sourceRectangle = source.getBoundingClientRect();\n var sourcePoint = this.getTouchPoint(event);\n this.touchDragImageOffset = { x: sourcePoint.x - sourceRectangle.left, y: sourcePoint.y - sourceRectangle.top };\n dragImage.style.opacity = '0.5';\n document.body.appendChild(dragImage);\n return dragImage;\n },\n //\n destroyDragImage: function () {\n if (this.touchDragImage && this.touchDragImage.parentElement)\n this.touchDragImage.parentElement.removeChild(this.touchDragImage);\n this.touchDragImageOffset = null;\n this.touchDragImage = null;\n },\n //\n copyStyle: function (src, dst) {\n // remove potentially troublesome attributes\n var badAttributes = ['id', 'class', 'style', 'draggable'];\n badAttributes.forEach(function (att) {\n dst.removeAttribute(att);\n });\n // copy canvas content\n if (src instanceof HTMLCanvasElement) {\n var cSrc = src, cDst = dst;\n cDst.width = cSrc.width;\n cDst.height = cSrc.height;\n cDst.getContext('2d').drawImage(cSrc, 0, 0);\n }\n // copy style (without transitions)\n var cs = getComputedStyle(src);\n for (var i = 0; i < cs.length; i++) {\n var key = cs[i];\n if (key.indexOf('transition') < 0) {\n dst.style[key] = cs[key];\n }\n }\n dst.style.pointerEvents = 'none';\n // and repeat for all children\n for (var i = 0; i < src.children.length; i++) {\n this.copyStyle(src.children[i], dst.children[i]);\n }\n },\n //\n getTouchPoint: function (event) {\n if (event && event.touches) {\n event = event.touches[0];\n }\n return {\n x: event.clientX,\n y: event.clientY\n };\n },\n //\n moveDragImage: function (event, image) {\n if (!event || !image)\n return;\n var orgChartMaster = this;\n requestAnimationFrame(function () {\n var pt = orgChartMaster.getTouchPoint(event);\n var s = image.style;\n s.position = 'absolute';\n s.pointerEvents = 'none';\n s.zIndex = '999999';\n if (orgChartMaster.touchDragImageOffset) {\n s.left = Math.round(pt.x - orgChartMaster.touchDragImageOffset.x) + 'px';\n s.top = Math.round(pt.y - orgChartMaster.touchDragImageOffset.y) + 'px';\n }\n });\n },\n //\n bindDragDrop: function ($node) {\n $node.on('dragstart', this.dragstartHandler.bind(this))\n .on('dragover', this.dragoverHandler.bind(this))\n .on('dragend', this.dragendHandler.bind(this))\n .on('drop', this.dropHandler.bind(this))\n .on('touchstart', this.touchstartHandler.bind(this))\n .on('touchmove', this.touchmoveHandler.bind(this))\n .on('touchend', this.touchendHandler.bind(this));\n },\n // create node\n createNode: function (data) {\n var that = this;\n var opts = this.options;\n var level = data.level;\n if (data.children && data[opts.nodeId]) {\n $.each(data.children, function (index, child) {\n child.parentId = data[opts.nodeId]\n });\n }\n // construct the content of node\n var $nodeDiv = $('<div' + (opts.draggable ? ' draggable=\"true\"' : '') + (data[opts.nodeId] ? ' id=\"' + data[opts.nodeId] + '\"' : '') + (data.parentId ? ' data-parent=\"' + data.parentId + '\"' : '') + '>')\n .addClass('node ' + (data.className || '') + (level > opts.visibleLevel ? ' slide-up' : ''));\n if (opts.nodeTemplate) {\n $nodeDiv.append(opts.nodeTemplate(data));\n } else {\n $nodeDiv.append('<div class=\"title\">' + data[opts.nodeTitle] + '</div>')\n .append(typeof opts.nodeContent !== 'undefined' ? '<div class=\"content\">' + (data[opts.nodeContent] || '') + '</div>' : '');\n }\n //\n var nodeData = $.extend({}, data);\n delete nodeData.children;\n $nodeDiv.data('nodeData', nodeData);\n // append 4 direction arrows or expand/collapse buttons\n var flags = data.relationship || '';\n if (opts.verticalLevel && level >= opts.verticalLevel) {\n if ((level + 1) > opts.verticalLevel && Number(flags.substr(2,1))) {\n $nodeDiv.append('<i class=\"toggleBtn oci\"></i>')\n .children('.title').prepend('<i class=\"oci '+ opts.parentNodeSymbol + ' symbol\"></i>');\n }\n } else {\n if (Number(flags.substr(0,1))) {\n $nodeDiv.append('<i class=\"edge verticalEdge topEdge oci\"></i>');\n }\n if(Number(flags.substr(1,1))) {\n $nodeDiv.append('<i class=\"edge horizontalEdge rightEdge oci\"></i>' +\n '<i class=\"edge horizontalEdge leftEdge oci\"></i>');\n }\n if(Number(flags.substr(2,1))) {\n $nodeDiv.append('<i class=\"edge verticalEdge bottomEdge oci\"></i>')\n .children('.title').prepend('<i class=\"oci '+ opts.parentNodeSymbol + ' symbol\"></i>');\n }\n }\n\n $nodeDiv.on('mouseenter mouseleave', this.nodeEnterLeaveHandler.bind(this));\n $nodeDiv.on('click', this.nodeClickHandler.bind(this));\n $nodeDiv.on('click', '.topEdge', this.topEdgeClickHandler.bind(this));\n $nodeDiv.on('click', '.bottomEdge', this.bottomEdgeClickHandler.bind(this));\n $nodeDiv.on('click', '.leftEdge, .rightEdge', this.hEdgeClickHandler.bind(this));\n $nodeDiv.on('click', '.toggleBtn', this.toggleVNodes.bind(this));\n\n if (opts.draggable) {\n this.bindDragDrop($nodeDiv);\n this.touchHandled = false;\n this.touchMoved = false;\n this.touchTargetNode = null;\n }\n // allow user to append dom modification after finishing node create of orgchart\n if (opts.createNode) {\n opts.createNode($nodeDiv, data);\n }\n\n return $nodeDiv;\n },\n // recursively build the tree\n buildHierarchy: function ($appendTo, data) {\n var that = this;\n var opts = this.options;\n var level = 0;\n if (data.level) {\n level = data.level;\n } else {\n level = data.level = $appendTo.parentsUntil('.orgchart', '.nodes').length;\n }\n // Construct the node\n if (Object.keys(data).length > 2) {\n var $nodeDiv = this.createNode(data);\n if (opts.verticalLevel && level >= opts.verticalLevel) {\n $appendTo.append($nodeDiv);\n } else {\n $appendTo.append($nodeDiv);\n }\n }\n // Construct the \"inferior nodes\"\n if (data.children && data.children.length) {\n var isHidden = level + 1 > opts.visibleLevel || (data.collapsed !== undefined && data.collapsed);\n var isVerticalLayer = opts.verticalLevel && (level + 1) >= opts.verticalLevel;\n var $nodesLayer;\n if (isVerticalLayer) {\n $nodesLayer = $('<ul class=\"nodes\">');\n if (isHidden && level + 1 >= opts.verticalLevel) {\n $nodesLayer.addClass('hidden');\n }\n if (level + 1 === opts.verticalLevel) {\n $appendTo.addClass('hybrid').append($nodesLayer.addClass('vertical'));\n } else {\n $appendTo.append($nodesLayer);\n }\n } else {\n $nodesLayer = $('<ul class=\"nodes' + (isHidden ? ' hidden' : '') + '\">');\n if (Object.keys(data).length === 2) {\n $appendTo.append($nodesLayer);\n } else {\n if (isHidden) {\n $appendTo.addClass('isChildrenCollapsed');\n }\n $appendTo.append($nodesLayer);\n }\n }\n // recurse through children nodes\n $.each(data.children, function () {\n var $nodeCell = $('<li class=\"hierarchy\">');\n $nodesLayer.append($nodeCell);\n this.level = level + 1;\n that.buildHierarchy($nodeCell, this);\n });\n }\n },\n // build the child nodes of specific node\n buildChildNode: function ($appendTo, data) {\n this.buildHierarchy($appendTo, { 'children': data });\n },\n // exposed method\n addChildren: function ($node, data) {\n this.buildChildNode($node.closest('.hierarchy'), data);\n if (!$node.find('.symbol').length) {\n $node.children('.title').prepend('<i class=\"oci '+ this.options.parentNodeSymbol + ' symbol\"></i>');\n }\n if ($node.closest('.nodes.vertical').length) {\n if (!$node.children('.toggleBtn').length) {\n $node.append('<i class=\"toggleBtn oci\"></i>');\n }\n } else {\n if (!$node.children('.bottomEdge').length) {\n $node.append('<i class=\"edge verticalEdge bottomEdge oci\"></i>');\n }\n }\n if (this.isInAction($node)) {\n this.switchVerticalArrow($node.children('.bottomEdge'));\n }\n },\n // build the parent node of specific node\n buildParentNode: function ($currentRoot, data) {\n data.relationship = data.relationship || '001';\n var $newRootWrapper = $('<ul class=\"nodes\"><li class=\"hierarchy\"></li></ul>')\n .find('.hierarchy').append(this.createNode(data)).end();\n this.$chart.prepend($newRootWrapper)\n .find('.hierarchy:first').append($currentRoot.closest('ul').addClass('nodes'));\n },\n // exposed method\n addParent: function ($currentRoot, data) {\n this.buildParentNode($currentRoot, data);\n if (!$currentRoot.children('.topEdge').length) {\n $currentRoot.children('.title').after('<i class=\"edge verticalEdge topEdge oci\"></i>');\n }\n if (this.isInAction($currentRoot)) {\n this.switchVerticalArrow($currentRoot.children('.topEdge'));\n }\n },\n // build the sibling nodes of specific node\n buildSiblingNode: function ($nodeChart, data) {\n var newSiblingCount = $.isArray(data) ? data.length : data.children.length;\n var existingSibligCount = $nodeChart.parent().is('.nodes') ? $nodeChart.siblings().length + 1 : 1;\n var siblingCount = existingSibligCount + newSiblingCount;\n var insertPostion = (siblingCount > 1) ? Math.floor(siblingCount/2 - 1) : 0;\n // just build the sibling nodes for the specific node\n if ($nodeChart.closest('.nodes').parent().is('.hierarchy')) {\n this.buildChildNode($nodeChart.parent().closest('.hierarchy'), data);\n var $siblings = $nodeChart.parent().closest('.hierarchy').children('.nodes:last').children('.hierarchy');\n if (existingSibligCount > 1) {\n $siblings.eq(0).before($nodeChart.siblings().addBack().unwrap());\n } else {\n $siblings.eq(insertPostion).after($nodeChart.unwrap());\n }\n } else { // build the sibling nodes and parent node for the specific ndoe\n this.buildHierarchy($nodeChart.parent().prepend($('<li class=\"hierarchy\">')).children('.hierarchy:first'), data);\n $nodeChart.prevAll('.hierarchy').children('.nodes').children().eq(insertPostion).after($nodeChart);\n }\n },\n //\n addSiblings: function ($node, data) {\n this.buildSiblingNode($node.closest('.hierarchy'), data);\n $node.closest('.nodes').data('siblingsLoaded', true);\n if (!$node.children('.leftEdge').length) {\n $node.children('.topEdge').after('<i class=\"edge horizontalEdge rightEdge oci\"></i><i class=\"edge horizontalEdge leftEdge oci\"></i>');\n }\n if (this.isInAction($node)) {\n this.switchHorizontalArrow($node);\n $node.children('.topEdge').removeClass('oci-chevron-up').addClass('oci-chevron-down');\n }\n },\n // remove node and its descendent nodes\n removeNodes: function ($node) {\n var $wrapper = $node.closest('.hierarchy').parent();\n if ($wrapper.parent().is('.hierarchy')) {\n if (this.getNodeState($node, 'siblings').exist) {\n $node.closest('.hierarchy').remove();\n if ($wrapper.children().length === 1) {\n $wrapper.find('.node:first .horizontalEdge').remove();\n }\n } else {\n $wrapper.siblings('.node').find('.bottomEdge').remove()\n .end().end().remove();\n }\n } else { // if $node is root node\n $wrapper.closest('.orgchart').remove();\n }\n },\n //\n hideDropZones: function () {\n // Remove all the 'this is a drop zone' indicators\n var orgChartObj = this;\n orgChartObj.$chart.find('.allowedDrop')\n .removeClass('allowedDrop');\n },\n //\n showDropZones: function (dragged) {\n // Highlight all the 'drop zones', and set dragged, so that the drop/enter can work out what happens later\n // TODO: This assumes all nodes are droppable: it doesn't run the custom isDroppable function - it should!\n var orgChartObj = this;\n orgChartObj.$chart.find('.node')\n .each(function (index, node) {\n $(node).addClass('allowedDrop');\n });\n orgChartObj.$chart.data('dragged', $(dragged));\n },\n //\n processExternalDrop: function (dropZone, dragged) {\n // Allow an external drop event to be handled by one of our nodes\n if (dragged) {\n this.$chart.data('dragged', $(dragged));\n }\n var droppedOnNode = dropZone.closest('.node');\n // would like to just call 'dropZoneHandler', but I can't reach it from here\n // instead raise a drop event on the node element\n droppedOnNode.triggerHandler({ 'type': 'drop' });\n },\n //\n exportPDF: function(canvas, exportFilename){\n var doc = {};\n var docWidth = Math.floor(canvas.width);\n var docHeight = Math.floor(canvas.height);\n if (!window.jsPDF) {\n window.jsPDF = window.jspdf.jsPDF;\n }\n\n if (docWidth > docHeight) {\n doc = new jsPDF({\n orientation: 'landscape',\n unit: 'px',\n format: [docWidth, docHeight]\n });\n } else {\n doc = new jsPDF({\n orientation: 'portrait',\n unit: 'px',\n format: [docHeight, docWidth]\n });\n }\n doc.addImage(canvas.toDataURL(), 'png', 0, 0);\n doc.save(exportFilename + '.pdf');\n },\n //\n exportPNG: function(canvas, exportFilename){\n var that = this;\n var isWebkit = 'WebkitAppearance' in document.documentElement.style;\n var isFf = !!window.sidebar;\n var isEdge = navigator.appName === 'Microsoft Internet Explorer' || (navigator.appName === \"Netscape\" && navigator.appVersion.indexOf('Edge') > -1);\n var $chartContainer = this.$chartContainer;\n\n if ((!isWebkit && !isFf) || isEdge) {\n window.navigator.msSaveBlob(canvas.msToBlob(), exportFilename + '.png');\n } else {\n var selector = '.oci-download-btn' + (that.options.chartClass !== '' ? '.' + that.options.chartClass : '');\n\n if (!$chartContainer.find(selector).length) {\n $chartContainer.append('<a class=\"oci-download-btn' + (that.options.chartClass !== '' ? ' ' + that.options.chartClass : '') + '\"'\n + ' download=\"' + exportFilename + '.png\"></a>');\n }\n\n $chartContainer.find(selector).attr('href', canvas.toDataURL())[0].click();\n }\n },\n //\n export: function (exportFilename, exportFileextension) {\n var that = this;\n exportFilename = (typeof exportFilename !== 'undefined') ? exportFilename : this.options.exportFilename;\n exportFileextension = (typeof exportFileextension !== 'undefined') ? exportFileextension : this.options.exportFileextension;\n if ($(this).children('.spinner').length) {\n return false;\n }\n var $chartContainer = this.$chartContainer;\n var $mask = $chartContainer.find('.mask');\n if (!$mask.length) {\n $chartContainer.append('<div class=\"mask\"><i class=\"oci oci-spinner spinner\"></i></div>');\n } else {\n $mask.removeClass('hidden');\n }\n var sourceChart = $chartContainer.addClass('canvasContainer').find('.orgchart:not(\".hidden\")').get(0);\n var flag = that.options.direction === 'l2r' || that.options.direction === 'r2l';\n html2canvas(sourceChart, {\n 'width': flag ? sourceChart.clientHeight : sourceChart.clientWidth,\n 'height': flag ? sourceChart.clientWidth : sourceChart.clientHeight,\n 'onclone': function (cloneDoc) {\n $(cloneDoc).find('.canvasContainer').css('overflow', 'visible')\n .find('.orgchart:not(\".hidden\"):first').css('transform', '');\n }\n })\n .then(function (canvas) {\n $chartContainer.find('.mask').addClass('hidden');\n\n if (exportFileextension.toLowerCase() === 'pdf') {\n that.exportPDF(canvas, exportFilename);\n } else {\n that.exportPNG(canvas, exportFilename);\n }\n\n $chartContainer.removeClass('canvasContainer');\n }, function () {\n $chartContainer.removeClass('canvasContainer');\n });\n }\n };\n\n $.fn.orgchart = function (opts) {\n return new OrgChart(this, opts).init();\n };\n\n}));\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orgchart",
3
- "version": "3.1.2",
3
+ "version": "3.1.4",
4
4
  "description": "Simple and direct organization chart(tree-like hierarchy) plugin based on pure DOM and jQuery.",
5
5
  "main": "./dist/js/jquery.orgchart.min.js",
6
6
  "style": [
@@ -36,10 +36,10 @@
36
36
  },
37
37
  "homepage": "https://github.com/dabeng/OrgChart#readme",
38
38
  "dependencies": {
39
- "html2canvas": "^1.0.0-rc.7",
40
- "jquery": "^3.5.0",
39
+ "html2canvas": "^1.4.1",
40
+ "jquery": "^3.6.2",
41
41
  "jquery-mockjax": "^2.6.0",
42
- "jspdf": "^2.3.0"
42
+ "jspdf": "^2.5.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "browser-sync": "^2.26.7",
@@ -56,8 +56,8 @@
56
56
  "gulp-sourcemaps": "^2.6.5",
57
57
  "gulp-testcafe": "^0.9.2",
58
58
  "gulp-uglify": "^3.0.2",
59
- "jest": "^24.9.0",
60
- "jest-cli": "^24.9.0",
59
+ "jest": "^29.3.1",
60
+ "jest-cli": "^29.3.1",
61
61
  "jest-image-snapshot": "^2.11.0",
62
62
  "jest-puppeteer": "^4.3.0",
63
63
  "jsdom": "^16.5.0",
@@ -155,16 +155,16 @@
155
155
  .orgchart > ul > li > ul li > .node::before {
156
156
  content: "";
157
157
  position: absolute;
158
- top: -11px;
158
+ top: var(--top, -11px);
159
159
  left: calc(50% - 1px);
160
160
  width: 2px;
161
- height: 9px;
161
+ height: var(--height, 9px);
162
162
  background-color: rgba(217, 83, 79, 0.8);
163
163
  }
164
164
 
165
165
  .orgchart > ul > li > ul li.isSiblingsCollapsed > .node::before {
166
- top: -13px;
167
- height: 11px;
166
+ top: var(--top-cross-point, -13px);
167
+ height: var(--height-cross-point, 11px);
168
168
  }
169
169
 
170
170
  /* node styling */
@@ -1015,6 +1015,40 @@
1015
1015
  origEvent.dataTransfer.setDragImage(ghostNode, xOffset, yOffset);
1016
1016
  }
1017
1017
  },
1018
+ // get the level amount of a hierachy
1019
+ getUpperLevel: function ($node) {
1020
+ if (!$node.is('.node')) {
1021
+ return 0;
1022
+ }
1023
+ return $node.parents('.hierarchy').length;
1024
+ },
1025
+ // get the level amount of a hierachy
1026
+ getLowerLevel: function ($node) {
1027
+ if (!$node.is('.node')) {
1028
+ return 0;
1029
+ }
1030
+ return $node.closest('.hierarchy').find('.nodes').length + 1;
1031
+ },
1032
+ // get nodes in level order traversal
1033
+ getLevelOrderNodes: function ($root) {
1034
+ if(!$root) return [];
1035
+ var queue = [];
1036
+ var output = [];
1037
+ queue.push($root);
1038
+ while(queue.length) {
1039
+ var row = [];
1040
+ for(var i = 0; i < queue.length; i++) {
1041
+ var cur = queue.shift();
1042
+ var children = this.getChildren(cur);
1043
+ if(children.length) {
1044
+ queue.push(children.toArray().flat());
1045
+ }
1046
+ row.push($(cur));
1047
+ }
1048
+ output.push(row);
1049
+ }
1050
+ return output;
1051
+ },
1018
1052
  //
1019
1053
  filterAllowedDropNodes: function ($dragged) {
1020
1054
  var opts = this.options;