jquery.orgchart.min.js.map 95 KB

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","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","type","buildHierarchy","buildJsonDS","children","ajaxURL","attachRel","append","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","$exportBtn","text","e","preventDefault","export","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","$tr","id","getHierarchy","valid","getNodeState","$node","relation","$target","exist","visible","getRelatedNodes","hideParentEnd","upperLevel","addClass","slice","removeAttr","hideParent","$upperLevel","hideSiblings","$parent","one","showParentEnd","node","isInAction","switchVerticalArrow","showParent","repaint","bind","stopAjax","$nodeLevel","isVisibleNode","index","hideChildrenEnd","animatedNodes","isVerticalDesc","lowerLevel","prevAll","addBack","last","hideChildren","$lowerLevel","$animatedNodes","filter","get","showChildrenEnd","showChildren","$levels","hideSiblingsEnd","$nodeContainer","nodeContainer","lines","$siblings","nextAll","prev","end","switchHorizontalArrow","$lines","showSiblingsEnd","visibleNodes","showRelatedParentEnd","showSiblings","$visibleNodes","startLoading","$edge","not","prop","endLoading","attr","$arrow","toggleClass","$prevSib","$nextSib","next","$sibs","sibsVisible","style","offsetWidth","nodeEnterLeaveHandler","flag","$topEdge","$bottomEdge","$leftEdge","nodeClickHandler","loadNodes","rel","isEmptyObject","addParent","addChildren","addSiblings","HideFirstParentEnd","topEdge","topEdgeClickHandler","stopPropagation","parentState","isFunction","bottomEdgeClickHandler","childrenState","hEdgeClickHandler","$hEdge","siblingsState","families","expandVNodesEnd","vNodes","collapseVNodesEnd","toggleVNodes","$toggleBtn","$descWrapper","$descendants","$children","createGhostNode","ghostNode","nodeCover","$nodeDiv","origEvent","isFirefox","test","navigator","userAgent","toLowerCase","querySelector","createElementNS","add","appendChild","transValues","isHorizontal","scale","setAttribute","outerWidth","outerHeight","xOffset","offsetX","yOffset","offsetY","ghostNodeWrapper","createElement","src","XMLSerializer","serializeToString","dataTransfer","setDragImage","filterAllowedDropNodes","$dragged","$dragZone","$dragHier","dropCriteria","dragstartHandler","setData","dragoverHandler","dropEffect","dragendHandler","dropHandler","$dropZone","dropEvent","draggedNode","dragZone","dropZone","isDefaultPrevented","dropColspan","horizontalEdges","before","$dropSibs","after","dragColspan","$dragSibs","touchstartHandler","touchHandled","touchMoved","innerText","touchmoveHandler","hasClass","simulateMouseEvent","$touchingNode","elementFromPoint","touchingNodeElement","touchTargetNode","touchendHandler","fakeEventForDropHandler","simulatedType","touch","changedTouches","simulatedEvent","createEvent","initMouseEvent","screenX","screenY","dispatchEvent","bindDragDrop","createNode","level","child","parentId","className","nodeTemplate","nodeContent","nodeData","verticalLevel","Number","substr","icon","prepend","$appendTo","parentsUntil","$nodeWrapper","childrenData","hasChildren","Object","keys","$nodesLayer","isHidden","collapsed","isVerticalLayer","$upperLines","lowerLines","$nodeCell","buildChildNode","buildParentNode","$currentRoot","$table","complementLine","$oneSibling","siblingCount","existingSibligCount","buildSiblingNode","$nodeChart","newSiblingCount","isArray","insertPostion","floor","$siblingTds","unwrap","removeNodes","$mask","sourceChart","html2canvas","width","clientHeight","clientWidth","height","onclone","cloneDoc","onrendered","canvas","doc","docWidth","docHeight","jsPDF","addImage","toDataURL","save","isWebkit","documentElement","isFf","sidebar","isEdge","appName","appVersion","msSaveBlob","msToBlob","selector","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,GAC/B,IAAIC,EAAW,SAAUC,EAAMC,GAC7BC,KAAKC,gBAAkBN,EAAEG,GACzBE,KAAKD,KAAOA,EACZC,KAAKE,eAAiB,CACpBC,UAAa,OACbC,OAAU,KACVC,oBAAsB,EACtBC,aAAgB,IAChBC,WAAc,GACdC,cAAgB,EAChBC,eAAkB,WAClBC,oBAAuB,MACvBC,iBAAoB,WACpBC,WAAa,EACbC,UAAa,MACbC,KAAO,EACPC,MAAQ,EACRC,YAAe,EACfC,aAAgB,KAIpBpB,EAASqB,UAAY,CAEnBC,KAAM,SAAUpB,GACd,IAAIqB,EAAOpB,KACXA,KAAKqB,QAAU1B,EAAE2B,OAAO,GAAItB,KAAKE,eAAgBF,KAAKD,KAAMA,GAE5D,IAAIE,EAAkBD,KAAKC,gBACvBD,KAAKuB,QACPvB,KAAKuB,OAAOC,SAEd,IAAIC,EAAOzB,KAAKqB,QAAQI,KACpBF,EAASvB,KAAKuB,OAAS5B,EAAE,QAAS,CACpC8B,KAAQ,CAAEJ,QAAWrB,KAAKqB,SAC1BK,MAAS,YAA0C,KAA5B1B,KAAKqB,QAAQd,WAAoB,IAAMP,KAAKqB,QAAQd,WAAa,KAAkC,QAA3BP,KAAKqB,QAAQR,UAAsB,IAAMb,KAAKqB,QAAQR,UAAY,IACjKc,MAAS,SAASC,GACXjC,EAAEiC,EAAMC,QAAQC,QAAQ,SAASC,QACpCR,EAAOS,KAAK,iBAAi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AKC,QAAQd,WAAoB,IAAMa,EAAKC,QAAQd,WAAa,IAAM,eACzGE,EAAiB,cAEvCR,EAAgB+B,KAAKgX,GAAU/L,KAAK,OAAQ8K,EAAOM,aAAa,GAAG1W,aAK1EsX,KAAK,WACJhZ,EAAgBgC,YAAY,oBAC3B,WACDhC,EAAgBgC,YAAY,uBAKlCtC,EAAEuZ,GAAGC,SAAW,SAAUpZ,GACxB,OAAO,IAAIF,EAASG,KAAMD,GAAMoB","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 'exportFilename': 'OrgChart',\n 'exportFileextension': 'png',\n 'parentNodeSymbol': 'fa-users',\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 if ($.type(data) === 'object') {\n if (data instanceof $) { // ul datasource\n this.buildHierarchy($chart, this.buildJsonDS(data.children()), 0, this.options);\n } else { // local json datasource\n this.buildHierarchy($chart, this.options.ajaxURL ? data : this.attachRel(data, '00'));\n }\n } else {\n $chart.append('<i class=\"fa fa-circle-o-notch fa-spin spinner\"></i>');\n $.ajax({\n 'url': data,\n 'dataType': 'json'\n })\n .done(function(data, textStatus, jqXHR) {\n that.buildHierarchy($chart, 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 && !$chartContainer.find('.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 var initEvent = $.Event('init.orgchart');\n that.$chart.trigger(initEvent);\n break initTime;\n }\n }\n }\n }\n });\n mo.observe(this.$chartContainer[0], { childList: true });\n },\n //\n attachExportButton: function () {\n var that = this;\n var $exportBtn = $('<button>', {\n 'class': 'oc-export-btn' + (this.options.chartClass !== '' ? ' ' + this.options.chartClass : ''),\n 'text': 'Export',\n 'click': function(e) {\n e.preventDefault();\n that.export();\n }\n });\n this.$chartContainer.append($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) {\n var that = this;\n var $tr = $chart.find('tr:first');\n var subObj = { 'id': $tr.find('.node')[0].id };\n $tr.siblings(':last').children().each(function() {\n if (!subObj.children) { subObj.children = []; }\n subObj.children.push(that.loopChart($(this)));\n });\n return subObj;\n },\n //\n getHierarchy: function () {\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);\n },\n // detect the exist/display state of related node\n getNodeState: function ($node, relation) {\n var $target = {};\n var relation = relation || 'self';\n if (relation === 'parent') {\n $target = $node.closest('.nodes').siblings(':first');\n if ($target.length) {\n if ($target.is('.hidden') || (!$target.is('.hidden') && $target.closest('.nodes').is('.hidden'))) {\n return { 'exist': true, 'visible': false };\n }\n return { 'exist': true, 'visible': true };\n }\n } else if (relation === 'children') {\n $target = $node.closest('tr').siblings(':last');\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 = $node.closest('table').parent().siblings();\n if ($target.length) {\n if (!$target.is('.hidden') && !$target.parent().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('table').parent().length && $target.closest('table').parent().is('.hidden')) ||\n ($target.parent().is('li') && ($target.closest('ul').is('.hidden') || $target.closest('verticalNodes').is('.hidden')))\n )) {\n return { 'exist': true, 'visible': true };\n }\n return { 'exist': true, 'visible': false };\n }\n }\n return { 'exist': false, 'visible': false };\n },\n // find the related nodes\n getRelatedNodes: function ($node, relation) {\n if (!$node || !($node instanceof $) || !$node.is('.node')) {\n return $();\n }\n if (relation === 'parent') {\n return $node.closest('.nodes').parent().children(':first').find('.node');\n } else if (relation === 'children') {\n return $node.closest('tr').siblings('.nodes').children().find('.node:first');\n } else if (relation === 'siblings') {\n return $node.closest('table').parent().siblings().find('.node:first');\n } else {\n return $();\n }\n },\n hideParentEnd: function (event) {\n $(event.target).removeClass('sliding');\n event.data.upperLevel.addClass('hidden').slice(1).removeAttr('style');\n },\n // recursively hide the ancestor node and sibling nodes of the specified node\n hideParent: function ($node) {\n var $upperLevel = $node.closest('.nodes').siblings();\n if ($upperLevel.eq(0).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 var $lines = $upperLevel.slice(1);\n $lines.css('visibility', 'hidden');\n // hide the superior nodes with transition\n var $parent = $upperLevel.eq(0).find('.node');\n if (this.getNodeState($parent).visible) {\n $parent.addClass('sliding slide-down').one('transitionend', { 'upperLevel': $upperLevel }, 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 $upperLevel = $node.closest('.nodes').siblings().removeClass('hidden');\n // just show only one line\n $upperLevel.eq(2).children().slice(1, -1).addClass('hidden');\n // show parent node with animation\n var $parent = $upperLevel.eq(0).find('.node');\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 //\n hideChildrenEnd: function (event) {\n var $node = event.data.node;\n event.data.animatedNodes.removeClass('sliding');\n if (event.data.isVerticalDesc) {\n event.data.lowerLevel.addClass('hidden');\n } else {\n event.data.animatedNodes.closest('.nodes').prevAll('.lines').removeAttr('style').addBack().addClass('hidden');\n event.data.lowerLevel.last().find('.verticalNodes').addClass('hidden');\n }\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 var $lowerLevel = $node.closest('tr').siblings();\n this.stopAjax($lowerLevel.last());\n var $animatedNodes = $lowerLevel.last().find('.node').filter(this.isVisibleNode.bind(this));\n var isVerticalDesc = $lowerLevel.last().is('.verticalNodes') ? true : false;\n if (!isVerticalDesc) {\n $animatedNodes.closest('table').closest('tr').prevAll('.lines').css('visibility', 'hidden');\n }\n this.repaint($animatedNodes.get(0));\n $animatedNodes.addClass('sliding slide-up').eq(0).one('transitionend', { 'animatedNodes': $animatedNodes, 'lowerLevel': $lowerLevel, 'isVerticalDesc': isVerticalDesc, '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 var $levels = $node.closest('tr').siblings();\n var isVerticalDesc = $levels.is('.verticalNodes') ? true : false;\n var $animatedNodes = isVerticalDesc\n ? $levels.removeClass('hidden').find('.node').filter(this.isVisibleNode.bind(this))\n : $levels.removeClass('hidden').eq(2).children().find('.node:first').filter(this.isVisibleNode.bind(this));\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 event.data.lines.removeAttr('style');\n var $siblings = direction ? (direction === 'left' ? $nodeContainer.prevAll(':not(.hidden)') : $nodeContainer.nextAll(':not(.hidden)')) : $nodeContainer.siblings();\n $nodeContainer.closest('.nodes').prev().children(':not(.hidden)')\n .slice(1, direction ? $siblings.length * 2 + 1 : -1).addClass('hidden');\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('.lines, .nodes, .verticalNodes').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('table').parent();\n if ($nodeContainer.siblings().find('.spinner').length) {\n $node.closest('.orgchart').data('inAjax', false);\n }\n if (direction) {\n if (direction === 'left') {\n $nodeContainer.prevAll().find('.node').filter(this.isVisibleNode.bind(this)).addClass('sliding slide-right');\n } else {\n $nodeContainer.nextAll().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 }\n var $animatedNodes = $nodeContainer.siblings().find('.sliding');\n var $lines = $animatedNodes.closest('.nodes').prevAll('.lines').css('visibility', 'hidden');\n $animatedNodes.eq(0).one('transitionend', { 'node': $node, 'nodeContainer': $nodeContainer, 'direction': direction, 'animatedNodes': $animatedNodes, 'lines': $lines }, 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('fa-chevron-up').addClass('fa-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 td tags\n var $siblings = $();\n if (direction) {\n if (direction === 'left') {\n $siblings = $node.closest('table').parent().prevAll().removeClass('hidden');\n } else {\n $siblings = $node.closest('table').parent().nextAll().removeClass('hidden');\n }\n } else {\n $siblings = $node.closest('table').parent().siblings().removeClass('hidden');\n }\n // secondly, show the lines\n var $upperLevel = $node.closest('table').closest('tr').siblings();\n if (direction) {\n $upperLevel.eq(2).children('.hidden').slice(0, $siblings.length * 2).removeClass('hidden');\n } else {\n $upperLevel.eq(2).children('.hidden').removeClass('hidden');\n }\n // thirdly, do some cleaning stuff\n if (!this.getNodeState($node, 'parent').visible) {\n $upperLevel.removeClass('hidden');\n var parent = $upperLevel.find('.node')[0];\n this.repaint(parent);\n $(parent).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=\"fa fa-circle-o-notch fa-spin spinner\"></i>')\n .children().not('.spinner').css('opacity', 0.2);\n $chart.data('inAjax', true);\n $('.oc-export-btn' + (this.options.chartClass !== '' ? '.' + this.options.chartClass : '')).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' + (this.options.chartClass !== '' ? '.' + this.options.chartClass : '')).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('fa-') > -1 ? true : false;\n },\n //\n switchVerticalArrow: function ($arrow) {\n $arrow.toggleClass('fa-chevron-up').toggleClass('fa-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.closest('table').parent().prev();\n if ($prevSib.length) {\n if ($prevSib.is('.hidden')) {\n $node.children('.leftEdge').addClass('fa-chevron-left').removeClass('fa-chevron-right');\n } else {\n $node.children('.leftEdge').addClass('fa-chevron-right').removeClass('fa-chevron-left');\n }\n }\n var $nextSib = $node.closest('table').parent().next();\n if ($nextSib.length) {\n if ($nextSib.is('.hidden')) {\n $node.children('.rightEdge').addClass('fa-chevron-right').removeClass('fa-chevron-left');\n } else {\n $node.children('.rightEdge').addClass('fa-chevron-left').removeClass('fa-chevron-right');\n }\n }\n } else {\n var $sibs = $node.closest('table').parent().siblings();\n var sibsVisible = $sibs.length ? !$sibs.is('.hidden') : false;\n $node.children('.leftEdge').toggleClass('fa-chevron-right', sibsVisible).toggleClass('fa-chevron-left', !sibsVisible);\n $node.children('.rightEdge').toggleClass('fa-chevron-left', sibsVisible).toggleClass('fa-chevron-right', !sibsVisible);\n }\n },\n //\n repaint: function (node) {\n if (node) {\n node.style.offsetWidth = node.offsetWidth;\n }\n },\n //\n nodeEnterLeaveHandler: function (event) {\n var $node = $(event.delegateTarget), flag = false;\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('fa-chevron-up', !flag).toggleClass('fa-chevron-down', flag);\n }\n if ($bottomEdge.length) {\n flag = this.getNodeState($node, 'children').visible;\n $bottomEdge.toggleClass('fa-chevron-down', !flag).toggleClass('fa-chevron-up', flag);\n }\n if ($leftEdge.length) {\n this.switchHorizontalArrow($node);\n }\n } else {\n $node.children('.edge').removeClass('fa-chevron-up fa-chevron-down fa-chevron-right fa-chevron-left');\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 }\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 //\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('table').closest('tr').siblings(':first').find('.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 } else { // show the ancestors and siblings\n this.showParent($node);\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 //\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.closest('tr').siblings(':last');\n if ($children.find('.sliding').length) { return; }\n // hide the descendant nodes of the specified node\n if (childrenState.visible) {\n this.hideChildren($node);\n } else { // show the descendants\n this.showChildren($node);\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 //\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('table').parent().siblings();\n if ($siblings.find('.sliding').length) { return; }\n if (opts.toggleSiblingsResp) {\n var $prevSib = $node.closest('table').parent().prev();\n var $nextSib = $node.closest('table').parent().next();\n if ($hEdge.is('.leftEdge')) {\n if ($prevSib.is('.hidden')) {\n this.showSiblings($node, 'left');\n } else {\n this.hideSiblings($node, 'left');\n }\n } else {\n if ($nextSib.is('.hidden')) {\n this.showSiblings($node, 'right');\n } else {\n this.hideSiblings($node, 'right');\n }\n }\n } else {\n if (siblingsState.visible) {\n this.hideSiblings($node);\n } else {\n this.showSiblings($node);\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('fa-plus-square fa-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('fa-minus-square').addClass('fa-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 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 origEvent.dataTransfer.setDragImage(ghostNode, xOffset, yOffset);\n }\n },\n //\n filterAllowedDropNodes: function ($dragged) {\n var opts = this.options;\n var $dragZone = $dragged.closest('.nodes').siblings().eq(0).find('.node:first');\n var $dragHier = $dragged.closest('table').find('.node');\n this.$chart.data('dragged', $dragged)\n .find('.node').each(function (index, node) {\n if ($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 event.preventDefault();\n if (!$(event.delegateTarget).is('.allowedDrop')) {\n event.originalEvent.dataTransfer.dropEffect = 'none';\n }\n },\n //\n dragendHandler: function (event) {\n this.$chart.find('.allowedDrop').removeClass('allowedDrop');\n },\n //\n dropHandler: function (event) {\n var $dropZone = $(event.delegateTarget);\n var $dragged = this.$chart.data('dragged');\n var $dragZone = $dragged.closest('.nodes').siblings().eq(0).children();\n var dropEvent = $.Event('nodedrop.orgchart');\n this.$chart.trigger(dropEvent, { 'draggedNode': $dragged, 'dragZone': $dragZone.children(), 'dropZone': $dropZone });\n if (dropEvent.isDefaultPrevented()) {\n return;\n }\n // firstly, deal with the hierarchy of drop zone\n if (!$dropZone.closest('tr').siblings().length) { // if the drop zone is a leaf node\n $dropZone.append('<i class=\"edge verticalEdge bottomEdge fa\"></i>')\n .parent().attr('colspan', 2)\n .parent().after('<tr class=\"lines\"><td colspan=\"2\"><div class=\"downLine\"></div></td></tr>'\n + '<tr class=\"lines\"><td class=\"rightLine\"></td><td class=\"leftLine\"></td></tr>'\n + '<tr class=\"nodes\"></tr>')\n .siblings(':last').append($dragged.find('.horizontalEdge').remove().end().closest('table').parent());\n } else {\n var dropColspan = parseInt($dropZone.parent().attr('colspan')) + 2;\n var horizontalEdges = '<i class=\"edge horizontalEdge rightEdge fa\"></i><i class=\"edge horizontalEdge leftEdge fa\"></i>';\n $dropZone.closest('tr').next().addBack().children().attr('colspan', dropColspan);\n if (!$dragged.find('.horizontalEdge').length) {\n $dragged.append(horizontalEdges);\n }\n $dropZone.closest('tr').siblings().eq(1).children(':last').before('<td class=\"leftLine topLine\"></td><td class=\"rightLine topLine\"></td>')\n .end().next().append($dragged.closest('table').parent());\n var $dropSibs = $dragged.closest('table').parent().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 var dragColspan = parseInt($dragZone.attr('colspan'));\n if (dragColspan > 2) {\n $dragZone.attr('colspan', dragColspan - 2)\n .parent().next().children().attr('colspan', dragColspan - 2)\n .end().next().children().slice(1, 3).remove();\n var $dragSibs = $dragZone.parent().siblings('.nodes').children().find('.node:first');\n if ($dragSibs.length ===1) {\n $dragSibs.find('.horizontalEdge').remove();\n }\n } else {\n $dragZone.removeAttr('colspan')\n .find('.bottomEdge').remove()\n .end().end().siblings().remove();\n }\n },\n //\n touchstartHandler: function (event) {\n console.log(\"orgChart: touchstart 1: touchHandled=\" + this.touchHandled + \", touchMoved=\" + this.touchMoved + \", target=\" + event.target.innerText);\n if (this.touchHandled)\n return;\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 event.preventDefault();\n if (!this.touchMoved) {\n var nodeIsSelected = $(this).hasClass('focused');\n console.log(\"orgChart: touchmove 1: \" + event.touches.length + \" touches, we have not moved, so simulate a drag start\", event.touches);\n // TODO: visualise the start of the drag (as would happen on desktop)\n this.simulateMouseEvent(event, 'dragstart');\n }\n this.touchMoved = true;\n var $touching = $(document.elementFromPoint(event.touches[0].clientX, event.touches[0].clientY));\n var $touchingNode = $touching.closest('div.node');\n \n if ($touchingNode.length > 0) {\n var touchingNodeElement = $touchingNode[0];\n // TODO: simulate the dragover visualisation\n if ($touchingNode.is('.allowedDrop')) {\n console.log(\"orgChart: touchmove 2: this node (\" + touchingNodeElement.id + \") is allowed to be a drop target\");\n this.touchTargetNode = touchingNodeElement;\n } else {\n console.log(\"orgChart: touchmove 3: this node (\" + touchingNodeElement.id + \") is NOT allowed to be a drop target\");\n this.touchTargetNode = null;\n }\n } else {\n console.log(\"orgchart: touchmove 4: not touching a node\");\n this.touchTargetNode = null;\n }\n },\n //\n touchendHandler: function (event) {\n console.log(\"orgChart: touchend 1: touchHandled=\" + this.touchHandled + \", touchMoved=\" + this.touchMoved + \", \" + event.target.innerText + \" \");\n if (!this.touchHandled) {\n console.log(\"orgChart: touchend 2: not handled by us, so aborting\");\n return;\n }\n if (this.touchMoved) {\n // we've had movement, so this was a 'drag' touch\n if (this.touchTargetNode) {\n console.log(\"orgChart: touchend 3: moved to a node, so simulating drop\");\n var fakeEventForDropHandler = { delegateTarget: this.touchTargetNode };\n this.dropHandler(fakeEventForDropHandler);\n this.touchTargetNode = null;\n }\n console.log(\"orgChart: touchend 4: simulating dragend\");\n this.simulateMouseEvent(event, 'dragend');\n }\n else {\n // we did not move, so assume this was a 'press' touch\n console.log(\"orgChart: touchend 5: moved, so simulating click\");\n this.simulateMouseEvent(event, 'click');\n }\n this.touchHandled = false;\n },\n // simulate a mouse event (so we can fake them on a touch device)\n simulateMouseEvent: function (event, simulatedType) {\n // Ignore multi-touch events\n if (event.originalEvent.touches.length > 1) {\n return;\n }\n var touch = event.originalEvent.changedTouches[0];\n var simulatedEvent = document.createEvent('MouseEvents');\n simulatedEvent.initMouseEvent(\n simulatedType, // type\n true, // bubbles \n true, // cancelable \n window, // view \n 1, // detail \n touch.screenX, // screenX \n touch.screenY, // screenY \n touch.clientX, // clientX \n touch.clientY, // clientY \n false, // ctrlKey \n false, // altKey \n false, // shiftKey \n false, // metaKey \n 0, // button \n null // relatedTarget \n );\n // Dispatch the simulated event to the target element\n event.target.dispatchEvent(simulatedEvent);\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) {\n $.each(data.children, function (index, child) {\n child.parentId = data.id;\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 var icon = level + 1 > opts.visibleLevel ? 'plus' : 'minus';\n $nodeDiv.append('<i class=\"toggleBtn fa fa-' + icon + '-square\"></i>');\n }\n } else {\n if (Number(flags.substr(0,1))) {\n $nodeDiv.append('<i class=\"edge verticalEdge topEdge fa\"></i>');\n }\n if(Number(flags.substr(1,1))) {\n $nodeDiv.append('<i class=\"edge horizontalEdge rightEdge fa\"></i>' +\n '<i class=\"edge horizontalEdge leftEdge fa\"></i>');\n }\n if(Number(flags.substr(2,1))) {\n $nodeDiv.append('<i class=\"edge verticalEdge bottomEdge fa\"></i>')\n .children('.title').prepend('<i class=\"fa '+ 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 + 1;\n }\n // Construct the node\n var childrenData = data.children;\n var hasChildren = childrenData ? childrenData.length : false;\n var $nodeWrapper;\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 $nodeWrapper = $('<table>');\n $appendTo.append($nodeWrapper.append($('<tr/>').append($('<td' + (hasChildren ? ' colspan=\"' + childrenData.length * 2 + '\"' : '') + '></td>').append($nodeDiv))));\n }\n }\n // Construct the lower level(two \"connectiong lines\" rows and \"inferior nodes\" row)\n if (hasChildren) {\n var isHidden = (level + 1 > opts.visibleLevel || data.collapsed) ? ' hidden' : '';\n var isVerticalLayer = (opts.verticalLevel && (level + 1) >= opts.verticalLevel) ? true : false;\n var $nodesLayer;\n if (isVerticalLayer) {\n $nodesLayer = $('<ul>');\n if (isHidden && level + 1 > opts.verticalLevel) {\n $nodesLayer.addClass(isHidden);\n }\n if (level + 1 === opts.verticalLevel) {\n $appendTo.children('table').append('<tr class=\"verticalNodes' + isHidden + '\"><td></td></tr>')\n .find('.verticalNodes').children().append($nodesLayer);\n } else {\n $appendTo.append($nodesLayer);\n }\n } else {\n var $upperLines = $('<tr class=\"lines' + isHidden + '\"><td colspan=\"' + childrenData.length * 2 + '\"><div class=\"downLine\"></div></td></tr>');\n var lowerLines = '<tr class=\"lines' + isHidden + '\"><td class=\"rightLine\"></td>';\n for (var i=1; i<childrenData.length; i++) {\n lowerLines += '<td class=\"leftLine topLine\"></td><td class=\"rightLine topLine\"></td>';\n }\n lowerLines += '<td class=\"leftLine\"></td></tr>';\n $nodesLayer = $('<tr class=\"nodes' + isHidden + '\">');\n if (Object.keys(data).length === 2) {\n $appendTo.append($upperLines).append(lowerLines).append($nodesLayer);\n } else {\n $nodeWrapper.append($upperLines).append(lowerLines).append($nodesLayer);\n }\n }\n // recurse through children nodes\n $.each(childrenData, function () {\n var $nodeCell = isVerticalLayer ? $('<li>') : $('<td colspan=\"2\">');\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 $appendTo.find('td:first').attr('colspan', data.length * 2);\n this.buildHierarchy($appendTo, { 'children': data });\n },\n // exposed method\n addChildren: function ($node, data) {\n this.buildChildNode($node.closest('table'), data);\n if (!$node.children('.bottomEdge').length) {\n $node.append('<i class=\"edge verticalEdge bottomEdge fa\"></i>');\n }\n if (!$node.find('.symbol').length) {\n $node.children('.title').prepend('<i class=\"fa '+ this.options.parentNodeSymbol + ' symbol\"></i>');\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 $table = $('<table>')\n .append($('<tr>').append($('<td colspan=\"2\">').append(this.createNode(data))))\n .append('<tr class=\"lines\"><td colspan=\"2\"><div class=\"downLine\"></div></td></tr>')\n .append('<tr class=\"lines\"><td class=\"rightLine\"></td><td class=\"leftLine\"></td></tr>');\n this.$chart.prepend($table)\n .children('table:first').append('<tr class=\"nodes\"><td colspan=\"2\"></td></tr>')\n .children('tr:last').children().append(this.$chart.children('table').last());\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 fa\"></i>');\n }\n if (this.isInAction($currentRoot)) {\n this.switchVerticalArrow($currentRoot.children('.topEdge'));\n }\n },\n // subsequent processing of build sibling nodes\n complementLine: function ($oneSibling, siblingCount, existingSibligCount) {\n var lines = '';\n for (var i = 0; i < existingSibligCount; i++) {\n lines += '<td class=\"leftLine topLine\"></td><td class=\"rightLine topLine\"></td>';\n }\n $oneSibling.parent().prevAll('tr:gt(0)').children().attr('colspan', siblingCount * 2)\n .end().next().children(':first').after(lines);\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('td') ? $nodeChart.closest('tr').children().length : 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.parent().is('td')) {\n var $parent = $nodeChart.closest('tr').prevAll('tr:last');\n $nodeChart.closest('tr').prevAll('tr:lt(2)').remove();\n this.buildChildNode($nodeChart.parent().closest('table'), data);\n var $siblingTds = $nodeChart.parent().closest('table').children('tr:last').children('td');\n if (existingSibligCount > 1) {\n this.complementLine($siblingTds.eq(0).before($nodeChart.closest('td').siblings().addBack().unwrap()), siblingCount, existingSibligCount);\n } else {\n this.complementLine($siblingTds.eq(insertPostion).after($nodeChart.closest('td').unwrap()), siblingCount, 1);\n }\n } else { // build the sibling nodes and parent node for the specific ndoe\n this.buildHierarchy($nodeChart.closest('.orgchart'), data);\n this.complementLine($nodeChart.next().children('tr:last').children().eq(insertPostion).after($('<td colspan=\"2\">').append($nodeChart)),\n siblingCount, 1);\n }\n },\n //\n addSiblings: function ($node, data) {\n this.buildSiblingNode($node.closest('table'), data);\n $node.closest('.nodes').data('siblingsLoaded', true);\n if (!$node.children('.leftEdge').length) {\n $node.children('.topEdge').after('<i class=\"edge horizontalEdge rightEdge fa\"></i><i class=\"edge horizontalEdge leftEdge fa\"></i>');\n }\n if (this.isInAction($node)) {\n this.switchHorizontalArrow($node);\n $node.children('.topEdge').removeClass('fa-chevron-up').addClass('fa-chevron-down');\n }\n },\n //\n removeNodes: function ($node) {\n var $parent = $node.closest('table').parent();\n var $sibs = $parent.parent().siblings();\n if ($parent.is('td')) {\n if (this.getNodeState($node, 'siblings').exist) {\n $sibs.eq(2).children('.topLine:lt(2)').remove();\n $sibs.slice(0, 2).children().attr('colspan', $sibs.eq(2).children().length);\n $parent.remove();\n } else {\n $sibs.eq(0).children().removeAttr('colspan')\n .find('.bottomEdge').remove()\n .end().end().siblings().remove();\n }\n } else {\n $parent.add($parent.siblings()).remove();\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=\"fa fa-circle-o-notch fa-spin 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 'onrendered': function (canvas) {\n $chartContainer.find('.mask').addClass('hidden');\n if (exportFileextension.toLowerCase() === 'pdf') {\n var doc = {};\n var docWidth = Math.floor(canvas.width * 0.2646);\n var docHeight = Math.floor(canvas.height * 0.2646);\n if (docWidth > docHeight) {\n doc = new jsPDF('l', 'mm', [docWidth, docHeight]);\n } else {\n doc = new jsPDF('p', 'mm', [docHeight, docWidth]);\n }\n doc.addImage(canvas.toDataURL(), 'png', 0, 0);\n doc.save(exportFilename + '.pdf');\n } else {\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\n if ((!isWebkit && !isFf) || isEdge) {\n window.navigator.msSaveBlob(canvas.msToBlob(), exportFilename + '.png');\n } else {\n var selector = '.oc-download-btn' + (that.options.chartClass !== '' ? '.' + that.options.chartClass : '');\n if (!$chartContainer.find(selector).length) {\n $chartContainer.append('<a class=\"oc-download-btn' + (that.options.chartClass !== '' ? ' ' + that.options.chartClass : '') + '\"'\n + ' download=\"' + exportFilename + '.png\"></a>');\n }\n $chartContainer.find(selector).attr('href', canvas.toDataURL())[0].click();\n }\n }\n }\n })\n .then(function () {\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"]}