jquery.fancytree
Advanced tools
Comparing version 2.30.2 to 2.31.0
@@ -1,2 +0,43 @@ | ||
# 2.30.3-0 / Unreleased | ||
# 2.31.0-0 / Unreleased | ||
* New extension **ext-grid** (experimental)<br> | ||
This is a variant of `ext-table` that introduces viewport support, which | ||
allows to maintain *huge* data models while only rendering as many DOM elements as necessary.<br> | ||
Main changes: | ||
- A viewport is defined by the number of visible rows (`tree.viewport.count`) and the index of the first visible row (`.start`) | ||
- When scrolling, rows are not hidden, but removed and replaced. (This implies that the contents of embedded input fields should be written into the model immediately.) | ||
* Refactored **ext-dnd5**<br> | ||
Some **breaking changes** were made, mainly to improve handling of the dropEffect | ||
(note that ext-dnd5 was and still is experimental and in progress). | ||
- Remove `dnd5.dropEffect` callback option (set `data.dropEffect` instead) | ||
- Remove `dnd5.dragImage` callback option (call `data.dataTransfer.setDragImage()` | ||
- and set `data.useDefaultImage = false` instead) | ||
- Rename `dnd5.preventRecursiveMoves` to `dnd5.preventRecursion` | ||
- `dnd5.preventVoidMoves` now only aplies to 'move' operations, so we can *copy* before self | ||
- [Added] `dnd5.preventSameParent` option | ||
* [Added] hook `treeStructureChanged` | ||
* [Added] methods `tree.findRelatedNode()`, `node.findRelatedNode()` | ||
* [Added] method `node.getPath()` | ||
* [Added] methods `$.ui.fancytree.getDragNode()`, `$.ui.fancytree.getDragNodeList()` | ||
* [Added] event `updateViewport` | ||
* [Added] tree option `.checkboxAutoHide` to hide checkboxes unless selected or hovered. | ||
* [Added] tree option `.treeId` to prevent generation of a new sequence if the tree is re-initialized on a page. | ||
* [Changed] `.getTree()` now also accepts the tree id string | ||
* [Changed] #939: Keep a `partsel` flag that was explicitly set on a lazy node | ||
* [Changed] ext-clones: make default key generation more robust against collisions | ||
* [DEPRECATED] loaderror and lazyload options now throw an error instead of falling back to the correct loadError and lazyLoad | ||
* [DEPRECATED] `tree.applyFilter` was removed | ||
* [Fixed] #918 SVG font awesome 5 glyphs remove badge counter when parent node is collapsed | ||
* [Fixed] #921 ext-edit respectively focus handling: Internet Explorer scrolls briefly | ||
to the top/left of the tree container element after editing a node title if the | ||
tree container is partially outside the viewport | ||
* [Fixed] #931 Selecting grandparent selects all nodes of radiogroup in selectMode=3 | ||
* [Fixed] #946 dnd5 - Counter badge shows up, although the drag was cancelled from dragStart callback | ||
* [Fixed] #947 dnd5 - dragEnd is fired only when re-ordering nodes within the same parent | ||
* [Fixed] missing tree.error() and broken node.error() | ||
* [Fixed] a bug in ext-logger | ||
* Optimized performance of `expandAll()` and `ext-filter` | ||
* Replace jshint/jscs with eslint | ||
* Now testing on Puppeteer/Chromium instead of PhantonJS | ||
* Use LF on Windows when checking out from git (added .gitattributes) | ||
* Update to jQuery 3.4 | ||
@@ -152,3 +193,3 @@ # 2.30.2 / 2019-01-13 | ||
- All modules now return the | ||
[$.ui.fancytree object](http://www.wwwendt.de/tech/fancytree/doc/jsdoc/Fancytree_Static.html). | ||
[$.ui.fancytree object](https://wwWendt.de/tech/fancytree/doc/jsdoc/Fancytree_Static.html). | ||
- [Added] new static method `$.ui.fancytree.createTree(elem, opts)` | ||
@@ -155,0 +196,0 @@ * [Added] Source map files for `jquery.fancytree-all-deps.min.js` |
@@ -1,1 +0,1 @@ | ||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree.ui-deps"],e):"object"==typeof module&&module.exports?(require("./jquery.fancytree.ui-deps"),module.exports=e(require("jquery"))):e(jQuery)}(function(e){"use strict";function t(t,n){t||(n=n?": "+n:"",e.error("Fancytree assertion failed"+n))}function n(e,t){var n,i,r=window.console?window.console[e]:null;if(r)try{r.apply(window.console,t)}catch(e){for(i="",n=0;n<t.length;n++)i+=t[n];r(i)}}function i(){var t,n,r,o,s,a=arguments[0]||{},l=1,d=arguments.length;if("object"==typeof a||e.isFunction(a)||(a={}),l===d)throw"need at least two args";for(;l<d;l++)if(null!=(t=arguments[l]))for(n in t)r=a[n],a!==(o=t[n])&&(o&&e.isPlainObject(o)?(s=r&&e.isPlainObject(r)?r:{},a[n]=i(s,o)):void 0!==o&&(a[n]=o));return a}function r(e,t,n,i,r){return function(){var n=t[e],o=i[e],s=t.ext[r],a=function(){return n.apply(t,arguments)},l=function(e){return n.apply(t,e)};return function(){var e=t._local,n=t._super,i=t._superApply;try{return t._local=s,t._super=a,t._superApply=l,o.apply(t,arguments)}finally{t._local=e,t._super=n,t._superApply=i}}}()}function o(t,n,i,o){for(var s in i)"function"==typeof i[s]?"function"==typeof t[s]?t[s]=r(s,t,0,i,o):"_"===s.charAt(0)?t.ext[o][s]=r(s,t,0,i,o):e.error("Could not override tree."+s+". Use prefix '_' to create tree."+o+"._"+s):"options"!==s&&(t.ext[o][s]=i[s])}function s(t,n){return void 0===t?e.Deferred(function(){this.resolve()}).promise():e.Deferred(function(){this.resolveWith(t,n)}).promise()}function a(t,n){return void 0===t?e.Deferred(function(){this.reject()}).promise():e.Deferred(function(){this.rejectWith(t,n)}).promise()}function l(e,t){return function(){e.resolveWith(t)}}function d(t){var n=e.extend({},t.data()),i=n.json;return delete n.fancytree,delete n.uiFancytree,i&&(delete n.json,n=e.extend(n,i)),n}function c(e){return(""+e).replace(m,function(e){return k[e]})}function u(e){return e=e.toLowerCase(),function(t){return t.title.toLowerCase().indexOf(e)>=0}}function h(n,i){var r,o,s,a;for(this.parent=n,this.tree=n.tree,this.ul=null,this.li=null,this.statusNodeType=null,this._isLoading=!1,this._error=null,this.data={},r=0,o=L.length;r<o;r++)this[s=L[r]]=i[s];null==this.unselectableIgnore&&null==this.unselectableStatus||(this.unselectable=!0),i.hideCheckbox&&e.error("'hideCheckbox' node option was removed in v2.23.0: use 'checkbox: false'"),i.data&&e.extend(this.data,i.data);for(s in i)A[s]||e.isFunction(i[s])||F[s]||(this.data[s]=i[s]);null==this.key?this.tree.options.defaultKey?(this.key=this.tree.options.defaultKey(this),t(this.key,"defaultKey() must return a unique key")):this.key="_"+v._nextNodeKey++:this.key=""+this.key,i.active&&(t(null===this.tree.activeNode,"only one active node allowed"),this.tree.activeNode=this),i.selected&&(this.tree.lastSelectedNode=this),(a=i.children)?a.length?this._setChildren(a):this.children=this.lazy?[]:null:this.children=null,this.tree._callHook("treeRegisterNode",this.tree,!0,this)}function f(t){this.widget=t,this.$div=t.element,this.options=t.options,this.options&&(e.isFunction(this.options.lazyload)&&!e.isFunction(this.options.lazyLoad)&&(this.options.lazyLoad=function(){return v.warn("The 'lazyload' event is deprecated since 2014-02-25. Use 'lazyLoad' (with uppercase L) instead."),t.options.lazyload.apply(this,arguments)}),e.isFunction(this.options.loaderror)&&e.error("The 'loaderror' event was renamed since 2014-07-03. Use 'loadError' (with uppercase E) instead."),void 0!==this.options.fx&&v.warn("The 'fx' option was replaced by 'toggleEffect' since 2014-11-30."),void 0!==this.options.removeNode&&e.error("The 'removeNode' event was replaced by 'modifyChild' since 2.20 (2016-09-10).")),this.ext={},this.types={},this.columns={},this.data=d(this.$div),this._id=e.ui.fancytree._nextId++,this._ns=".fancytree-"+this._id,this.activeNode=null,this.focusNode=null,this._hasFocus=null,this._tempCache={},this._lastMousedownNode=null,this._enableUpdate=!0,this.lastSelectedNode=null,this.systemFocusElement=null,this.lastQuicksearchTerm="",this.lastQuicksearchTime=0,this.statusClassPropName="span",this.ariaPropName="li",this.nodeContainerAttrName="li",this.$div.find(">ul.fancytree-container").remove();var n,i={tree:this};this.rootNode=new h(i,{title:"root",key:"root_"+this._id,children:null,expanded:!0}),this.rootNode.parent=null,n=e("<ul>",{class:"ui-fancytree fancytree-container fancytree-plain"}).appendTo(this.$div),this.$container=n,this.rootNode.ul=n[0],null==this.options.debugLevel&&(this.options.debugLevel=v.debugLevel)}{if(!e.ui||!e.ui.fancytree){var p,g,v=null,y=new RegExp(/\.|\//),b=/[&<>"'\/]/g,m=/[<>"'\/]/g,x="$recursive_request",k={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},N={16:!0,17:!0,18:!0},_={8:"backspace",9:"tab",10:"return",13:"return",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},C={16:"shift",17:"ctrl",18:"alt",91:"meta",93:"meta"},w={0:"",1:"left",2:"middle",3:"right"},S="active expanded focus folder lazy radiogroup selected unselectable unselectableIgnore".split(" "),E={},T="columns types".split(" "),L="checkbox expanded extraClasses folder icon iconTooltip key lazy partsel radiogroup refKey selected statusNodeType title tooltip type unselectable unselectableIgnore unselectableStatus".split(" "),A={},P={},F={active:!0,children:!0,data:!0,focus:!0};for(p=0;p<S.length;p++)E[S[p]]=!0;for(p=0;p<L.length;p++)g=L[p],A[g]=!0,g!==g.toLowerCase()&&(P[g.toLowerCase()]=g);return t(e.ui,"Fancytree requires jQuery UI (http://jqueryui.com)"),Date.now||(Date.now=function(){return(new Date).getTime()}),h.prototype={_findDirectChild:function(e){var t,n,i=this.children;if(i)if("string"==typeof e){for(t=0,n=i.length;t<n;t++)if(i[t].key===e)return i[t]}else{if("number"==typeof e)return this.children[e];if(e.parent===this)return e}return null},_setChildren:function(e){t(e&&(!this.children||0===this.children.length),"only init supported"),this.children=[];for(var n=0,i=e.length;n<i;n++)this.children.push(new h(this,e[n]))},addChildren:function(n,i){var r,o,s,a=this.getFirstChild(),l=this.getLastChild(),d=null,c=[];for(e.isPlainObject(n)&&(n=[n]),this.children||(this.children=[]),r=0,o=n.length;r<o;r++)c.push(new h(this,n[r]));if(d=c[0],null==i?this.children=this.children.concat(c):(i=this._findDirectChild(i),t((s=e.inArray(i,this.children))>=0,"insertBefore must be an existing child"),this.children.splice.apply(this.children,[s,0].concat(c))),a&&!i){for(r=0,o=c.length;r<o;r++)c[r].render();a!==this.getFirstChild()&&a.renderStatus(),l!==this.getLastChild()&&l.renderStatus()}else(!this.parent||this.parent.ul||this.tr)&&this.render();return 3===this.tree.options.selectMode&&this.fixSelection3FromEndNodes(),this.triggerModifyChild("add",1===c.length?c[0]:null),d},addClass:function(e){return this.toggleClass(e,!0)},addNode:function(e,n){switch(void 0!==n&&"over"!==n||(n="child"),n){case"after":return this.getParent().addChildren(e,this.getNextSibling());case"before":return this.getParent().addChildren(e,this);case"firstChild":var i=this.children?this.children[0]:null;return this.addChildren(e,i);case"child":case"over":return this.addChildren(e)}t(!1,"Invalid mode: "+n)},addPagingNode:function(t,n){var i,r;n=n||"child";{if(!1!==t)return t=e.extend({title:this.tree.options.strings.moreData,statusNodeType:"paging",icon:!1},t),this.partload=!0,this.addNode(t,n);for(i=this.children.length-1;i>=0;i--)"paging"===(r=this.children[i]).statusNodeType&&this.removeChild(r);this.partload=!1}},appendSibling:function(e){return this.addNode(e,"after")},applyPatch:function(t){if(null===t)return this.remove(),s(this);var n,i,r={children:!0,expanded:!0,parent:!0};for(n in t)i=t[n],r[n]||e.isFunction(i)||(A[n]?this[n]=i:this.data[n]=i);return t.hasOwnProperty("children")&&(this.removeChildren(),t.children&&this._setChildren(t.children)),this.isVisible()&&(this.renderTitle(),this.renderStatus()),t.hasOwnProperty("expanded")?this.setExpanded(t.expanded):s(this)},collapseSiblings:function(){return this.tree._callHook("nodeCollapseSiblings",this)},copyTo:function(e,t,n){return e.addNode(this.toDict(!0,n),t)},countChildren:function(e){var t,n,i,r=this.children;if(!r)return 0;if(i=r.length,!1!==e)for(t=0,n=i;t<n;t++)i+=r[t].countChildren();return i},debug:function(e){this.tree.options.debugLevel>=4&&(Array.prototype.unshift.call(arguments,this.toString()),n("log",arguments))},discard:function(){return this.warn("FancytreeNode.discard() is deprecated since 2014-02-16. Use .resetLazy() instead."),this.resetLazy()},discardMarkup:function(e){var t=e?"nodeRemoveMarkup":"nodeRemoveChildMarkup";this.tree._callHook(t,this)},error:function(e){this.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),n("error",arguments))},findAll:function(t){t=e.isFunction(t)?t:u(t);var n=[];return this.visit(function(e){t(e)&&n.push(e)}),n},findFirst:function(t){t=e.isFunction(t)?t:u(t);var n=null;return this.visit(function(e){if(t(e))return n=e,!1}),n},_changeSelectStatusAttrs:function(e){var n=!1,i=this.tree.options,r=v.evalOption("unselectable",this,this,i,!1),o=v.evalOption("unselectableStatus",this,this,i,void 0);switch(r&&null!=o&&(e=o),e){case!1:n=this.selected||this.partsel,this.selected=!1,this.partsel=!1;break;case!0:n=!this.selected||!this.partsel,this.selected=!0,this.partsel=!0;break;case void 0:n=this.selected||!this.partsel,this.selected=!1,this.partsel=!0;break;default:t(!1,"invalid state: "+e)}return n&&this.renderStatus(),n},fixSelection3AfterClick:function(e){var t=this.isSelected();this.visit(function(e){e._changeSelectStatusAttrs(t)}),this.fixSelection3FromEndNodes(e)},fixSelection3FromEndNodes:function(e){function n(e){var t,r,o,s,a,l,d,c,u=e.children;if(u&&u.length){for(l=!0,d=!1,t=0,r=u.length;t<r;t++)s=n(o=u[t]),v.evalOption("unselectableIgnore",o,o,i,!1)||(!1!==s&&(d=!0),!0!==s&&(l=!1));a=!!l||!!d&&void 0}else a=null==(c=v.evalOption("unselectableStatus",e,e,i,void 0))?!!e.selected:!!c;return e._changeSelectStatusAttrs(a),a}var i=this.tree.options;t(3===i.selectMode,"expected selectMode 3"),n(this),this.visitParents(function(e){var t,n,r,o,s,a=e.children,l=!0,d=!1;for(t=0,n=a.length;t<n;t++)r=a[t],v.evalOption("unselectableIgnore",r,r,i,!1)||(((o=null==(s=v.evalOption("unselectableStatus",r,r,i,void 0))?!!r.selected:!!s)||r.partsel)&&(d=!0),o||(l=!1));o=!!l||!!d&&void 0,e._changeSelectStatusAttrs(o)})},fromDict:function(t){for(var n in t)A[n]?this[n]=t[n]:"data"===n?e.extend(this.data,t.data):e.isFunction(t[n])||F[n]||(this.data[n]=t[n]);t.children&&(this.removeChildren(),this.addChildren(t.children)),this.renderTitle()},getChildren:function(){if(void 0!==this.hasChildren())return this.children},getFirstChild:function(){return this.children?this.children[0]:null},getIndex:function(){return e.inArray(this,this.parent.children)},getIndexHier:function(t,n){t=t||".";var i,r=[];return e.each(this.getParentList(!1,!0),function(e,t){i=""+(t.getIndex()+1),n&&(i=("0000000"+i).substr(-n)),r.push(i)}),r.join(t)},getKeyPath:function(e){var t=[],n=this.tree.options.keyPathSeparator;return this.visitParents(function(e){e.parent&&t.unshift(e.key)},!e),n+t.join(n)},getLastChild:function(){return this.children?this.children[this.children.length-1]:null},getLevel:function(){for(var e=0,t=this.parent;t;)e++,t=t.parent;return e},getNextSibling:function(){if(this.parent){var e,t,n=this.parent.children;for(e=0,t=n.length-1;e<t;e++)if(n[e]===this)return n[e+1]}return null},getParent:function(){return this.parent},getParentList:function(e,t){for(var n=[],i=t?this:this.parent;i;)(e||i.parent)&&n.unshift(i),i=i.parent;return n},getPrevSibling:function(){if(this.parent){var e,t,n=this.parent.children;for(e=1,t=n.length;e<t;e++)if(n[e]===this)return n[e-1]}return null},getSelectedNodes:function(e){var t=[];return this.visit(function(n){if(n.selected&&(t.push(n),!0===e))return"skip"}),t},hasChildren:function(){if(this.lazy){if(null==this.children)return;if(0===this.children.length)return!1;if(1===this.children.length&&this.children[0].isStatusNode())return;return!0}return!(!this.children||!this.children.length)},hasFocus:function(){return this.tree.hasFocus()&&this.tree.focusNode===this},info:function(e){this.tree.options.debugLevel>=3&&(Array.prototype.unshift.call(arguments,this.toString()),n("info",arguments))},isActive:function(){return this.tree.activeNode===this},isBelowOf:function(e){return this.getIndexHier(".",5)>e.getIndexHier(".",5)},isChildOf:function(e){return this.parent&&this.parent===e},isDescendantOf:function(t){if(!t||t.tree!==this.tree)return!1;for(var n=this.parent;n;){if(n===t)return!0;n===n.parent&&e.error("Recursive parent link: "+n),n=n.parent}return!1},isExpanded:function(){return!!this.expanded},isFirstSibling:function(){var e=this.parent;return!e||e.children[0]===this},isFolder:function(){return!!this.folder},isLastSibling:function(){var e=this.parent;return!e||e.children[e.children.length-1]===this},isLazy:function(){return!!this.lazy},isLoaded:function(){return!this.lazy||void 0!==this.hasChildren()},isLoading:function(){return!!this._isLoading},isRoot:function(){return this.isRootNode()},isPartsel:function(){return!this.selected&&!!this.partsel},isPartload:function(){return!!this.partload},isRootNode:function(){return this.tree.rootNode===this},isSelected:function(){return!!this.selected},isStatusNode:function(){return!!this.statusNodeType},isPagingNode:function(){return"paging"===this.statusNodeType},isTopLevel:function(){return this.tree.rootNode===this.parent},isUndefined:function(){return void 0===this.hasChildren()},isVisible:function(){var e,t,n=this.getParentList(!1,!1);for(e=0,t=n.length;e<t;e++)if(!n[e].expanded)return!1;return!0},lazyLoad:function(e){return this.warn("FancytreeNode.lazyLoad() is deprecated since 2014-02-16. Use .load() instead."),this.load(e)},load:function(e){var n,i,r=this,o=this.isExpanded();return t(this.isLazy(),"load() requires a lazy node"),e||this.isUndefined()?(this.isLoaded()&&this.resetLazy(),!1===(i=this.tree._triggerNodeEvent("lazyLoad",this))?s(this):(t("boolean"!=typeof i,"lazyLoad event must return source in data.result"),n=this.tree._callHook("nodeLoadChildren",this,i),o?(this.expanded=!0,n.always(function(){r.render()})):n.always(function(){r.renderStatus()}),n)):s(this)},makeVisible:function(t){var n,i=this,r=[],o=new e.Deferred,s=this.getParentList(!1,!1),a=s.length,l=!(t&&!0===t.noAnimation),d=!(t&&!1===t.scrollIntoView);for(n=a-1;n>=0;n--)r.push(s[n].setExpanded(!0,t));return e.when.apply(e,r).done(function(){d?i.scrollIntoView(l).done(function(){o.resolve()}):o.resolve()}),o.promise()},moveTo:function(n,i,r){void 0===i||"over"===i?i="child":"firstChild"===i&&(n.children&&n.children.length?(i="before",n=n.children[0]):i="child");var o,s=this.parent,a="child"===i?n:n.parent;if(this!==n){if(this.parent?a.isDescendantOf(this)&&e.error("Cannot move a node to its own descendant"):e.error("Cannot move system root"),a!==s&&s.triggerModifyChild("remove",this),1===this.parent.children.length){if(this.parent===a)return;this.parent.children=this.parent.lazy?[]:null,this.parent.expanded=!1}else t((o=e.inArray(this,this.parent.children))>=0,"invalid source parent"),this.parent.children.splice(o,1);if(this.parent=a,a.hasChildren())switch(i){case"child":a.children.push(this);break;case"before":t((o=e.inArray(n,a.children))>=0,"invalid target parent"),a.children.splice(o,0,this);break;case"after":t((o=e.inArray(n,a.children))>=0,"invalid target parent"),a.children.splice(o+1,0,this);break;default:e.error("Invalid mode "+i)}else a.children=[this];r&&n.visit(r,!0),a===s?a.triggerModifyChild("move",this):a.triggerModifyChild("add",this),this.tree!==n.tree&&(this.warn("Cross-tree moveTo is experimantal!"),this.visit(function(e){e.tree=n.tree},!0)),s.isDescendantOf(a)||s.render(),a.isDescendantOf(s)||a===s||a.render()}},navigate:function(t,n){function i(i){if(i){try{i.makeVisible({scrollIntoView:!1})}catch(e){}return e(i.span).is(":visible")?!1===n?i.setFocus():i.setActive():(i.debug("Navigate: skipping hidden node"),void i.navigate(t,n))}}var r,o,a,l=e.ui.keyCode,d=null;switch(t){case l.BACKSPACE:this.parent&&this.parent.parent&&(a=i(this.parent));break;case l.HOME:this.tree.visit(function(t){if(e(t.span).is(":visible"))return a=i(t),!1});break;case l.END:this.tree.visit(function(t){e(t.span).is(":visible")&&(a=t)}),a&&(a=i(a));break;case l.LEFT:this.expanded?(this.setExpanded(!1),a=i(this)):this.parent&&this.parent.parent&&(a=i(this.parent));break;case l.RIGHT:this.expanded||!this.children&&!this.lazy?this.children&&this.children.length&&(a=i(this.children[0])):(this.setExpanded(),a=i(this));break;case l.UP:for(d=this.getPrevSibling();d&&!e(d.span).is(":visible");)d=d.getPrevSibling();for(;d&&d.expanded&&d.children&&d.children.length;)d=d.children[d.children.length-1];!d&&this.parent&&this.parent.parent&&(d=this.parent),a=i(d);break;case l.DOWN:if(this.expanded&&this.children&&this.children.length)d=this.children[0];else for(r=(o=this.getParentList(!1,!0)).length-1;r>=0;r--){for(d=o[r].getNextSibling();d&&!e(d.span).is(":visible");)d=d.getNextSibling();if(d)break}a=i(d);break;default:!1}return a||s()},remove:function(){return this.parent.removeChild(this)},removeChild:function(e){return this.tree._callHook("nodeRemoveChild",this,e)},removeChildren:function(){return this.tree._callHook("nodeRemoveChildren",this)},removeClass:function(e){return this.toggleClass(e,!1)},render:function(e,t){return this.tree._callHook("nodeRender",this,e,t)},renderTitle:function(){return this.tree._callHook("nodeRenderTitle",this)},renderStatus:function(){return this.tree._callHook("nodeRenderStatus",this)},replaceWith:function(n){var i,r=this.parent,o=e.inArray(this,r.children),s=this;return t(this.isPagingNode(),"replaceWith() currently requires a paging status node"),(i=this.tree._callHook("nodeLoadChildren",this,n)).done(function(e){var t=s.children;for(p=0;p<t.length;p++)t[p].parent=r;r.children.splice.apply(r.children,[o+1,0].concat(t)),s.children=null,s.remove(),r.render()}).fail(function(){s.setExpanded()}),i},resetLazy:function(){this.removeChildren(),this.expanded=!1,this.lazy=!0,this.children=void 0,this.renderStatus()},scheduleAction:function(t,n){this.tree.timer&&(clearTimeout(this.tree.timer),this.tree.debug("clearTimeout(%o)",this.tree.timer)),this.tree.timer=null;var i=this;switch(t){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){i.tree.debug("setTimeout: trigger expand"),i.setExpanded(!0)},n);break;case"activate":this.tree.timer=setTimeout(function(){i.tree.debug("setTimeout: trigger activate"),i.setActive(!0)},n);break;default:e.error("Invalid mode "+t)}},scrollIntoView:function(n,i){if(void 0!==i&&function(e){return!(!e.tree||void 0===e.statusNodeType)}(i))throw"scrollIntoView() with 'topNode' option is deprecated since 2014-05-08. Use 'options.topNode' instead.";var r=e.extend({effects:!0===n?{duration:200,queue:!1}:n,scrollOfs:this.tree.options.scrollOfs,scrollParent:this.tree.options.scrollParent,topNode:null},i),o=r.scrollParent,a=this.tree.$container,l=a.css("overflow-y");o?o.jquery||(o=e(o)):o=this.tree.tbody?a.scrollParent():"scroll"===l||"auto"===l?a:a.scrollParent(),o[0]!==document&&o[0]!==document.body||(this.debug("scrollIntoView(): normalizing scrollParent to 'window':",o[0]),o=e(window));var d,c,u,h=new e.Deferred,f=this,p=e(this.span).height(),g=r.scrollOfs.top||0,v=r.scrollOfs.bottom||0,y=o.height(),b=o.scrollTop(),m=o,x=o[0]===window,k=r.topNode||null,N=null;return e(this.span).is(":visible")?(x?(c=e(this.span).offset().top,d=k&&k.span?e(k.span).offset().top:0,m=e("html,body")):(t(o[0]!==document&&o[0]!==document.body,"scrollParent should be a simple element or `window`, not document or body."),u=o.offset().top,c=e(this.span).offset().top-u+b,d=k?e(k.span).offset().top-u+b:0,y-=Math.max(0,o.innerHeight()-o[0].clientHeight)),c<b+g?N=c-g:c+p>b+y-v&&(N=c+p-y+v,k&&(t(k.isRootNode()||e(k.span).is(":visible"),"topNode must be visible"),d<N&&(N=d-g))),null!==N?r.effects?(r.effects.complete=function(){h.resolveWith(f)},m.stop(!0).animate({scrollTop:N},r.effects)):(m[0].scrollTop=N,h.resolveWith(this)):h.resolveWith(this),h.promise()):(this.warn("scrollIntoView(): node is invisible."),s())},setActive:function(e,t){return this.tree._callHook("nodeSetActive",this,e,t)},setExpanded:function(e,t){return this.tree._callHook("nodeSetExpanded",this,e,t)},setFocus:function(e){return this.tree._callHook("nodeSetFocus",this,e)},setSelected:function(e,t){return this.tree._callHook("nodeSetSelected",this,e,t)},setStatus:function(e,t,n){return this.tree._callHook("nodeSetStatus",this,e,t,n)},setTitle:function(e){this.title=e,this.renderTitle(),this.triggerModify("rename")},sortChildren:function(e,t){var n,i,r=this.children;if(r){if(e=e||function(e,t){var n=e.title.toLowerCase(),i=t.title.toLowerCase();return n===i?0:n>i?1:-1},r.sort(e),t)for(n=0,i=r.length;n<i;n++)r[n].children&&r[n].sortChildren(e,"$norender$");"$norender$"!==t&&this.render(),this.triggerModifyChild("sort")}},toDict:function(t,n){var i,r,o,s={},a=this;if(e.each(L,function(e,t){(a[t]||!1===a[t])&&(s[t]=a[t])}),e.isEmptyObject(this.data)||(s.data=e.extend({},this.data),e.isEmptyObject(s.data)&&delete s.data),n&&n(s,a),t&&this.hasChildren())for(s.children=[],i=0,r=this.children.length;i<r;i++)(o=this.children[i]).isStatusNode()||s.children.push(o.toDict(!0,n));return s},toggleClass:function(t,n){var i,r,o=t.match(/\S+/g)||[],s=0,a=!1,l=this[this.tree.statusClassPropName],d=" "+(this.extraClasses||"")+" ";for(l&&e(l).toggleClass(t,n);i=o[s++];)if(r=d.indexOf(" "+i+" ")>=0,n=void 0===n?!r:!!n)r||(d+=i+" ",a=!0);else for(;d.indexOf(" "+i+" ")>-1;)d=d.replace(" "+i+" "," ");return this.extraClasses=e.trim(d),a},toggleExpanded:function(){return this.tree._callHook("nodeToggleExpanded",this)},toggleSelected:function(){return this.tree._callHook("nodeToggleSelected",this)},toString:function(){return"FancytreeNode@"+this.key+"[title='"+this.title+"']"},triggerModifyChild:function(t,n,i){var r,o=this.tree.options.modifyChild;o&&(n&&n.parent!==this&&e.error("childNode "+n+" is not a child of "+this),r={node:this,tree:this.tree,operation:t,childNode:n||null},i&&e.extend(r,i),o({type:"modifyChild"},r))},triggerModify:function(e,t){this.parent.triggerModifyChild(e,this,t)},visit:function(e,t){var n,i,r=!0,o=this.children;if(!0===t&&(!1===(r=e(this))||"skip"===r))return r;if(o)for(n=0,i=o.length;n<i&&!1!==(r=o[n].visit(e,!0));n++);return r},visitAndLoad:function(t,n,i){var r,o,a,l=this;return!t||!0!==n||!1!==(o=t(l))&&"skip"!==o?l.children||l.lazy?(r=new e.Deferred,a=[],l.load().done(function(){for(var n=0,i=l.children.length;n<i;n++){if(!1===(o=l.children[n].visitAndLoad(t,!0,!0))){r.reject();break}"skip"!==o&&a.push(o)}e.when.apply(this,a).then(function(){r.resolve()})}),r.promise()):s():i?o:s()},visitParents:function(e,t){if(t&&!1===e(this))return!1;for(var n=this.parent;n;){if(!1===e(n))return!1;n=n.parent}return!0},visitSiblings:function(e,t){var n,i,r,o=this.parent.children;for(n=0,i=o.length;n<i;n++)if(r=o[n],(t||r!==this)&&!1===e(r))return!1;return!0},warn:function(e){this.tree.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),n("warn",arguments))}},f.prototype={_makeHookContext:function(t,n,i){var r,o;return void 0!==t.node?(n&&t.originalEvent!==n&&e.error("invalid args"),r=t):t.tree?r={node:t,tree:o=t.tree,widget:o.widget,options:o.widget.options,originalEvent:n,typeInfo:o.types[t.type]||{}}:t.widget?r={node:null,tree:t,widget:t.widget,options:t.widget.options,originalEvent:n}:e.error("invalid args"),i&&e.extend(r,i),r},_callHook:function(t,n,i){var r=this._makeHookContext(n),o=this[t],s=Array.prototype.slice.call(arguments,2);return e.isFunction(o)||e.error("_callHook('"+t+"') is not a function"),s.unshift(r),o.apply(this,s)},_setExpiringValue:function(e,t,n){this._tempCache[e]={value:t,expire:Date.now()+(+n||50)}},_getExpiringValue:function(e){var t=this._tempCache[e];return t&&t.expire>Date.now()?t.value:(delete this._tempCache[e],null)},_requireExtension:function(n,i,r,o){null!=r&&(r=!!r);var s=this._local.name,a=this.options.extensions,l=e.inArray(n,a)<e.inArray(s,a),d=i&&null==this.ext[n],c=!d&&null!=r&&r!==l;return t(s&&s!==n,"invalid or same name"),!d&&!c||(o||(d||i?(o="'"+s+"' extension requires '"+n+"'",c&&(o+=" to be registered "+(r?"before":"after")+" itself")):o="If used together, `"+n+"` must be registered "+(r?"before":"after")+" `"+s+"`"),e.error(o),!1)},activateKey:function(e,t){var n=this.getNodeByKey(e);return n?n.setActive(!0,t):this.activeNode&&this.activeNode.setActive(!1,t),n},addPagingNode:function(e,t){return this.rootNode.addPagingNode(e,t)},applyPatch:function(n){var i,r,o,s,a,d,c=n.length,u=[];for(r=0;r<c;r++)t(2===(o=n[r]).length,"patchList must be an array of length-2-arrays"),s=o[0],a=o[1],(d=null===s?this.rootNode:this.getNodeByKey(s))?(i=new e.Deferred,u.push(i),d.applyPatch(a).always(l(i,d))):this.warn("could not find node with key '"+s+"'");return e.when.apply(e,u).promise()},clear:function(e){this._callHook("treeClear",this)},count:function(){return this.rootNode.countChildren()},debug:function(e){this.options.debugLevel>=4&&(Array.prototype.unshift.call(arguments,this.toString()),n("log",arguments))},enable:function(e){!1===e?this.widget.disable():this.widget.enable()},enableUpdate:function(e){return e=!1!==e,!!this._enableUpdate==!!e?e:(this._enableUpdate=e,e?(this.debug("enableUpdate(true): redraw "),this.render()):this.debug("enableUpdate(false)..."),!e)},expandAll:function(e,t){e=!1!==e,this.visit(function(n){!1!==n.hasChildren()&&n.isExpanded()!==e&&n.setExpanded(e,t)})},findAll:function(e){return this.rootNode.findAll(e)},findFirst:function(e){return this.rootNode.findFirst(e)},findNextNode:function(t,n,i){t="string"==typeof t?function(e){var t=new RegExp("^"+e,"i");return function(e){return t.test(e.title)}}(t):t;var r=null,o=(n=n||this.getFirstChild()).parent.children,s=null,a=function(e,t,n){var i,r,o=e.children,s=o.length,l=o[t];if(l&&!1===n(l))return!1;if(l&&l.children&&l.expanded&&!1===a(l,0,n))return!1;for(i=t+1;i<s;i++)if(!1===a(e,i,n))return!1;return(r=e.parent)?a(r,r.children.indexOf(e)+1,n):a(e,0,n)};return a(n.parent,o.indexOf(n),function(i){if(i===r)return!1;r=r||i;{if(e(i.span).is(":visible"))return(!t(i)||(s=i)===n)&&void 0;i.debug("quicksearch: skipping hidden node")}}),s},generateFormElements:function(t,n,i){function r(t){d.append(e("<input>",{type:"checkbox",name:s,value:t.key,checked:!0}))}i=i||{};var o,s="string"==typeof t?t:"ft_"+this._id+"[]",a="string"==typeof n?n:"ft_"+this._id+"_active",l="fancytree_result_"+this._id,d=e("#"+l),c=3===this.options.selectMode&&!1!==i.stopOnParents;d.length?d.empty():d=e("<div>",{id:l}).hide().insertAfter(this.$container),!1!==n&&this.activeNode&&d.append(e("<input>",{type:"radio",name:a,value:this.activeNode.key,checked:!0})),i.filter?this.visit(function(e){var t=i.filter(e);if("skip"===t)return t;!1!==t&&r(e)}):!1!==t&&(o=this.getSelectedNodes(c),e.each(o,function(e,t){r(t)}))},getActiveNode:function(){return this.activeNode},getFirstChild:function(){return this.rootNode.getFirstChild()},getFocusNode:function(){return this.focusNode},getOption:function(e){return this.widget.option(e)},getNodeByKey:function(e,t){var n,i;return!t&&(n=document.getElementById(this.options.idPrefix+e))?n.ftnode?n.ftnode:null:(t=t||this.rootNode,i=null,t.visit(function(t){if(t.key===e)return i=t,!1},!0),i)},getRootNode:function(){return this.rootNode},getSelectedNodes:function(e){return this.rootNode.getSelectedNodes(e)},hasFocus:function(){return!!this._hasFocus},info:function(e){this.options.debugLevel>=3&&(Array.prototype.unshift.call(arguments,this.toString()),n("info",arguments))},loadKeyPath:function(t,n){var i,r,o,s=this,a=new e.Deferred,l=this.getRootNode(),d=this.options.keyPathSeparator,c=[],u=e.extend({},n);for("function"==typeof n?i=n:n&&n.callback&&(i=n.callback),u.callback=function(e,t,n){i&&i.call(e,t,n),a.notifyWith(e,[{node:t,status:n}])},null==u.matchKey&&(u.matchKey=function(e,t){return e.key===t}),e.isArray(t)||(t=[t]),r=0;r<t.length;r++)(o=t[r]).charAt(0)===d&&(o=o.substr(1)),c.push(o.split(d));return setTimeout(function(){s._loadKeyPathImpl(a,u,l,c).done(function(){a.resolve()})},0),a.promise()},_loadKeyPathImpl:function(t,n,i,r){function o(e,t){var i,r,o=e.children;if(o)for(i=0,r=o.length;i<r;i++)if(n.matchKey(o[i],t))return o[i];return null}function s(e,t,i){n.callback(v,t,"loading"),t.load().done(function(){v._loadKeyPathImpl.call(v,e,n,t,i).always(l(e,v))}).fail(function(i){v.warn("loadKeyPath: error loading lazy "+t),n.callback(v,u,"error"),e.rejectWith(v)})}var a,d,c,u,h,f,p,g,v=this;for(h={},d=0;d<r.length;d++)for(p=r[d],f=i;p.length;){if(c=p.shift(),!(u=o(f,c))){this.warn("loadKeyPath: key not found: "+c+" (parent: "+f+")"),n.callback(this,c,"error");break}if(0===p.length){n.callback(this,u,"ok");break}if(u.lazy&&void 0===u.hasChildren()){n.callback(this,u,"loaded"),h[c=u.key]?h[c].pathSegList.push(p):h[c]={parent:u,pathSegList:[p]};break}n.callback(this,u,"loaded"),f=u}a=[];for(var y in h){var b=h[y];g=new e.Deferred,a.push(g),s(g,b.parent,b.pathSegList)}return e.when.apply(e,a).promise()},reactivate:function(e){var t,n=this.activeNode;return n?(this.activeNode=null,t=n.setActive(!0,{noFocus:!0}),e&&n.setFocus(),t):s()},reload:function(e){return this._callHook("treeClear",this),this._callHook("treeLoad",this,e)},render:function(e,t){return this.rootNode.render(e,t)},selectAll:function(e){this.visit(function(t){t.setSelected(e)})},setFocus:function(e){return this._callHook("treeSetFocus",this,e)},setOption:function(e,t){return this.widget.option(e,t)},toDict:function(e,t){var n=this.rootNode.toDict(!0,t);return e?n:n.children},toString:function(){return"Fancytree@"+this._id},_triggerNodeEvent:function(e,t,n,i){var r=this._makeHookContext(t,n,i),o=this.widget._trigger(e,n,r);return!1!==o&&void 0!==r.result?r.result:o},_triggerTreeEvent:function(e,t,n){var i=this._makeHookContext(this,t,n),r=this.widget._trigger(e,t,i);return!1!==r&&void 0!==i.result?i.result:r},visit:function(e){return this.rootNode.visit(e,!1)},visitRows:function(e,t){if(t&&t.reverse)return delete t.reverse,this._visitRowsUp(e,t);var n,i,r,o=0,s=!1===t.includeSelf,a=!!t.includeHidden,l=t.start||this.rootNode.children[0];for(i=l.parent;i;){for(n=(r=i.children).indexOf(l)+o;n<r.length;n++){if(l=r[n],!s&&!1===e(l))return!1;if(s=!1,l.children&&l.children.length&&(a||l.expanded)&&!1===l.visit(function(t){return!1!==e(t)&&(a||!t.children||t.expanded?void 0:"skip")},!1))return!1}l=i,i=i.parent,o=1}return!0},_visitRowsUp:function(t,n){for(var i,r,o=!!n.includeHidden,s=n.start||this.rootNode.children[0];;){if(r=s.parent,(i=r.children)[0]===s)s=r,i=r.children;else for(s=i[i.indexOf(s)-1];(o||s.expanded)&&s.children&&s.children.length;)r=s,s=(i=s.children)[i.length-1];if((o||e(s.span).is(":visible"))&&!1===t(s))return!1}},warn:function(e){this.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),n("warn",arguments))}},e.extend(f.prototype,{nodeClick:function(e){var t,n,i=e.targetType,r=e.node;if("expander"===i){if(r.isLoading())return void r.debug("Got 2nd click while loading: ignored");this._callHook("nodeToggleExpanded",e)}else if("checkbox"===i)this._callHook("nodeToggleSelected",e),e.options.focusOnSelect&&this._callHook("nodeSetFocus",e,!0);else{if(n=!1,t=!0,r.folder)switch(e.options.clickFolderMode){case 2:n=!0,t=!1;break;case 3:t=!0,n=!0}t&&(this.nodeSetFocus(e),this._callHook("nodeSetActive",e,!0)),n&&this._callHook("nodeToggleExpanded",e)}},nodeCollapseSiblings:function(e,t){var n,i,r,o=e.node;if(o.parent)for(i=0,r=(n=o.parent.children).length;i<r;i++)n[i]!==o&&n[i].expanded&&this._callHook("nodeSetExpanded",n[i],!1,t)},nodeDblclick:function(e){"title"===e.targetType&&4===e.options.clickFolderMode&&this._callHook("nodeToggleExpanded",e),"title"===e.targetType&&e.originalEvent.preventDefault()},nodeKeydown:function(t){var n,i,r,o=t.originalEvent,s=t.node,a=t.tree,l=t.options,d=o.which,c=o.key||String.fromCharCode(d),u=!!(o.altKey||o.ctrlKey||o.metaKey),h=!C[d]&&!_[d]&&!u,f=e(o.target),p=!0,g=!(o.ctrlKey||!l.autoActivate);if(s||(r=this.getActiveNode()||this.getFirstChild())&&(r.setFocus(),(s=t.node=this.focusNode).debug("Keydown force focus on active node")),l.quicksearch&&h&&!f.is(":input:enabled"))return(i=Date.now())-a.lastQuicksearchTime>500&&(a.lastQuicksearchTerm=""),a.lastQuicksearchTime=i,a.lastQuicksearchTerm+=c,(n=a.findNextNode(a.lastQuicksearchTerm,a.getActiveNode()))&&n.setActive(),void o.preventDefault();switch(v.eventToString(o)){case"+":case"=":a.nodeSetExpanded(t,!0);break;case"-":a.nodeSetExpanded(t,!1);break;case"space":s.isPagingNode()?a._triggerNodeEvent("clickPaging",t,o):v.evalOption("checkbox",s,s,l,!1)?a.nodeToggleSelected(t):a.nodeSetActive(t,!0);break;case"return":a.nodeSetActive(t,!0);break;case"home":case"end":case"backspace":case"left":case"right":case"up":case"down":s.navigate(o.which,g);break;default:p=!1}p&&o.preventDefault()},nodeLoadChildren:function(n,i){var r,o,s,a=n.tree,l=n.node,d=Date.now();if(e.isFunction(i)&&(i=i.call(a,{type:"source"},n),t(!e.isFunction(i),"source callback must not return another function")),i.url&&(l._requestId&&l.warn("Recursive load request #"+d+" while #"+l._requestId+" is pending."),r=e.extend({},n.options.ajax,i),l._requestId=d,r.debugDelay?(o=r.debugDelay,delete r.debugDelay,e.isArray(o)&&(o=o[0]+Math.random()*(o[1]-o[0])),l.warn("nodeLoadChildren waiting debugDelay "+Math.round(o)+" ms ..."),s=e.Deferred(function(t){setTimeout(function(){e.ajax(r).done(function(){t.resolveWith(this,arguments)}).fail(function(){t.rejectWith(this,arguments)})},o)})):s=e.ajax(r),i=new e.Deferred,s.done(function(t,r,o){var s,c;if("json"!==this.dataType&&"jsonp"!==this.dataType||"string"!=typeof t||e.error("Ajax request returned a string (did you get the JSON dataType wrong?)."),l._requestId&&l._requestId>d)i.rejectWith(this,[x]);else{if(n.options.postProcess){try{c=a._triggerNodeEvent("postProcess",n,n.originalEvent,{response:t,error:null,dataType:this.dataType})}catch(e){c={error:e,message:""+e,details:"postProcess failed"}}if(c.error)return s=e.isPlainObject(c.error)?c.error:{message:c.error},s=a._makeHookContext(l,null,s),void i.rejectWith(this,[s]);(e.isArray(c)||e.isPlainObject(c)&&e.isArray(c.children))&&(t=c)}else t&&t.hasOwnProperty("d")&&n.options.enableAspx&&(t="string"==typeof t.d?e.parseJSON(t.d):t.d);i.resolveWith(this,[t])}}).fail(function(e,t,n){var r=a._makeHookContext(l,null,{error:e,args:Array.prototype.slice.call(arguments),message:n,details:e.status+": "+n});i.rejectWith(this,[r])})),e.isFunction(i.then)&&e.isFunction(i.catch)&&(s=i,i=new e.Deferred,s.then(function(e){i.resolve(e)},function(e){i.reject(e)})),e.isFunction(i.promise))a.nodeSetStatus(n,"loading"),i.done(function(e){a.nodeSetStatus(n,"ok"),l._requestId=null}).fail(function(e){var t;e!==x?(e.node&&e.error&&e.message?t=e:"[object Object]"===(t=a._makeHookContext(l,null,{error:e,args:Array.prototype.slice.call(arguments),message:e?e.message||e.toString():""})).message&&(t.message=""),l.warn("Load children failed ("+t.message+")",t),!1!==a._triggerNodeEvent("loadError",t,null)&&a.nodeSetStatus(n,"error",t.message,t.details)):l.warn("Ignored response for obsolete load request #"+d+" (expected #"+l._requestId+")")});else if(n.options.postProcess){var c=a._triggerNodeEvent("postProcess",n,n.originalEvent,{response:i,error:null,dataType:typeof i});(e.isArray(c)||e.isPlainObject(c)&&e.isArray(c.children))&&(i=c)}return e.when(i).done(function(i){var r,o;e.isPlainObject(i)&&(t(l.isRootNode(),"source may only be an object for root nodes (expecting an array of child objects otherwise)"),t(e.isArray(i.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),r=i,i=i.children,delete r.children,e.each(T,function(e,t){void 0!==r[t]&&(a[t]=r[t],delete r[t])}),e.extend(a.data,r)),t(e.isArray(i),"expected array of children"),l._setChildren(i),a.options.nodata&&0===i.length&&(e.isFunction(a.options.nodata)?o=a.options.nodata.call(a,{type:"nodata"},n):!0===a.options.nodata&&l.isRootNode()?o=a.options.strings.nodata:"string"==typeof a.options.nodata&&l.isRootNode()&&(o=a.options.nodata),o&&l.setStatus("nodata",o)),a._triggerNodeEvent("loadChildren",l)})},nodeLoadKeyPath:function(e,t){},nodeRemoveChild:function(n,i){var r,o=n.node,s=e.extend({},n,{node:i}),a=o.children;if(1===a.length)return t(i===a[0],"invalid single child"),this.nodeRemoveChildren(n);this.activeNode&&(i===this.activeNode||this.activeNode.isDescendantOf(i))&&this.activeNode.setActive(!1),this.focusNode&&(i===this.focusNode||this.focusNode.isDescendantOf(i))&&(this.focusNode=null),this.nodeRemoveMarkup(s),this.nodeRemoveChildren(s),t((r=e.inArray(i,a))>=0,"invalid child"),o.triggerModifyChild("remove",i),i.visit(function(e){e.parent=null},!0),this._callHook("treeRegisterNode",this,!1,i),a.splice(r,1)},nodeRemoveChildMarkup:function(t){var n=t.node;n.ul&&(n.isRootNode()?e(n.ul).empty():(e(n.ul).remove(),n.ul=null),n.visit(function(e){e.li=e.ul=null}))},nodeRemoveChildren:function(t){var n=t.tree,i=t.node;i.children&&(this.activeNode&&this.activeNode.isDescendantOf(i)&&this.activeNode.setActive(!1),this.focusNode&&this.focusNode.isDescendantOf(i)&&(this.focusNode=null),this.nodeRemoveChildMarkup(t),e.extend({},t),i.triggerModifyChild("remove",null),i.visit(function(e){e.parent=null,n._callHook("treeRegisterNode",n,!1,e)}),i.lazy?i.children=[]:i.children=null,i.isRootNode()||(i.expanded=!1),this.nodeRenderStatus(t))},nodeRemoveMarkup:function(t){var n=t.node;n.li&&(e(n.li).remove(),n.li=null),this.nodeRemoveChildMarkup(t)},nodeRender:function(n,i,r,o,s){var a,l,d,c,u,h,f,p=n.node,g=n.tree,v=n.options,y=v.aria,b=!1,m=p.parent,x=!m,k=p.children,N=null;if(!1!==g._enableUpdate&&(x||m.ul)){if(t(x||m.ul,"parent UL must exist"),x||(p.li&&(i||p.li.parentNode!==p.parent.ul)&&(p.li.parentNode===p.parent.ul?N=p.li.nextSibling:this.debug("Unlinking "+p+" (must be child of "+p.parent+")"),this.nodeRemoveMarkup(n)),p.li?this.nodeRenderStatus(n):(b=!0,p.li=document.createElement("li"),p.li.ftnode=p,p.key&&v.generateIds&&(p.li.id=v.idPrefix+p.key),p.span=document.createElement("span"),p.span.className="fancytree-node",y&&!p.tr&&e(p.li).attr("role","treeitem"),p.li.appendChild(p.span),this.nodeRenderTitle(n),v.createNode&&v.createNode.call(g,{type:"createNode"},n)),v.renderNode&&v.renderNode.call(g,{type:"renderNode"},n)),k){if(x||p.expanded||!0===r){for(p.ul||(p.ul=document.createElement("ul"),(!0!==o||s)&&p.expanded||(p.ul.style.display="none"),y&&e(p.ul).attr("role","group"),p.li?p.li.appendChild(p.ul):p.tree.$div.append(p.ul)),c=0,u=k.length;c<u;c++)f=e.extend({},n,{node:k[c]}),this.nodeRender(f,i,r,!1,!0);for(a=p.ul.firstChild;a;)(d=a.ftnode)&&d.parent!==p?(p.debug("_fixParent: remove missing "+d,a),h=a.nextSibling,a.parentNode.removeChild(a),a=h):a=a.nextSibling;for(a=p.ul.firstChild,c=0,u=k.length-1;c<u;c++)(l=k[c])!==(d=a.ftnode)?p.ul.insertBefore(l.li,d.li):a=a.nextSibling}}else p.ul&&(this.warn("remove child markup for "+p),this.nodeRemoveChildMarkup(n));x||b&&m.ul.insertBefore(p.li,N)}},nodeRenderTitle:function(t,n){var i,r,o,s,a,l,d,u=t.node,h=t.tree,f=t.options,p=f.aria,g=u.getLevel(),b=[];void 0!==n&&(u.title=n),u.span&&!1!==h._enableUpdate&&(a=p&&!1!==u.hasChildren()?" role='button'":"",g<f.minExpandLevel?(u.lazy||(u.expanded=!0),g>1&&b.push("<span "+a+" class='fancytree-expander fancytree-expander-fixed'></span>")):b.push("<span "+a+" class='fancytree-expander'></span>"),(i=v.evalOption("checkbox",u,u,f,!1))&&!u.isStatusNode()&&(a=p?" role='checkbox'":"",r="fancytree-checkbox",("radio"===i||u.parent&&u.parent.radiogroup)&&(r+=" fancytree-radio"),b.push("<span "+a+" class='"+r+"'></span>")),void 0!==u.data.iconClass&&(u.icon?e.error("'iconClass' node option is deprecated since v2.14.0: use 'icon' only instead"):(u.warn("'iconClass' node option is deprecated since v2.14.0: use 'icon' instead"),u.icon=u.data.iconClass)),!1!==(o=v.evalOption("icon",u,u,f,!0))&&(a=p?" role='presentation'":"",d=(d=v.evalOption("iconTooltip",u,u,f,null))?" title='"+c(d)+"'":"","string"==typeof o?y.test(o)?(o="/"===o.charAt(0)?o:(f.imagePath||"")+o,b.push("<img src='"+o+"' class='fancytree-icon'"+d+" alt='' />")):b.push("<span "+a+" class='fancytree-custom-icon "+o+"'"+d+"></span>"):o.text?b.push("<span "+a+" class='fancytree-custom-icon "+(o.addClass||"")+"'"+d+">"+v.escapeHtml(o.text)+"</span>"):o.html?b.push("<span "+a+" class='fancytree-custom-icon "+(o.addClass||"")+"'"+d+">"+o.html+"</span>"):b.push("<span "+a+" class='fancytree-icon'"+d+"></span>")),s="",f.renderTitle&&(s=f.renderTitle.call(h,{type:"renderTitle"},t)||""),s||(!0===(l=v.evalOption("tooltip",u,u,f,null))&&(l=u.title),s="<span class='fancytree-title'"+(l=l?" title='"+c(l)+"'":"")+(f.titlesTabbable?" tabindex='0'":"")+">"+(f.escapeTitles?v.escapeHtml(u.title):u.title)+"</span>"),b.push(s),u.span.innerHTML=b.join(""),this.nodeRenderStatus(t),f.enhanceTitle&&(t.$title=e(">span.fancytree-title",u.span),s=f.enhanceTitle.call(h,{type:"enhanceTitle"},t)||""))},nodeRenderStatus:function(t){var n,i=t.node,r=t.tree,o=t.options,s=i.hasChildren(),a=i.isLastSibling(),l=o.aria,d=o._classNames,c=[],u=i[r.statusClassPropName];u&&!1!==r._enableUpdate&&(l&&(n=e(i.tr||i.li)),c.push(d.node),r.activeNode===i&&c.push(d.active),r.focusNode===i&&c.push(d.focused),i.expanded&&c.push(d.expanded),l&&(!1!==s?n.attr("aria-expanded",Boolean(i.expanded)):n.removeAttr("aria-expanded")),i.folder&&c.push(d.folder),!1!==s&&c.push(d.hasChildren),a&&c.push(d.lastsib),i.lazy&&null==i.children&&c.push(d.lazy),i.partload&&c.push(d.partload),i.partsel&&c.push(d.partsel),v.evalOption("unselectable",i,i,o,!1)&&c.push(d.unselectable),i._isLoading&&c.push(d.loading),i._error&&c.push(d.error),i.statusNodeType&&c.push(d.statusNodePrefix+i.statusNodeType),i.selected?(c.push(d.selected),l&&n.attr("aria-selected",!0)):l&&n.attr("aria-selected",!1),i.extraClasses&&c.push(i.extraClasses),!1===s?c.push(d.combinedExpanderPrefix+"n"+(a?"l":"")):c.push(d.combinedExpanderPrefix+(i.expanded?"e":"c")+(i.lazy&&null==i.children?"d":"")+(a?"l":"")),c.push(d.combinedIconPrefix+(i.expanded?"e":"c")+(i.folder?"f":"")),u.className=c.join(" "),i.li&&e(i.li).toggleClass(d.lastsib,a))},nodeSetActive:function(n,i,r){r=r||{};var o,l=n.node,d=n.tree,c=n.options,u=!0===r.noEvents,h=!0===r.noFocus,f=!1!==r.scrollIntoView;return i=!1!==i,l===d.activeNode===i?s(l):i&&!u&&!1===this._triggerNodeEvent("beforeActivate",l,n.originalEvent)?a(l,["rejected"]):(i?(d.activeNode&&(t(d.activeNode!==l,"node was active (inconsistency)"),o=e.extend({},n,{node:d.activeNode}),d.nodeSetActive(o,!1),t(null===d.activeNode,"deactivate was out of sync?")),c.activeVisible&&l.makeVisible({scrollIntoView:f}),d.activeNode=l,d.nodeRenderStatus(n),h||d.nodeSetFocus(n),u||d._triggerNodeEvent("activate",l,n.originalEvent)):(t(d.activeNode===l,"node was not active (inconsistency)"),d.activeNode=null,this.nodeRenderStatus(n),u||n.tree._triggerNodeEvent("deactivate",l,n.originalEvent)),s(l))},nodeSetExpanded:function(t,n,i){i=i||{};var r,o,l,d,c,u,h=t.node,f=t.tree,p=t.options,g=!0===i.noAnimation,v=!0===i.noEvents;if(n=!1!==n,h.expanded&&n||!h.expanded&&!n)return s(h);if(n&&!h.lazy&&!h.hasChildren())return s(h);if(!n&&h.getLevel()<p.minExpandLevel)return a(h,["locked"]);if(!v&&!1===this._triggerNodeEvent("beforeExpand",h,t.originalEvent))return a(h,["rejected"]);if(g||h.isVisible()||(g=i.noAnimation=!0),o=new e.Deferred,n&&!h.expanded&&p.autoCollapse){c=h.getParentList(!1,!0),u=p.autoCollapse;try{for(p.autoCollapse=!1,l=0,d=c.length;l<d;l++)this._callHook("nodeCollapseSiblings",c[l],i)}finally{p.autoCollapse=u}}return o.done(function(){var e=h.getLastChild();n&&p.autoScroll&&!g&&e?e.scrollIntoView(!0,{topNode:h}).always(function(){v||t.tree._triggerNodeEvent(n?"expand":"collapse",t)}):v||t.tree._triggerNodeEvent(n?"expand":"collapse",t)}),r=function(i){var r,o,s=p._classNames,a=p.toggleEffect;if(h.expanded=n,f._callHook("nodeRender",t,!1,!1,!0),h.ul)if(r="none"!==h.ul.style.display,o=!!h.expanded,r===o)h.warn("nodeSetExpanded: UL.style.display already set");else{if(a&&!g)return e(h.li).addClass(s.animating),void(e.isFunction(e(h.ul)[a.effect])?(f.debug("use jquery."+a.effect+" method"),e(h.ul)[a.effect]({duration:a.duration,always:function(){e(this).removeClass(s.animating),e(h.li).removeClass(s.animating),i()}})):(e(h.ul).stop(!0,!0),e(h.ul).parent().find(".ui-effects-placeholder").remove(),e(h.ul).toggle(a.effect,a.options,a.duration,function(){e(this).removeClass(s.animating),e(h.li).removeClass(s.animating),i()})));h.ul.style.display=h.expanded||!parent?"":"none"}i()},n&&h.lazy&&void 0===h.hasChildren()?h.load().done(function(){o.notifyWith&&o.notifyWith(h,["loaded"]),r(function(){o.resolveWith(h)})}).fail(function(e){r(function(){o.rejectWith(h,["load failed ("+e+")"])})}):r(function(){o.resolveWith(h)}),o.promise()},nodeSetFocus:function(t,n){var i,r=t.tree,o=t.node,s=r.options,a=!!t.originalEvent&&e(t.originalEvent.target).is(":input");if(n=!1!==n,r.focusNode){if(r.focusNode===o&&n)return;i=e.extend({},t,{node:r.focusNode}),r.focusNode=null,this._triggerNodeEvent("blur",i),this._callHook("nodeRenderStatus",i)}n&&(this.hasFocus()||(o.debug("nodeSetFocus: forcing container focus"),this._callHook("treeSetFocus",t,!0,{calledByNode:!0})),o.makeVisible({scrollIntoView:!1}),r.focusNode=o,s.titlesTabbable?a||e(o.span).find(".fancytree-title").focus():0===e(document.activeElement).closest(".fancytree-container").length&&e(r.$container).focus(),s.aria&&e(r.$container).attr("aria-activedescendant",e(o.tr||o.li).uniqueId().attr("id")),this._triggerNodeEvent("focus",t),s.autoScroll&&o.scrollIntoView(),this._callHook("nodeRenderStatus",t))},nodeSetSelected:function(e,t,n){n=n||{};var i=e.node,r=e.tree,o=e.options,s=!0===n.noEvents,a=i.parent;if(t=!1!==t,!v.evalOption("unselectable",i,i,o,!1)){if(i._lastSelectIntent=t,!!i.selected===t&&(3!==o.selectMode||!i.partsel||t))return t;if(!s&&!1===this._triggerNodeEvent("beforeSelect",i,e.originalEvent))return!!i.selected;t&&1===o.selectMode?(r.lastSelectedNode&&r.lastSelectedNode.setSelected(!1),i.selected=t):3!==o.selectMode||!a||a.radiogroup||i.radiogroup?a&&a.radiogroup?i.visitSiblings(function(e){e._changeSelectStatusAttrs(t&&e===i)},!0):i.selected=t:(i.selected=t,i.fixSelection3AfterClick(n)),this.nodeRenderStatus(e),r.lastSelectedNode=t?i:null,s||r._triggerNodeEvent("select",e)}},nodeSetStatus:function(t,n,i,r){function o(t,n){var i=s.children?s.children[0]:null;return i&&i.isStatusNode()?(e.extend(i,t),i.statusNodeType=n,a._callHook("nodeRenderTitle",i)):(s._setChildren([t]),s.children[0].statusNodeType=n,a.render()),s.children[0]}var s=t.node,a=t.tree;switch(n){case"ok":!function(){var e=s.children?s.children[0]:null;if(e&&e.isStatusNode()){try{s.ul&&(s.ul.removeChild(e.li),e.li=null)}catch(e){}1===s.children.length?s.children=[]:s.children.shift()}}(),s._isLoading=!1,s._error=null,s.renderStatus();break;case"loading":s.parent||o({title:a.options.strings.loading+(i?" ("+i+")":""),checkbox:!1,tooltip:r},n),s._isLoading=!0,s._error=null,s.renderStatus();break;case"error":o({title:a.options.strings.loadError+(i?" ("+i+")":""),checkbox:!1,tooltip:r},n),s._isLoading=!1,s._error={message:i,details:r},s.renderStatus();break;case"nodata":o({title:i||a.options.strings.noData,checkbox:!1,tooltip:r},n),s._isLoading=!1,s._error=null,s.renderStatus();break;default:e.error("invalid node status "+n)}},nodeToggleExpanded:function(e){return this.nodeSetExpanded(e,!e.node.expanded)},nodeToggleSelected:function(e){var t=e.node,n=!t.selected;return t.partsel&&!t.selected&&!0===t._lastSelectIntent&&(n=!1,t.selected=!0),t._lastSelectIntent=n,this.nodeSetSelected(e,n)},treeClear:function(e){var t=e.tree;t.activeNode=null,t.focusNode=null,t.$div.find(">ul.fancytree-container").empty(),t.rootNode.children=null},treeCreate:function(e){},treeDestroy:function(e){this.$div.find(">ul.fancytree-container").remove(),this.$source&&this.$source.removeClass("fancytree-helper-hidden")},treeInit:function(t){var n=t.tree,i=n.options;n.$container.attr("tabindex",i.tabindex),e.each(T,function(e,t){void 0!==i[t]&&(n.info("Move option "+t+" to tree"),n[t]=i[t],delete i[t])}),i.rtl?n.$container.attr("DIR","RTL").addClass("fancytree-rtl"):n.$container.removeAttr("DIR").removeClass("fancytree-rtl"),i.aria&&(n.$container.attr("role","tree"),1!==i.selectMode&&n.$container.attr("aria-multiselectable",!0)),this.treeLoad(t)},treeLoad:function(n,i){var r,o,s,a=n.tree,l=n.widget.element,c=e.extend({},n,{node:this.rootNode});if(a.rootNode.children&&this.treeClear(n),i=i||this.options.source)"string"==typeof i&&e.error("Not implemented");else switch(o=l.data("type")||"html"){case"html":(s=l.find(">ul:first")).addClass("ui-fancytree-source fancytree-helper-hidden"),i=e.ui.fancytree.parseHtml(s),this.data=e.extend(this.data,d(s));break;case"json":i=e.parseJSON(l.text()),l.contents().filter(function(){return 3===this.nodeType}).remove(),e.isPlainObject(i)&&(t(e.isArray(i.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),r=i,i=i.children,delete r.children,e.each(T,function(e,t){void 0!==r[t]&&(a[t]=r[t],delete r[t])}),e.extend(a.data,r));break;default:e.error("Invalid data-type: "+o)}return this.nodeLoadChildren(c,i).done(function(){a.render(),3===n.options.selectMode&&a.rootNode.fixSelection3FromEndNodes(),a.activeNode&&a.options.activeVisible&&a.activeNode.makeVisible(),a._triggerTreeEvent("init",null,{status:!0})}).fail(function(){a.render(),a._triggerTreeEvent("init",null,{status:!1})})},treeRegisterNode:function(e,t,n){},treeSetFocus:function(t,n,i){var r;(n=!1!==n)!==this.hasFocus()&&(this._hasFocus=n,!n&&this.focusNode?this.focusNode.setFocus(!1):!n||i&&i.calledByNode||e(this.$container).focus(),this.$container.toggleClass("fancytree-treefocus",n),this._triggerTreeEvent(n?"focusTree":"blurTree"),n&&!this.activeNode&&(r=this._lastMousedownNode||this.getFirstChild())&&r.setFocus())},treeSetOption:function(t,n,i){var r=t.tree,o=!0,s=!1,a=!1;switch(n){case"aria":case"checkbox":case"icon":case"minExpandLevel":case"tabindex":s=!0,a=!0;break;case"escapeTitles":case"tooltip":a=!0;break;case"rtl":!1===i?r.$container.removeAttr("DIR").removeClass("fancytree-rtl"):r.$container.attr("DIR","RTL").addClass("fancytree-rtl"),a=!0;break;case"source":o=!1,r._callHook("treeLoad",r,i),a=!0}r.debug("set option "+n+"="+i+" <"+typeof i+">"),o&&(this.widget._super?this.widget._super.call(this.widget,n,i):e.Widget.prototype._setOption.call(this.widget,n,i)),s&&r._callHook("treeCreate",r),a&&r.render(!0,!1)}}),e.widget("ui.fancytree",{options:{activeVisible:!0,ajax:{type:"GET",cache:!1,dataType:"json"},aria:!0,autoActivate:!0,autoCollapse:!1,autoScroll:!1,checkbox:!1,clickFolderMode:4,debugLevel:null,disabled:!1,enableAspx:!0,escapeTitles:!1,extensions:[],toggleEffect:{effect:"slideToggle",duration:200},generateIds:!1,icon:!0,idPrefix:"ft_",focusOnSelect:!1,keyboard:!0,keyPathSeparator:"/",minExpandLevel:1,nodata:!0,quicksearch:!1,rtl:!1,scrollOfs:{top:0,bottom:0},scrollParent:null,selectMode:2,strings:{loading:"Loading...",loadError:"Load error!",moreData:"More...",noData:"No data."},tabindex:"0",titlesTabbable:!1,tooltip:!1,_classNames:{node:"fancytree-node",folder:"fancytree-folder",animating:"fancytree-animating",combinedExpanderPrefix:"fancytree-exp-",combinedIconPrefix:"fancytree-ico-",hasChildren:"fancytree-has-children",active:"fancytree-active",selected:"fancytree-selected",expanded:"fancytree-expanded",lazy:"fancytree-lazy",focused:"fancytree-focused",partload:"fancytree-partload",partsel:"fancytree-partsel",radio:"fancytree-radio",unselectable:"fancytree-unselectable",lastsib:"fancytree-lastsib",loading:"fancytree-loading",error:"fancytree-error",statusNodePrefix:"fancytree-statusnode-"},lazyLoad:null,postProcess:null},_create:function(){this.tree=new f(this),this.$source=this.source||"json"===this.element.data("type")?this.element:this.element.find(">ul:first");var n,r,s,a=this.options,l=a.extensions;this.tree;for(s=0;s<l.length;s++)r=l[s],(n=e.ui.fancytree._extensions[r])||e.error("Could not apply extension '"+r+"' (it is not registered, did you forget to include it?)"),this.tree.options[r]=i({},n.options,this.tree.options[r]),t(void 0===this.tree.ext[r],"Extension name must not exist as Fancytree.ext attribute: '"+r+"'"),this.tree.ext[r]={},o(this.tree,0,n,r),n;void 0!==a.icons&&(!0!==a.icon?e.error("'icons' tree option is deprecated since v2.14.0: use 'icon' only instead"):(this.tree.warn("'icons' tree option is deprecated since v2.14.0: use 'icon' instead"),a.icon=a.icons)),void 0!==a.iconClass&&(a.icon?e.error("'iconClass' tree option is deprecated since v2.14.0: use 'icon' only instead"):(this.tree.warn("'iconClass' tree option is deprecated since v2.14.0: use 'icon' instead"),a.icon=a.iconClass)),void 0!==a.tabbable&&(a.tabindex=a.tabbable?"0":"-1",this.tree.warn("'tabbable' tree option is deprecated since v2.17.0: use 'tabindex='"+a.tabindex+"' instead")),this.tree._callHook("treeCreate",this.tree)},_init:function(){this.tree._callHook("treeInit",this.tree),this._bind()},_setOption:function(e,t){return this.tree._callHook("treeSetOption",this.tree,e,t)},destroy:function(){this._unbind(),this.tree._callHook("treeDestroy",this.tree),e.Widget.prototype.destroy.call(this)},_unbind:function(){var t=this.tree._ns;this.element.off(t),this.tree.$container.off(t),e(document).off(t)},_bind:function(){var t=this,n=this.options,i=this.tree,r=i._ns;this._unbind(),i.$container.on("focusin"+r+" focusout"+r,function(t){var n=v.getNode(t),r="focusin"===t.type;if(!r&&n&&e(t.target).is("a"))n.debug("Ignored focusout on embedded <a> element.");else{if(r){if(i._getExpiringValue("focusin"))return void i.debug("Ignored double focusin.");i._setExpiringValue("focusin",!0,50),n||(n=i._getExpiringValue("mouseDownNode"))&&i.debug("Reconstruct mouse target for focusin from recent event.")}n?i._callHook("nodeSetFocus",i._makeHookContext(n,t),r):i.tbody&&e(t.target).parents("table.fancytree-container > thead").length?i.debug("Ignore focus event outside table body.",t):i._callHook("treeSetFocus",i,r)}}).on("selectstart"+r,"span.fancytree-title",function(e){e.preventDefault()}).on("keydown"+r,function(e){if(n.disabled||!1===n.keyboard)return!0;var t,r=i.focusNode,o=i._makeHookContext(r||i,e),s=i.phase;try{return i.phase="userEvent","preventNav"===(t=r?i._triggerNodeEvent("keydown",r,e):i._triggerTreeEvent("keydown",e))?t=!0:!1!==t&&(t=i._callHook("nodeKeydown",o)),t}finally{i.phase=s}}).on("mousedown"+r,function(e){var t=v.getEventTarget(e);i._lastMousedownNode=t?t.node:null,i._setExpiringValue("mouseDownNode",i._lastMousedownNode)}).on("click"+r+" dblclick"+r,function(e){if(n.disabled)return!0;var i,r=v.getEventTarget(e),o=r.node,s=t.tree,a=s.phase;if(!o)return!0;i=s._makeHookContext(o,e);try{switch(s.phase="userEvent",e.type){case"click":return i.targetType=r.type,o.isPagingNode()?!0===s._triggerNodeEvent("clickPaging",i,e):!1!==s._triggerNodeEvent("click",i,e)&&s._callHook("nodeClick",i);case"dblclick":return i.targetType=r.type,!1!==s._triggerNodeEvent("dblclick",i,e)&&s._callHook("nodeDblclick",i)}}finally{s.phase=a}})},getActiveNode:function(){return this.tree.activeNode},getNodeByKey:function(e){return this.tree.getNodeByKey(e)},getRootNode:function(){return this.tree.rootNode},getTree:function(){return this.tree}}),v=e.ui.fancytree,e.extend(e.ui.fancytree,{version:"2.30.2",buildType: "production",debugLevel: 3,_nextId:1,_nextNodeKey:1,_extensions:{},_FancytreeClass:f,_FancytreeNodeClass:h,jquerySupports:{positionMyOfs:function(t,n,i,r){var o,s,a,l=e.map(e.trim(t).split("."),function(e){return parseInt(e,10)}),d=e.map(Array.prototype.slice.call(arguments,1),function(e){return parseInt(e,10)});for(o=0;o<d.length;o++)if(s=l[o]||0,a=d[o]||0,s!==a)return s>a;return!0}(e.ui.version,1,9)},assert:function(e,n){return t(e,n)},createTree:function(t,n){return e(t).fancytree(n).fancytree("getTree")},debounce:function(e,t,n,i){var r;return 3===arguments.length&&"boolean"!=typeof n&&(i=n,n=!1),function(){var o=arguments;i=i||this,n&&!r&&t.apply(i,o),clearTimeout(r),r=setTimeout(function(){n||t.apply(i,o),r=null},e)}},debug:function(t){e.ui.fancytree.debugLevel>=4&&n("log",arguments)},error:function(t){e.ui.fancytree.debugLevel>=1&&n("error",arguments)},escapeHtml:function(e){return(""+e).replace(b,function(e){return k[e]})},fixPositionOptions:function(t){if((t.offset||(""+t.my+t.at).indexOf("%")>=0)&&e.error("expected new position syntax (but '%' is not supported)"),!e.ui.fancytree.jquerySupports.positionMyOfs){var n=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(t.my),i=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(t.at),r=(n[2]?+n[2]:0)+(i[2]?+i[2]:0),o=(n[4]?+n[4]:0)+(i[4]?+i[4]:0);t=e.extend({},t,{my:n[1]+" "+n[3],at:i[1]+" "+i[3]}),(r||o)&&(t.offset=r+" "+o)}return t},getEventTarget:function(t){var n,i=t&&t.target?t.target.className:"",r={node:this.getNode(t.target),type:void 0};return/\bfancytree-title\b/.test(i)?r.type="title":/\bfancytree-expander\b/.test(i)?r.type=!1===r.node.hasChildren()?"prefix":"expander":/\bfancytree-checkbox\b/.test(i)?r.type="checkbox":/\bfancytree(-custom)?-icon\b/.test(i)?r.type="icon":/\bfancytree-node\b/.test(i)?r.type="title":t&&t.target&&((n=e(t.target)).is("ul[role=group]")?((r.node&&r.node.tree||v).debug("Ignoring click on outer UL."),r.node=null):n.closest(".fancytree-title").length?r.type="title":n.closest(".fancytree-checkbox").length?r.type="checkbox":n.closest(".fancytree-expander").length&&(r.type="expander")),r},getEventTargetType:function(e){return this.getEventTarget(e).type},getNode:function(t){if(t instanceof h)return t;for(t instanceof e?t=t[0]:void 0!==t.originalEvent&&(t=t.target);t;){if(t.ftnode)return t.ftnode;t=t.parentNode}return null},getTree:function(t){var n;return t instanceof f?t:(void 0===t&&(t=0),"number"==typeof t?t=e(".fancytree-container").eq(t):"string"==typeof t?t=e(t).eq(0):t instanceof e?t=t.eq(0):void 0!==t.originalEvent&&(t=e(t.target)),t=t.closest(":ui-fancytree"),(n=t.data("ui-fancytree")||t.data("fancytree"))?n.tree:null)},evalOption:function(t,n,i,r,o){var s,a,l=n.tree,d=r[t],c=i[t];return e.isFunction(d)?(s={node:n,tree:l,widget:l.widget,options:l.widget.options,typeInfo:l.types[n.type]||{}},null==(a=d.call(l,{type:t},s))&&(a=c)):a=null!=c?c:d,null==a&&(a=o),a},setSpanIcon:function(t,n,i){var r=e(t);"string"==typeof i?r.attr("class",n+" "+i):(i.text?r.text(""+i.text):i.html&&(t.innerHTML=i.html),r.attr("class",n+" "+(i.addClass||"")))},eventToString:function(e){var t=e.which,n=e.type,i=[];return e.altKey&&i.push("alt"),e.ctrlKey&&i.push("ctrl"),e.metaKey&&i.push("meta"),e.shiftKey&&i.push("shift"),"click"===n||"dblclick"===n?i.push(w[e.button]+n):N[t]||i.push(_[t]||String.fromCharCode(t).toLowerCase()),i.join("+")},info:function(t){e.ui.fancytree.debugLevel>=3&&n("info",arguments)},keyEventToString:function(e){return this.warn("keyEventToString() is deprecated: use eventToString()"),this.eventToString(e)},overrideMethod:function(t,n,i,r){var o,s=t[n]||e.noop;t[n]=function(){var e=r||this;try{return o=e._super,e._super=s,i.apply(e,arguments)}finally{e._super=o}}},parseHtml:function(t){var n,i,r,o,s,a,l,c,u=[];return t.find(">li").each(function(){var h,f,p=e(this),g=p.find(">span:first",this),v=g.length?null:p.find(">a:first"),y={tooltip:null,data:{}};for(g.length?y.title=g.html():v&&v.length?(y.title=v.html(),y.data.href=v.attr("href"),y.data.target=v.attr("target"),y.tooltip=v.attr("title")):(y.title=p.html(),(s=y.title.search(/<ul/i))>=0&&(y.title=y.title.substring(0,s))),y.title=e.trim(y.title),o=0,a=S.length;o<a;o++)y[S[o]]=void 0;for(n=this.className.split(" "),r=[],o=0,a=n.length;o<a;o++)i=n[o],E[i]?y[i]=!0:r.push(i);if(y.extraClasses=r.join(" "),(l=p.attr("title"))&&(y.tooltip=l),(l=p.attr("id"))&&(y.key=l),p.attr("hideCheckbox")&&(y.checkbox=!1),(h=d(p))&&!e.isEmptyObject(h)){for(f in P)h.hasOwnProperty(f)&&(h[P[f]]=h[f],delete h[f]);for(o=0,a=L.length;o<a;o++)l=L[o],null!=(c=h[l])&&(delete h[l],y[l]=c);e.extend(y.data,h)}(t=p.find(">ul:first")).length?y.children=e.ui.fancytree.parseHtml(t):y.children=y.lazy?void 0:null,u.push(y)}),u},registerExtension:function(n){t(null!=n.name,"extensions must have a `name` property."),t(null!=n.version,"extensions must have a `version` property."),e.ui.fancytree._extensions[n.name]=n},unescapeHtml:function(e){var t=document.createElement("div");return t.innerHTML=e,0===t.childNodes.length?"":t.childNodes[0].nodeValue},warn:function(t){e.ui.fancytree.debugLevel>=2&&n("warn",arguments)}}),e.ui.fancytree}e.ui.fancytree.warn("Fancytree: ignored duplicate include")}}); | ||
!function(e){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree.ui-deps"],e):"object"==typeof module&&module.exports?(require("./jquery.fancytree.ui-deps"),module.exports=e(require("jquery"))):e(jQuery)}(function(k){"use strict";if(!k.ui||!k.ui.fancytree){var o,e,g=null,v=new RegExp(/\.|\//),t=/[&<>"'/]/g,n=/[<>"'/]/g,c="$recursive_request",i={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},r={16:!0,17:!0,18:!0},y={8:"backspace",9:"tab",10:"return",13:"return",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},b={16:"shift",17:"ctrl",18:"alt",91:"meta",93:"meta"},s={0:"",1:"left",2:"middle",3:"right"},m="active expanded focus folder lazy radiogroup selected unselectable unselectableIgnore".split(" "),x={},u="columns types".split(" "),N="checkbox expanded extraClasses folder icon iconTooltip key lazy partsel radiogroup refKey selected statusNodeType title tooltip type unselectable unselectableIgnore unselectableStatus".split(" "),a={},_={},l={active:!0,children:!0,data:!0,focus:!0};for(o=0;o<m.length;o++)x[m[o]]=!0;for(o=0;o<N.length;o++)e=N[o],a[e]=!0,e!==e.toLowerCase()&&(_[e.toLowerCase()]=e);return C(k.ui,"Fancytree requires jQuery UI (http://jqueryui.com)"),Date.now||(Date.now=function(){return(new Date).getTime()}),A.prototype={_findDirectChild:function(e){var t,n,i=this.children;if(i)if("string"==typeof e){for(t=0,n=i.length;t<n;t++)if(i[t].key===e)return i[t]}else{if("number"==typeof e)return this.children[e];if(e.parent===this)return e}return null},_setChildren:function(e){C(e&&(!this.children||0===this.children.length),"only init supported"),this.children=[];for(var t=0,n=e.length;t<n;t++)this.children.push(new A(this,e[t]));this.tree._callHook("treeStructureChanged",this.tree,"setChildren")},addChildren:function(e,t){var n,i,r,o,s=this.getFirstChild(),a=this.getLastChild(),l=[];for(k.isPlainObject(e)&&(e=[e]),this.children||(this.children=[]),n=0,i=e.length;n<i;n++)l.push(new A(this,e[n]));if(o=l[0],null==t?this.children=this.children.concat(l):(t=this._findDirectChild(t),C(0<=(r=k.inArray(t,this.children)),"insertBefore must be an existing child"),this.children.splice.apply(this.children,[r,0].concat(l))),s&&!t){for(n=0,i=l.length;n<i;n++)l[n].render();s!==this.getFirstChild()&&s.renderStatus(),a!==this.getLastChild()&&a.renderStatus()}else(!this.parent||this.parent.ul||this.tr)&&this.render();return 3===this.tree.options.selectMode&&this.fixSelection3FromEndNodes(),this.triggerModifyChild("add",1===l.length?l[0]:null),o},addClass:function(e){return this.toggleClass(e,!0)},addNode:function(e,t){switch(void 0!==t&&"over"!==t||(t="child"),t){case"after":return this.getParent().addChildren(e,this.getNextSibling());case"before":return this.getParent().addChildren(e,this);case"firstChild":var n=this.children?this.children[0]:null;return this.addChildren(e,n);case"child":case"over":return this.addChildren(e)}C(!1,"Invalid mode: "+t)},addPagingNode:function(e,t){var n,i;if(t=t||"child",!1!==e)return e=k.extend({title:this.tree.options.strings.moreData,statusNodeType:"paging",icon:!1},e),this.partload=!0,this.addNode(e,t);for(n=this.children.length-1;0<=n;n--)"paging"===(i=this.children[n]).statusNodeType&&this.removeChild(i);this.partload=!1},appendSibling:function(e){return this.addNode(e,"after")},applyPatch:function(e){if(null===e)return this.remove(),w(this);var t,n,i={children:!0,expanded:!0,parent:!0};for(t in e)e.hasOwnProperty(t)&&(n=e[t],i[t]||k.isFunction(n)||(a[t]?this[t]=n:this.data[t]=n));return e.hasOwnProperty("children")&&(this.removeChildren(),e.children&&this._setChildren(e.children)),this.isVisible()&&(this.renderTitle(),this.renderStatus()),e.hasOwnProperty("expanded")?this.setExpanded(e.expanded):w(this)},collapseSiblings:function(){return this.tree._callHook("nodeCollapseSiblings",this)},copyTo:function(e,t,n){return e.addNode(this.toDict(!0,n),t)},countChildren:function(e){var t,n,i,r=this.children;if(!r)return 0;if(i=r.length,!1!==e)for(t=0,n=i;t<n;t++)i+=r[t].countChildren();return i},debug:function(e){4<=this.tree.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("log",arguments))},discard:function(){return this.warn("FancytreeNode.discard() is deprecated since 2014-02-16. Use .resetLazy() instead."),this.resetLazy()},discardMarkup:function(e){var t=e?"nodeRemoveMarkup":"nodeRemoveChildMarkup";this.tree._callHook(t,this)},error:function(e){1<=this.tree.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("error",arguments))},findAll:function(t){t=k.isFunction(t)?t:H(t);var n=[];return this.visit(function(e){t(e)&&n.push(e)}),n},findFirst:function(t){t=k.isFunction(t)?t:H(t);var n=null;return this.visit(function(e){if(t(e))return n=e,!1}),n},findRelatedNode:function(e,t){return this.tree.findRelatedNode(this,e,t)},_changeSelectStatusAttrs:function(e){var t=!1,n=this.tree.options,i=g.evalOption("unselectable",this,this,n,!1),r=g.evalOption("unselectableStatus",this,this,n,void 0);switch(i&&null!=r&&(e=r),e){case!1:t=this.selected||this.partsel,this.selected=!1,this.partsel=!1;break;case!0:t=!this.selected||!this.partsel,this.selected=!0,this.partsel=!0;break;case void 0:t=this.selected||!this.partsel,this.selected=!1,this.partsel=!0;break;default:C(!1,"invalid state: "+e)}return t&&this.renderStatus(),t},fixSelection3AfterClick:function(e){var t=this.isSelected();this.visit(function(e){if(e._changeSelectStatusAttrs(t),e.radiogroup)return"skip"}),this.fixSelection3FromEndNodes(e)},fixSelection3FromEndNodes:function(e){var u=this.tree.options;C(3===u.selectMode,"expected selectMode 3"),function e(t){var n,i,r,o,s,a,l,d,c=t.children;if(c&&c.length){for(l=!(a=!0),n=0,i=c.length;n<i;n++)o=e(r=c[n]),g.evalOption("unselectableIgnore",r,r,u,!1)||(!1!==o&&(l=!0),!0!==o&&(a=!1));s=!!a||!!l&&void 0}else s=null==(d=g.evalOption("unselectableStatus",t,t,u,void 0))?!!t.selected:!!d;return t.partsel&&!t.selected&&t.lazy&&null==t.children&&(s=void 0),t._changeSelectStatusAttrs(s),s}(this),this.visitParents(function(e){var t,n,i,r,o,s=e.children,a=!0,l=!1;for(t=0,n=s.length;t<n;t++)i=s[t],g.evalOption("unselectableIgnore",i,i,u,!1)||(((r=null==(o=g.evalOption("unselectableStatus",i,i,u,void 0))?!!i.selected:!!o)||i.partsel)&&(l=!0),r||(a=!1));r=!!a||!!l&&void 0,e._changeSelectStatusAttrs(r)})},fromDict:function(e){for(var t in e)a[t]?this[t]=e[t]:"data"===t?k.extend(this.data,e.data):k.isFunction(e[t])||l[t]||(this.data[t]=e[t]);e.children&&(this.removeChildren(),this.addChildren(e.children)),this.renderTitle()},getChildren:function(){if(void 0!==this.hasChildren())return this.children},getFirstChild:function(){return this.children?this.children[0]:null},getIndex:function(){return k.inArray(this,this.parent.children)},getIndexHier:function(e,n){e=e||".";var i,r=[];return k.each(this.getParentList(!1,!0),function(e,t){i=""+(t.getIndex()+1),n&&(i=("0000000"+i).substr(-n)),r.push(i)}),r.join(e)},getKeyPath:function(e){var t=this.tree.options.keyPathSeparator;return t+this.getPath(!e,"key",t)},getLastChild:function(){return this.children?this.children[this.children.length-1]:null},getLevel:function(){for(var e=0,t=this.parent;t;)e++,t=t.parent;return e},getNextSibling:function(){if(this.parent){var e,t,n=this.parent.children;for(e=0,t=n.length-1;e<t;e++)if(n[e]===this)return n[e+1]}return null},getParent:function(){return this.parent},getParentList:function(e,t){for(var n=[],i=t?this:this.parent;i;)(e||i.parent)&&n.unshift(i),i=i.parent;return n},getPath:function(e,t,n){e=!1!==e,t=t||"title",n=n||"/";var i,r=[],o=k.isFunction(t);return this.visitParents(function(e){e.parent&&(i=o?t(e):e[t],r.unshift(i))},e),r.join(n)},getPrevSibling:function(){if(this.parent){var e,t,n=this.parent.children;for(e=1,t=n.length;e<t;e++)if(n[e]===this)return n[e-1]}return null},getSelectedNodes:function(t){var n=[];return this.visit(function(e){if(e.selected&&(n.push(e),!0===t))return"skip"}),n},hasChildren:function(){if(this.lazy){if(null==this.children)return;if(0===this.children.length)return!1;if(1===this.children.length&&this.children[0].isStatusNode())return;return!0}return!(!this.children||!this.children.length)},hasFocus:function(){return this.tree.hasFocus()&&this.tree.focusNode===this},info:function(e){3<=this.tree.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("info",arguments))},isActive:function(){return this.tree.activeNode===this},isBelowOf:function(e){return this.getIndexHier(".",5)>e.getIndexHier(".",5)},isChildOf:function(e){return this.parent&&this.parent===e},isDescendantOf:function(e){if(!e||e.tree!==this.tree)return!1;for(var t=this.parent;t;){if(t===e)return!0;t===t.parent&&k.error("Recursive parent link: "+t),t=t.parent}return!1},isExpanded:function(){return!!this.expanded},isFirstSibling:function(){var e=this.parent;return!e||e.children[0]===this},isFolder:function(){return!!this.folder},isLastSibling:function(){var e=this.parent;return!e||e.children[e.children.length-1]===this},isLazy:function(){return!!this.lazy},isLoaded:function(){return!this.lazy||void 0!==this.hasChildren()},isLoading:function(){return!!this._isLoading},isRoot:function(){return this.isRootNode()},isPartsel:function(){return!this.selected&&!!this.partsel},isPartload:function(){return!!this.partload},isRootNode:function(){return this.tree.rootNode===this},isSelected:function(){return!!this.selected},isStatusNode:function(){return!!this.statusNodeType},isPagingNode:function(){return"paging"===this.statusNodeType},isTopLevel:function(){return this.tree.rootNode===this.parent},isUndefined:function(){return void 0===this.hasChildren()},isVisible:function(){var e,t,n=this.tree.enableFilter,i=this.getParentList(!1,!1);if(n&&!this.match&&!this.subMatchCount)return this.debug("isVisible: HIDDEN ("+n+", "+this.match+", "+this.match+")"),!1;for(e=0,t=i.length;e<t;e++)if(!i[e].expanded)return this.debug("isVisible: HIDDEN (parent collapsed)"),!1;return this.debug("isVisible: VISIBLE"),!0},lazyLoad:function(e){return this.warn("FancytreeNode.lazyLoad() is deprecated since 2014-02-16. Use .load() instead."),this.load(e)},load:function(e){var t,n,i=this,r=this.isExpanded();return C(this.isLazy(),"load() requires a lazy node"),e||this.isUndefined()?(this.isLoaded()&&this.resetLazy(),!1===(n=this.tree._triggerNodeEvent("lazyLoad",this))?w(this):(C("boolean"!=typeof n,"lazyLoad event must return source in data.result"),t=this.tree._callHook("nodeLoadChildren",this,n),r?(this.expanded=!0,t.always(function(){i.render()})):t.always(function(){i.renderStatus()}),t)):w(this)},makeVisible:function(e){var t,n=this,i=[],r=new k.Deferred,o=this.getParentList(!1,!1),s=o.length,a=!(e&&!0===e.noAnimation),l=!(e&&!1===e.scrollIntoView);for(t=s-1;0<=t;t--)i.push(o[t].setExpanded(!0,e));return k.when.apply(k,i).done(function(){l?n.scrollIntoView(a).done(function(){r.resolve()}):r.resolve()}),r.promise()},moveTo:function(t,e,n){void 0===e||"over"===e?e="child":"firstChild"===e&&(t.children&&t.children.length?(e="before",t=t.children[0]):e="child");var i,r=this.tree,o=this.parent,s="child"===e?t:t.parent;if(this!==t){if(this.parent?s.isDescendantOf(this)&&k.error("Cannot move a node to its own descendant"):k.error("Cannot move system root"),s!==o&&o.triggerModifyChild("remove",this),1===this.parent.children.length){if(this.parent===s)return;this.parent.children=this.parent.lazy?[]:null,this.parent.expanded=!1}else C(0<=(i=k.inArray(this,this.parent.children)),"invalid source parent"),this.parent.children.splice(i,1);if((this.parent=s).hasChildren())switch(e){case"child":s.children.push(this);break;case"before":C(0<=(i=k.inArray(t,s.children)),"invalid target parent"),s.children.splice(i,0,this);break;case"after":C(0<=(i=k.inArray(t,s.children)),"invalid target parent"),s.children.splice(i+1,0,this);break;default:k.error("Invalid mode "+e)}else s.children=[this];n&&t.visit(n,!0),s===o?s.triggerModifyChild("move",this):s.triggerModifyChild("add",this),r!==t.tree&&(this.warn("Cross-tree moveTo is experimental!"),this.visit(function(e){e.tree=t.tree},!0)),r._callHook("treeStructureChanged",r,"moveTo"),o.isDescendantOf(s)||o.render(),s.isDescendantOf(o)||s===o||s.render()}},navigate:function(e,t){var n,i=k.ui.keyCode;switch(e){case"left":case i.LEFT:if(this.expanded)return this.setExpanded(!1);break;case"right":case i.RIGHT:if(!this.expanded&&(this.children||this.lazy))return this.setExpanded()}if(n=this.findRelatedNode(e)){try{n.makeVisible({scrollIntoView:!1})}catch(e){}return!1===t?n.setFocus():n.setActive()}return this.warn("Could not find related node '"+e+"'."),w()},remove:function(){return this.parent.removeChild(this)},removeChild:function(e){return this.tree._callHook("nodeRemoveChild",this,e)},removeChildren:function(){return this.tree._callHook("nodeRemoveChildren",this)},removeClass:function(e){return this.toggleClass(e,!1)},render:function(e,t){return this.tree._callHook("nodeRender",this,e,t)},renderTitle:function(){return this.tree._callHook("nodeRenderTitle",this)},renderStatus:function(){return this.tree._callHook("nodeRenderStatus",this)},replaceWith:function(e){var t,n=this.parent,i=k.inArray(this,n.children),r=this;return C(this.isPagingNode(),"replaceWith() currently requires a paging status node"),(t=this.tree._callHook("nodeLoadChildren",this,e)).done(function(e){var t=r.children;for(o=0;o<t.length;o++)t[o].parent=n;n.children.splice.apply(n.children,[i+1,0].concat(t)),r.children=null,r.remove(),n.render()}).fail(function(){r.setExpanded()}),t},resetLazy:function(){this.removeChildren(),this.expanded=!1,this.lazy=!0,this.children=void 0,this.renderStatus()},scheduleAction:function(e,t){this.tree.timer&&(clearTimeout(this.tree.timer),this.tree.debug("clearTimeout(%o)",this.tree.timer)),this.tree.timer=null;var n=this;switch(e){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){n.tree.debug("setTimeout: trigger expand"),n.setExpanded(!0)},t);break;case"activate":this.tree.timer=setTimeout(function(){n.tree.debug("setTimeout: trigger activate"),n.setActive(!0)},t);break;default:k.error("Invalid mode "+e)}},scrollIntoView:function(e,t){if(void 0!==t&&((n=t).tree&&void 0!==n.statusNodeType))throw Error("scrollIntoView() with 'topNode' option is deprecated since 2014-05-08. Use 'options.topNode' instead.");var n,i=k.extend({effects:!0===e?{duration:200,queue:!1}:e,scrollOfs:this.tree.options.scrollOfs,scrollParent:this.tree.options.scrollParent,topNode:null},t),r=i.scrollParent,o=this.tree.$container,s=o.css("overflow-y");r?r.jquery||(r=k(r)):r=this.tree.tbody?o.scrollParent():"scroll"===s||"auto"===s?o:o.scrollParent(),r[0]!==document&&r[0]!==document.body||(this.debug("scrollIntoView(): normalizing scrollParent to 'window':",r[0]),r=k(window));var a,l,d,c=new k.Deferred,u=this,h=k(this.span).height(),f=i.scrollOfs.top||0,p=i.scrollOfs.bottom||0,g=r.height(),v=r.scrollTop(),y=r,b=r[0]===window,m=i.topNode||null,x=null;return this.isVisible()?(b?(l=k(this.span).offset().top,a=m&&m.span?k(m.span).offset().top:0,y=k("html,body")):(C(r[0]!==document&&r[0]!==document.body,"scrollParent should be a simple element or `window`, not document or body."),d=r.offset().top,l=k(this.span).offset().top-d+v,a=m?k(m.span).offset().top-d+v:0,g-=Math.max(0,r.innerHeight()-r[0].clientHeight)),l<v+f?x=l-f:v+g-p<l+h&&(x=l+h-g+p,m&&(C(m.isRootNode()||m.isVisible(),"topNode must be visible"),a<x&&(x=a-f))),null===x?c.resolveWith(this):i.effects?(i.effects.complete=function(){c.resolveWith(u)},y.stop(!0).animate({scrollTop:x},i.effects)):(y[0].scrollTop=x,c.resolveWith(this)),c.promise()):(this.warn("scrollIntoView(): node is invisible."),w())},setActive:function(e,t){return this.tree._callHook("nodeSetActive",this,e,t)},setExpanded:function(e,t){return this.tree._callHook("nodeSetExpanded",this,e,t)},setFocus:function(e){return this.tree._callHook("nodeSetFocus",this,e)},setSelected:function(e,t){return this.tree._callHook("nodeSetSelected",this,e,t)},setStatus:function(e,t,n){return this.tree._callHook("nodeSetStatus",this,e,t,n)},setTitle:function(e){this.title=e,this.renderTitle(),this.triggerModify("rename")},sortChildren:function(e,t){var n,i,r=this.children;if(r){if(e=e||function(e,t){var n=e.title.toLowerCase(),i=t.title.toLowerCase();return n===i?0:i<n?1:-1},r.sort(e),t)for(n=0,i=r.length;n<i;n++)r[n].children&&r[n].sortChildren(e,"$norender$");"$norender$"!==t&&this.render(),this.triggerModifyChild("sort")}},toDict:function(e,t){var n,i,r,o={},s=this;if(k.each(N,function(e,t){(s[t]||!1===s[t])&&(o[t]=s[t])}),k.isEmptyObject(this.data)||(o.data=k.extend({},this.data),k.isEmptyObject(o.data)&&delete o.data),t&&t(o,s),e&&this.hasChildren())for(o.children=[],n=0,i=this.children.length;n<i;n++)(r=this.children[n]).isStatusNode()||o.children.push(r.toDict(!0,t));return o},toggleClass:function(e,t){var n,i,r=e.match(/\S+/g)||[],o=0,s=!1,a=this[this.tree.statusClassPropName],l=" "+(this.extraClasses||"")+" ";for(a&&k(a).toggleClass(e,t);n=r[o++];)if(i=0<=l.indexOf(" "+n+" "),t=void 0===t?!i:!!t)i||(l+=n+" ",s=!0);else for(;-1<l.indexOf(" "+n+" ");)l=l.replace(" "+n+" "," ");return this.extraClasses=k.trim(l),s},toggleExpanded:function(){return this.tree._callHook("nodeToggleExpanded",this)},toggleSelected:function(){return this.tree._callHook("nodeToggleSelected",this)},toString:function(){return"FancytreeNode@"+this.key+"[title='"+this.title+"']"},triggerModifyChild:function(e,t,n){var i,r=this.tree.options.modifyChild;r&&(t&&t.parent!==this&&k.error("childNode "+t+" is not a child of "+this),i={node:this,tree:this.tree,operation:e,childNode:t||null},n&&k.extend(i,n),r({type:"modifyChild"},i))},triggerModify:function(e,t){this.parent.triggerModifyChild(e,this,t)},visit:function(e,t){var n,i,r=!0,o=this.children;if(!0===t&&(!1===(r=e(this))||"skip"===r))return r;if(o)for(n=0,i=o.length;n<i&&!1!==(r=o[n].visit(e,!0));n++);return r},visitAndLoad:function(n,e,t){var i,r,o,s=this;return!n||!0!==e||!1!==(r=n(s))&&"skip"!==r?s.children||s.lazy?(i=new k.Deferred,o=[],s.load().done(function(){for(var e=0,t=s.children.length;e<t;e++){if(!1===(r=s.children[e].visitAndLoad(n,!0,!0))){i.reject();break}"skip"!==r&&o.push(r)}k.when.apply(this,o).then(function(){i.resolve()})}),i.promise()):w():t?r:w()},visitParents:function(e,t){if(t&&!1===e(this))return!1;for(var n=this.parent;n;){if(!1===e(n))return!1;n=n.parent}return!0},visitSiblings:function(e,t){var n,i,r,o=this.parent.children;for(n=0,i=o.length;n<i;n++)if(r=o[n],(t||r!==this)&&!1===e(r))return!1;return!0},warn:function(e){2<=this.tree.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("warn",arguments))}},P.prototype={_makeHookContext:function(e,t,n){var i,r;return void 0!==e.node?(t&&e.originalEvent!==t&&k.error("invalid args"),i=e):e.tree?i={node:e,tree:r=e.tree,widget:r.widget,options:r.widget.options,originalEvent:t,typeInfo:r.types[e.type]||{}}:e.widget?i={node:null,tree:e,widget:e.widget,options:e.widget.options,originalEvent:t}:k.error("invalid args"),n&&k.extend(i,n),i},_callHook:function(e,t,n){var i=this._makeHookContext(t),r=this[e],o=Array.prototype.slice.call(arguments,2);return k.isFunction(r)||k.error("_callHook('"+e+"') is not a function"),o.unshift(i),r.apply(this,o)},_setExpiringValue:function(e,t,n){this._tempCache[e]={value:t,expire:Date.now()+(+n||50)}},_getExpiringValue:function(e){var t=this._tempCache[e];return t&&t.expire>Date.now()?t.value:(delete this._tempCache[e],null)},_requireExtension:function(e,t,n,i){null!=n&&(n=!!n);var r=this._local.name,o=this.options.extensions,s=k.inArray(e,o)<k.inArray(r,o),a=t&&null==this.ext[e],l=!a&&null!=n&&n!==s;return C(r&&r!==e,"invalid or same name '"+r+"' (require yourself?)"),!a&&!l||(i||(a||t?(i="'"+r+"' extension requires '"+e+"'",l&&(i+=" to be registered "+(n?"before":"after")+" itself")):i="If used together, `"+e+"` must be registered "+(n?"before":"after")+" `"+r+"`"),k.error(i),!1)},activateKey:function(e,t){var n=this.getNodeByKey(e);return n?n.setActive(!0,t):this.activeNode&&this.activeNode.setActive(!1,t),n},addPagingNode:function(e,t){return this.rootNode.addPagingNode(e,t)},applyPatch:function(e){var t,n,i,r,o,s,a=e.length,l=[];for(n=0;n<a;n++)C(2===(i=e[n]).length,"patchList must be an array of length-2-arrays"),r=i[0],o=i[1],(s=null===r?this.rootNode:this.getNodeByKey(r))?(t=new k.Deferred,l.push(t),s.applyPatch(o).always(E(t,s))):this.warn("could not find node with key '"+r+"'");return k.when.apply(k,l).promise()},clear:function(e){this._callHook("treeClear",this)},count:function(){return this.rootNode.countChildren()},debug:function(e){4<=this.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("log",arguments))},enable:function(e){!1===e?this.widget.disable():this.widget.enable()},enableUpdate:function(e){return e=!1!==e,!!this._enableUpdate==!!e?e:((this._enableUpdate=e)?(this.debug("enableUpdate(true): redraw "),this._callHook("treeStructureChanged",this,"enableUpdate"),this.render()):this.debug("enableUpdate(false)..."),!e)},error:function(e){1<=this.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("error",arguments))},expandAll:function(t,n){var e=this.enableUpdate(!1);t=!1!==t,this.visit(function(e){!1!==e.hasChildren()&&e.isExpanded()!==t&&e.setExpanded(t,n)}),this.enableUpdate(e)},findAll:function(e){return this.rootNode.findAll(e)},findFirst:function(e){return this.rootNode.findFirst(e)},findNextNode:function(t,n){var i,r=null,e=this.getFirstChild();function o(e){if(t(e)&&(r=e),r||e===n)return!1}return t="string"==typeof t?(i=new RegExp("^"+t,"i"),function(e){return i.test(e.title)}):t,n=n||e,this.visitRows(o,{start:n,includeSelf:!1}),r||n===e||this.visitRows(o,{start:e,includeSelf:!0}),r},findRelatedNode:function(e,t,n){var i=null,r=k.ui.keyCode;switch(t){case"parent":case r.BACKSPACE:e.parent&&e.parent.parent&&(i=e.parent);break;case"first":case r.HOME:this.visit(function(e){if(e.isVisible())return i=e,!1});break;case"last":case r.END:this.visit(function(e){e.isVisible()&&(i=e)});break;case"left":case r.LEFT:e.expanded?e.setExpanded(!1):e.parent&&e.parent.parent&&(i=e.parent);break;case"right":case r.RIGHT:e.expanded||!e.children&&!e.lazy?e.children&&e.children.length&&(i=e.children[0]):(e.setExpanded(),i=e);break;case"up":case r.UP:this.visitRows(function(e){return i=e,!1},{start:e,reverse:!0,includeSelf:!1});break;case"down":case r.DOWN:this.visitRows(function(e){return i=e,!1},{start:e,includeSelf:!1});break;default:this.tree.warn("Unknown relation '"+t+"'.")}return i},generateFormElements:function(e,t,n){n=n||{};var i,r="string"==typeof e?e:"ft_"+this._id+"[]",o="string"==typeof t?t:"ft_"+this._id+"_active",s="fancytree_result_"+this._id,a=k("#"+s),l=3===this.options.selectMode&&!1!==n.stopOnParents;function d(e){a.append(k("<input>",{type:"checkbox",name:r,value:e.key,checked:!0}))}a.length?a.empty():a=k("<div>",{id:s}).hide().insertAfter(this.$container),!1!==t&&this.activeNode&&a.append(k("<input>",{type:"radio",name:o,value:this.activeNode.key,checked:!0})),n.filter?this.visit(function(e){var t=n.filter(e);if("skip"===t)return t;!1!==t&&d(e)}):!1!==e&&(i=this.getSelectedNodes(l),k.each(i,function(e,t){d(t)}))},getActiveNode:function(){return this.activeNode},getFirstChild:function(){return this.rootNode.getFirstChild()},getFocusNode:function(){return this.focusNode},getOption:function(e){return this.widget.option(e)},getNodeByKey:function(t,e){var n,i;return!e&&(n=document.getElementById(this.options.idPrefix+t))?n.ftnode?n.ftnode:null:(e=e||this.rootNode,i=null,e.visit(function(e){if(e.key===t)return i=e,!1},!0),i)},getRootNode:function(){return this.rootNode},getSelectedNodes:function(e){return this.rootNode.getSelectedNodes(e)},hasFocus:function(){return!!this._hasFocus},info:function(e){3<=this.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("info",arguments))},loadKeyPath:function(e,t){var i,n,r,o=this,s=new k.Deferred,a=this.getRootNode(),l=this.options.keyPathSeparator,d=[],c=k.extend({},t);for("function"==typeof t?i=t:t&&t.callback&&(i=t.callback),c.callback=function(e,t,n){i&&i.call(e,t,n),s.notifyWith(e,[{node:t,status:n}])},null==c.matchKey&&(c.matchKey=function(e,t){return e.key===t}),k.isArray(e)||(e=[e]),n=0;n<e.length;n++)(r=e[n]).charAt(0)===l&&(r=r.substr(1)),d.push(r.split(l));return setTimeout(function(){o._loadKeyPathImpl(s,c,a,d).done(function(){s.resolve()})},0),s.promise()},_loadKeyPathImpl:function(e,o,t,n){var i,r,s,a,l,d,c,u,h,f,p=this;function g(e,t){var n,i,r=e.children;if(r)for(n=0,i=r.length;n<i;n++)if(o.matchKey(r[n],t))return r[n];return null}for(c={},r=0;r<n.length;r++)for(h=n[r],u=t;h.length;){if(s=h.shift(),!(a=g(u,s))){this.warn("loadKeyPath: key not found: "+s+" (parent: "+u+")"),o.callback(this,s,"error");break}if(0===h.length){o.callback(this,a,"ok");break}if(a.lazy&&void 0===a.hasChildren()){o.callback(this,a,"loaded"),c[s=a.key]?c[s].pathSegList.push(h):c[s]={parent:a,pathSegList:[h]};break}o.callback(this,a,"loaded"),u=a}function v(t,n,e){o.callback(p,n,"loading"),n.load().done(function(){p._loadKeyPathImpl.call(p,t,o,n,e).always(E(t,p))}).fail(function(e){p.warn("loadKeyPath: error loading lazy "+n),o.callback(p,a,"error"),t.rejectWith(p)})}for(l in i=[],c)c.hasOwnProperty(l)&&(d=c[l],f=new k.Deferred,i.push(f),v(f,d.parent,d.pathSegList));return k.when.apply(k,i).promise()},reactivate:function(e){var t,n=this.activeNode;return n?(this.activeNode=null,t=n.setActive(!0,{noFocus:!0}),e&&n.setFocus(),t):w()},reload:function(e){return this._callHook("treeClear",this),this._callHook("treeLoad",this,e)},render:function(e,t){return this.rootNode.render(e,t)},selectAll:function(t){this.visit(function(e){e.setSelected(t)})},setFocus:function(e){return this._callHook("treeSetFocus",this,e)},setOption:function(e,t){return this.widget.option(e,t)},toDict:function(e,t){var n=this.rootNode.toDict(!0,t);return e?n:n.children},toString:function(){return"Fancytree@"+this._id},_triggerNodeEvent:function(e,t,n,i){var r=this._makeHookContext(t,n,i),o=this.widget._trigger(e,n,r);return!1!==o&&void 0!==r.result?r.result:o},_triggerTreeEvent:function(e,t,n){var i=this._makeHookContext(this,t,n),r=this.widget._trigger(e,t,i);return!1!==r&&void 0!==i.result?i.result:r},visit:function(e){return this.rootNode.visit(e,!1)},visitRows:function(t,e){if(!this.rootNode.children)return!1;if(e&&e.reverse)return delete e.reverse,this._visitRowsUp(t,e);var n,i,r,o=0,s=!1===(e=e||{}).includeSelf,a=!!e.includeHidden,l=!a&&this.enableFilter,d=e.start||this.rootNode.children[0];for(i=d.parent;i;){for(n=(r=i.children).indexOf(d)+o;n<r.length;n++)if(d=r[n],!l||d.match||d.subMatchCount){if(!s&&!1===t(d))return!1;if(s=!1,d.children&&d.children.length&&(a||d.expanded)&&!1===d.visit(function(e){return!l||e.match||e.subMatchCount?!1!==t(e)&&(a||!e.children||e.expanded?void 0:"skip"):"skip"},!1))return!1}i=(d=i).parent,o=1}return!0},_visitRowsUp:function(e,t){for(var n,i,r,o=!!t.includeHidden,s=t.start||this.rootNode.children[0];;){if((n=(r=s.parent).children)[0]===s){if(!(s=r).parent)break;n=r.children}else for(i=n.indexOf(s),s=n[i-1];(o||s.expanded)&&s.children&&s.children.length;)s=(n=(r=s).children)[n.length-1];if((o||s.isVisible())&&!1===e(s))return!1}},warn:function(e){2<=this.options.debugLevel&&(Array.prototype.unshift.call(arguments,this.toString()),d("warn",arguments))}},k.extend(P.prototype,{nodeClick:function(e){var t,n,i=e.targetType,r=e.node;if("expander"===i){if(r.isLoading())return void r.debug("Got 2nd click while loading: ignored");this._callHook("nodeToggleExpanded",e)}else if("checkbox"===i)this._callHook("nodeToggleSelected",e),e.options.focusOnSelect&&this._callHook("nodeSetFocus",e,!0);else{if(t=!(n=!1),r.folder)switch(e.options.clickFolderMode){case 2:t=!(n=!0);break;case 3:n=t=!0}t&&(this.nodeSetFocus(e),this._callHook("nodeSetActive",e,!0)),n&&this._callHook("nodeToggleExpanded",e)}},nodeCollapseSiblings:function(e,t){var n,i,r,o=e.node;if(o.parent)for(i=0,r=(n=o.parent.children).length;i<r;i++)n[i]!==o&&n[i].expanded&&this._callHook("nodeSetExpanded",n[i],!1,t)},nodeDblclick:function(e){"title"===e.targetType&&4===e.options.clickFolderMode&&this._callHook("nodeToggleExpanded",e),"title"===e.targetType&&e.originalEvent.preventDefault()},nodeKeydown:function(e){var t,n,i,r=e.originalEvent,o=e.node,s=e.tree,a=e.options,l=r.which,d=r.key||String.fromCharCode(l),c=!!(r.altKey||r.ctrlKey||r.metaKey),u=!b[l]&&!y[l]&&!c,h=k(r.target),f=!0,p=!(r.ctrlKey||!a.autoActivate);if(o||(i=this.getActiveNode()||this.getFirstChild())&&(i.setFocus(),(o=e.node=this.focusNode).debug("Keydown force focus on active node")),a.quicksearch&&u&&!h.is(":input:enabled"))return 500<(n=Date.now())-s.lastQuicksearchTime&&(s.lastQuicksearchTerm=""),s.lastQuicksearchTime=n,s.lastQuicksearchTerm+=d,(t=s.findNextNode(s.lastQuicksearchTerm,s.getActiveNode()))&&t.setActive(),void r.preventDefault();switch(g.eventToString(r)){case"+":case"=":s.nodeSetExpanded(e,!0);break;case"-":s.nodeSetExpanded(e,!1);break;case"space":o.isPagingNode()?s._triggerNodeEvent("clickPaging",e,r):g.evalOption("checkbox",o,o,a,!1)?s.nodeToggleSelected(e):s.nodeSetActive(e,!0);break;case"return":s.nodeSetActive(e,!0);break;case"home":case"end":case"backspace":case"left":case"right":case"up":case"down":o.navigate(r.which,p);break;default:f=!1}f&&r.preventDefault()},nodeLoadChildren:function(o,s){var t,n,e,i,a=o.tree,l=o.node,d=Date.now();return k.isFunction(s)&&(s=s.call(a,{type:"source"},o),C(!k.isFunction(s),"source callback must not return another function")),s.url&&(l._requestId&&l.warn("Recursive load request #"+d+" while #"+l._requestId+" is pending."),t=k.extend({},o.options.ajax,s),l._requestId=d,e=t.debugDelay?(n=t.debugDelay,delete t.debugDelay,k.isArray(n)&&(n=n[0]+Math.random()*(n[1]-n[0])),l.warn("nodeLoadChildren waiting debugDelay "+Math.round(n)+" ms ..."),k.Deferred(function(e){setTimeout(function(){k.ajax(t).done(function(){e.resolveWith(this,arguments)}).fail(function(){e.rejectWith(this,arguments)})},n)})):k.ajax(t),s=new k.Deferred,e.done(function(e,t,n){var i,r;if("json"!==this.dataType&&"jsonp"!==this.dataType||"string"!=typeof e||k.error("Ajax request returned a string (did you get the JSON dataType wrong?)."),l._requestId&&l._requestId>d)s.rejectWith(this,[c]);else{if(o.options.postProcess){try{r=a._triggerNodeEvent("postProcess",o,o.originalEvent,{response:e,error:null,dataType:this.dataType})}catch(e){r={error:e,message:""+e,details:"postProcess failed"}}if(r.error)return i=k.isPlainObject(r.error)?r.error:{message:r.error},i=a._makeHookContext(l,null,i),void s.rejectWith(this,[i]);(k.isArray(r)||k.isPlainObject(r)&&k.isArray(r.children))&&(e=r)}else e&&e.hasOwnProperty("d")&&o.options.enableAspx&&(e="string"==typeof e.d?k.parseJSON(e.d):e.d);s.resolveWith(this,[e])}}).fail(function(e,t,n){var i=a._makeHookContext(l,null,{error:e,args:Array.prototype.slice.call(arguments),message:n,details:e.status+": "+n});s.rejectWith(this,[i])})),k.isFunction(s.then)&&k.isFunction(s.catch)&&(e=s,s=new k.Deferred,e.then(function(e){s.resolve(e)},function(e){s.reject(e)})),k.isFunction(s.promise)?(a.nodeSetStatus(o,"loading"),s.done(function(e){a.nodeSetStatus(o,"ok"),l._requestId=null}).fail(function(e){var t;e!==c?(e.node&&e.error&&e.message?t=e:"[object Object]"===(t=a._makeHookContext(l,null,{error:e,args:Array.prototype.slice.call(arguments),message:e?e.message||e.toString():""})).message&&(t.message=""),l.warn("Load children failed ("+t.message+")",t),!1!==a._triggerNodeEvent("loadError",t,null)&&a.nodeSetStatus(o,"error",t.message,t.details)):l.warn("Ignored response for obsolete load request #"+d+" (expected #"+l._requestId+")")})):o.options.postProcess&&(i=a._triggerNodeEvent("postProcess",o,o.originalEvent,{response:s,error:null,dataType:typeof s}),(k.isArray(i)||k.isPlainObject(i)&&k.isArray(i.children))&&(s=i)),k.when(s).done(function(e){var n,t;k.isPlainObject(e)&&(C(l.isRootNode(),"source may only be an object for root nodes (expecting an array of child objects otherwise)"),C(k.isArray(e.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),e=(n=e).children,delete n.children,k.each(u,function(e,t){void 0!==n[t]&&(a[t]=n[t],delete n[t])}),k.extend(a.data,n)),C(k.isArray(e),"expected array of children"),l._setChildren(e),a.options.nodata&&0===e.length&&(k.isFunction(a.options.nodata)?t=a.options.nodata.call(a,{type:"nodata"},o):!0===a.options.nodata&&l.isRootNode()?t=a.options.strings.nodata:"string"==typeof a.options.nodata&&l.isRootNode()&&(t=a.options.nodata),t&&l.setStatus("nodata",t)),a._triggerNodeEvent("loadChildren",l)})},nodeLoadKeyPath:function(e,t){},nodeRemoveChild:function(e,t){var n,i=e.node,r=k.extend({},e,{node:t}),o=i.children;if(1===o.length)return C(t===o[0],"invalid single child"),this.nodeRemoveChildren(e);this.activeNode&&(t===this.activeNode||this.activeNode.isDescendantOf(t))&&this.activeNode.setActive(!1),this.focusNode&&(t===this.focusNode||this.focusNode.isDescendantOf(t))&&(this.focusNode=null),this.nodeRemoveMarkup(r),this.nodeRemoveChildren(r),C(0<=(n=k.inArray(t,o)),"invalid child"),i.triggerModifyChild("remove",t),t.visit(function(e){e.parent=null},!0),this._callHook("treeRegisterNode",this,!1,t),o.splice(n,1)},nodeRemoveChildMarkup:function(e){var t=e.node;t.ul&&(t.isRootNode()?k(t.ul).empty():(k(t.ul).remove(),t.ul=null),t.visit(function(e){e.li=e.ul=null}))},nodeRemoveChildren:function(e){var t=e.tree,n=e.node;n.children&&(this.activeNode&&this.activeNode.isDescendantOf(n)&&this.activeNode.setActive(!1),this.focusNode&&this.focusNode.isDescendantOf(n)&&(this.focusNode=null),this.nodeRemoveChildMarkup(e),n.triggerModifyChild("remove",null),n.visit(function(e){e.parent=null,t._callHook("treeRegisterNode",t,!1,e)}),n.lazy?n.children=[]:n.children=null,n.isRootNode()||(n.expanded=!1),this.nodeRenderStatus(e))},nodeRemoveMarkup:function(e){var t=e.node;t.li&&(k(t.li).remove(),t.li=null),this.nodeRemoveChildMarkup(e)},nodeRender:function(e,t,n,i,r){var o,s,a,l,d,c,u,h=e.node,f=e.tree,p=e.options,g=p.aria,v=!1,y=h.parent,b=!y,m=h.children,x=null;if(!1!==f._enableUpdate&&(b||y.ul)){if(C(b||y.ul,"parent UL must exist"),b||(h.li&&(t||h.li.parentNode!==h.parent.ul)&&(h.li.parentNode===h.parent.ul?x=h.li.nextSibling:this.debug("Unlinking "+h+" (must be child of "+h.parent+")"),this.nodeRemoveMarkup(e)),h.li?this.nodeRenderStatus(e):(v=!0,h.li=document.createElement("li"),(h.li.ftnode=h).key&&p.generateIds&&(h.li.id=p.idPrefix+h.key),h.span=document.createElement("span"),h.span.className="fancytree-node",g&&!h.tr&&k(h.li).attr("role","treeitem"),h.li.appendChild(h.span),this.nodeRenderTitle(e),p.createNode&&p.createNode.call(f,{type:"createNode"},e)),p.renderNode&&p.renderNode.call(f,{type:"renderNode"},e)),m){if(b||h.expanded||!0===n){for(h.ul||(h.ul=document.createElement("ul"),(!0!==i||r)&&h.expanded||(h.ul.style.display="none"),g&&k(h.ul).attr("role","group"),h.li?h.li.appendChild(h.ul):h.tree.$div.append(h.ul)),l=0,d=m.length;l<d;l++)u=k.extend({},e,{node:m[l]}),this.nodeRender(u,t,n,!1,!0);for(o=h.ul.firstChild;o;)o=(a=o.ftnode)&&a.parent!==h?(h.debug("_fixParent: remove missing "+a,o),c=o.nextSibling,o.parentNode.removeChild(o),c):o.nextSibling;for(o=h.ul.firstChild,l=0,d=m.length-1;l<d;l++)(s=m[l])===(a=o.ftnode)?o=o.nextSibling:h.ul.insertBefore(s.li,a.li)}}else h.ul&&(this.warn("remove child markup for "+h),this.nodeRemoveChildMarkup(e));b||v&&y.ul.insertBefore(h.li,x)}},nodeRenderTitle:function(e,t){var n,i,r,o,s,a,l,d=e.node,c=e.tree,u=e.options,h=u.aria,f=d.getLevel(),p=[];void 0!==t&&(d.title=t),d.span&&!1!==c._enableUpdate&&(s=h&&!1!==d.hasChildren()?" role='button'":"",f<u.minExpandLevel?(d.lazy||(d.expanded=!0),1<f&&p.push("<span "+s+" class='fancytree-expander fancytree-expander-fixed'></span>")):p.push("<span "+s+" class='fancytree-expander'></span>"),(n=g.evalOption("checkbox",d,d,u,!1))&&!d.isStatusNode()&&(s=h?" role='checkbox'":"",i="fancytree-checkbox",("radio"===n||d.parent&&d.parent.radiogroup)&&(i+=" fancytree-radio"),p.push("<span "+s+" class='"+i+"'></span>")),void 0!==d.data.iconClass&&(d.icon?k.error("'iconClass' node option is deprecated since v2.14.0: use 'icon' only instead"):(d.warn("'iconClass' node option is deprecated since v2.14.0: use 'icon' instead"),d.icon=d.data.iconClass)),!1!==(r=g.evalOption("icon",d,d,u,!0))&&(s=h?" role='presentation'":"",l=(l=g.evalOption("iconTooltip",d,d,u,null))?" title='"+L(l)+"'":"","string"==typeof r?v.test(r)?(r="/"===r.charAt(0)?r:(u.imagePath||"")+r,p.push("<img src='"+r+"' class='fancytree-icon'"+l+" alt='' />")):p.push("<span "+s+" class='fancytree-custom-icon "+r+"'"+l+"></span>"):r.text?p.push("<span "+s+" class='fancytree-custom-icon "+(r.addClass||"")+"'"+l+">"+g.escapeHtml(r.text)+"</span>"):r.html?p.push("<span "+s+" class='fancytree-custom-icon "+(r.addClass||"")+"'"+l+">"+r.html+"</span>"):p.push("<span "+s+" class='fancytree-icon'"+l+"></span>")),o="",u.renderTitle&&(o=u.renderTitle.call(c,{type:"renderTitle"},e)||""),o||(!0===(a=g.evalOption("tooltip",d,d,u,null))&&(a=d.title),o="<span class='fancytree-title'"+(a=a?" title='"+L(a)+"'":"")+(u.titlesTabbable?" tabindex='0'":"")+">"+(u.escapeTitles?g.escapeHtml(d.title):d.title)+"</span>"),p.push(o),d.span.innerHTML=p.join(""),this.nodeRenderStatus(e),u.enhanceTitle&&(e.$title=k(">span.fancytree-title",d.span),o=u.enhanceTitle.call(c,{type:"enhanceTitle"},e)||""))},nodeRenderStatus:function(e){var t,n=e.node,i=e.tree,r=e.options,o=n.hasChildren(),s=n.isLastSibling(),a=r.aria,l=r._classNames,d=[],c=n[i.statusClassPropName];c&&!1!==i._enableUpdate&&(a&&(t=k(n.tr||n.li)),d.push(l.node),i.activeNode===n&&d.push(l.active),i.focusNode===n&&d.push(l.focused),n.expanded&&d.push(l.expanded),a&&(!1===o?t.removeAttr("aria-expanded"):t.attr("aria-expanded",Boolean(n.expanded))),n.folder&&d.push(l.folder),!1!==o&&d.push(l.hasChildren),s&&d.push(l.lastsib),n.lazy&&null==n.children&&d.push(l.lazy),n.partload&&d.push(l.partload),n.partsel&&d.push(l.partsel),g.evalOption("unselectable",n,n,r,!1)&&d.push(l.unselectable),n._isLoading&&d.push(l.loading),n._error&&d.push(l.error),n.statusNodeType&&d.push(l.statusNodePrefix+n.statusNodeType),n.selected?(d.push(l.selected),a&&t.attr("aria-selected",!0)):a&&t.attr("aria-selected",!1),n.extraClasses&&d.push(n.extraClasses),!1===o?d.push(l.combinedExpanderPrefix+"n"+(s?"l":"")):d.push(l.combinedExpanderPrefix+(n.expanded?"e":"c")+(n.lazy&&null==n.children?"d":"")+(s?"l":"")),d.push(l.combinedIconPrefix+(n.expanded?"e":"c")+(n.folder?"f":"")),c.className=d.join(" "),n.li&&k(n.li).toggleClass(l.lastsib,s))},nodeSetActive:function(e,t,n){n=n||{};var i,r=e.node,o=e.tree,s=e.options,a=!0===n.noEvents,l=!0===n.noFocus,d=!1!==n.scrollIntoView;return r===o.activeNode===(t=!1!==t)?w(r):t&&!a&&!1===this._triggerNodeEvent("beforeActivate",r,e.originalEvent)?S(r,["rejected"]):(t?(o.activeNode&&(C(o.activeNode!==r,"node was active (inconsistency)"),i=k.extend({},e,{node:o.activeNode}),o.nodeSetActive(i,!1),C(null===o.activeNode,"deactivate was out of sync?")),s.activeVisible&&r.makeVisible({scrollIntoView:d}),o.activeNode=r,o.nodeRenderStatus(e),l||o.nodeSetFocus(e),a||o._triggerNodeEvent("activate",r,e.originalEvent)):(C(o.activeNode===r,"node was not active (inconsistency)"),o.activeNode=null,this.nodeRenderStatus(e),a||e.tree._triggerNodeEvent("deactivate",r,e.originalEvent)),w(r))},nodeSetExpanded:function(i,r,e){e=e||{};var t,n,o,s,a,l,d=i.node,c=i.tree,u=i.options,h=!0===e.noAnimation,f=!0===e.noEvents;if(r=!1!==r,d.expanded&&r||!d.expanded&&!r)return w(d);if(r&&!d.lazy&&!d.hasChildren())return w(d);if(!r&&d.getLevel()<u.minExpandLevel)return S(d,["locked"]);if(!f&&!1===this._triggerNodeEvent("beforeExpand",d,i.originalEvent))return S(d,["rejected"]);if(h||d.isVisible()||(h=e.noAnimation=!0),n=new k.Deferred,r&&!d.expanded&&u.autoCollapse){a=d.getParentList(!1,!0),l=u.autoCollapse;try{for(u.autoCollapse=!1,o=0,s=a.length;o<s;o++)this._callHook("nodeCollapseSiblings",a[o],e)}finally{u.autoCollapse=l}}return n.done(function(){var e=d.getLastChild();r&&u.autoScroll&&!h&&e?e.scrollIntoView(!0,{topNode:d}).always(function(){f||i.tree._triggerNodeEvent(r?"expand":"collapse",i)}):f||i.tree._triggerNodeEvent(r?"expand":"collapse",i)}),t=function(e){var t=u._classNames,n=u.toggleEffect;if(d.expanded=r,c._callHook("treeStructureChanged",i,r?"expand":"collapse"),c._callHook("nodeRender",i,!1,!1,!0),d.ul)if("none"!==d.ul.style.display===!!d.expanded)d.warn("nodeSetExpanded: UL.style.display already set");else{if(n&&!h)return k(d.li).addClass(t.animating),void(k.isFunction(k(d.ul)[n.effect])?(c.debug("use jquery."+n.effect+" method"),k(d.ul)[n.effect]({duration:n.duration,always:function(){k(this).removeClass(t.animating),k(d.li).removeClass(t.animating),e()}})):(k(d.ul).stop(!0,!0),k(d.ul).parent().find(".ui-effects-placeholder").remove(),k(d.ul).toggle(n.effect,n.options,n.duration,function(){k(this).removeClass(t.animating),k(d.li).removeClass(t.animating),e()})));d.ul.style.display=d.expanded||!parent?"":"none"}e()},r&&d.lazy&&void 0===d.hasChildren()?d.load().done(function(){n.notifyWith&&n.notifyWith(d,["loaded"]),t(function(){n.resolveWith(d)})}).fail(function(e){t(function(){n.rejectWith(d,["load failed ("+e+")"])})}):t(function(){n.resolveWith(d)}),n.promise()},nodeSetFocus:function(e,t){var n,i=e.tree,r=e.node,o=i.options,s=!!e.originalEvent&&k(e.originalEvent.target).is(":input");if(t=!1!==t,i.focusNode){if(i.focusNode===r&&t)return;n=k.extend({},e,{node:i.focusNode}),i.focusNode=null,this._triggerNodeEvent("blur",n),this._callHook("nodeRenderStatus",n)}t&&(this.hasFocus()||(r.debug("nodeSetFocus: forcing container focus"),this._callHook("treeSetFocus",e,!0,{calledByNode:!0})),r.makeVisible({scrollIntoView:!1}),i.focusNode=r,o.titlesTabbable&&(s||k(r.span).find(".fancytree-title").focus()),o.aria&&k(i.$container).attr("aria-activedescendant",k(r.tr||r.li).uniqueId().attr("id")),this._triggerNodeEvent("focus",e),document.activeElement===i.$container.get(0)||1<=k(document.activeElement,i.$container).length||k(i.$container).focus(),o.autoScroll&&r.scrollIntoView(),this._callHook("nodeRenderStatus",e))},nodeSetSelected:function(e,t,n){n=n||{};var i=e.node,r=e.tree,o=e.options,s=!0===n.noEvents,a=i.parent;if(t=!1!==t,!g.evalOption("unselectable",i,i,o,!1)){if(i._lastSelectIntent=t,!!i.selected===t&&(3!==o.selectMode||!i.partsel||t))return t;if(!s&&!1===this._triggerNodeEvent("beforeSelect",i,e.originalEvent))return!!i.selected;t&&1===o.selectMode?(r.lastSelectedNode&&r.lastSelectedNode.setSelected(!1),i.selected=t):3!==o.selectMode||!a||a.radiogroup||i.radiogroup?a&&a.radiogroup?i.visitSiblings(function(e){e._changeSelectStatusAttrs(t&&e===i)},!0):i.selected=t:(i.selected=t,i.fixSelection3AfterClick(n)),this.nodeRenderStatus(e),r.lastSelectedNode=t?i:null,s||r._triggerNodeEvent("select",e)}},nodeSetStatus:function(i,e,t,n){var r=i.node,o=i.tree;function s(e,t){var n=r.children?r.children[0]:null;return n&&n.isStatusNode()?(k.extend(n,e),n.statusNodeType=t,o._callHook("nodeRenderTitle",n)):(r._setChildren([e]),o._callHook("treeStructureChanged",i,"setStatusNode"),r.children[0].statusNodeType=t,o.render()),r.children[0]}switch(e){case"ok":!function(){var e=r.children?r.children[0]:null;if(e&&e.isStatusNode()){try{r.ul&&(r.ul.removeChild(e.li),e.li=null)}catch(e){}1===r.children.length?r.children=[]:r.children.shift(),o._callHook("treeStructureChanged",i,"clearStatusNode")}}(),r._isLoading=!1,r._error=null,r.renderStatus();break;case"loading":r.parent||s({title:o.options.strings.loading+(t?" ("+t+")":""),checkbox:!1,tooltip:n},e),r._isLoading=!0,r._error=null,r.renderStatus();break;case"error":s({title:o.options.strings.loadError+(t?" ("+t+")":""),checkbox:!1,tooltip:n},e),r._isLoading=!1,r._error={message:t,details:n},r.renderStatus();break;case"nodata":s({title:t||o.options.strings.noData,checkbox:!1,tooltip:n},e),r._isLoading=!1,r._error=null,r.renderStatus();break;default:k.error("invalid node status "+e)}},nodeToggleExpanded:function(e){return this.nodeSetExpanded(e,!e.node.expanded)},nodeToggleSelected:function(e){var t=e.node,n=!t.selected;return t.partsel&&!t.selected&&!0===t._lastSelectIntent&&(n=!1,t.selected=!0),t._lastSelectIntent=n,this.nodeSetSelected(e,n)},treeClear:function(e){var t=e.tree;t.activeNode=null,t.focusNode=null,t.$div.find(">ul.fancytree-container").empty(),t.rootNode.children=null,t._callHook("treeStructureChanged",e,"clear")},treeCreate:function(e){},treeDestroy:function(e){this.$div.find(">ul.fancytree-container").remove(),this.$source&&this.$source.removeClass("fancytree-helper-hidden")},treeInit:function(e){var n=e.tree,i=n.options;n.$container.attr("tabindex",i.tabindex),k.each(u,function(e,t){void 0!==i[t]&&(n.info("Move option "+t+" to tree"),n[t]=i[t],delete i[t])}),i.checkboxAutoHide&&n.$container.addClass("fancytree-checkbox-auto-hide"),i.rtl?n.$container.attr("DIR","RTL").addClass("fancytree-rtl"):n.$container.removeAttr("DIR").removeClass("fancytree-rtl"),i.aria&&(n.$container.attr("role","tree"),1!==i.selectMode&&n.$container.attr("aria-multiselectable",!0)),this.treeLoad(e)},treeLoad:function(e,t){var n,i,r,o=e.tree,s=e.widget.element,a=k.extend({},e,{node:this.rootNode});if(o.rootNode.children&&this.treeClear(e),t=t||this.options.source)"string"==typeof t&&k.error("Not implemented");else switch(i=s.data("type")||"html"){case"html":(r=s.find(">ul").first()).addClass("ui-fancytree-source fancytree-helper-hidden"),t=k.ui.fancytree.parseHtml(r),this.data=k.extend(this.data,T(r));break;case"json":t=k.parseJSON(s.text()),s.contents().filter(function(){return 3===this.nodeType}).remove(),k.isPlainObject(t)&&(C(k.isArray(t.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),t=(n=t).children,delete n.children,k.each(u,function(e,t){void 0!==n[t]&&(o[t]=n[t],delete n[t])}),k.extend(o.data,n));break;default:k.error("Invalid data-type: "+i)}return this.nodeLoadChildren(a,t).done(function(){o._callHook("treeStructureChanged",e,"loadChildren"),o.render(),3===e.options.selectMode&&o.rootNode.fixSelection3FromEndNodes(),o.activeNode&&o.options.activeVisible&&o.activeNode.makeVisible(),o._triggerTreeEvent("init",null,{status:!0})}).fail(function(){o.render(),o._triggerTreeEvent("init",null,{status:!1})})},treeRegisterNode:function(e,t,n){e.tree._callHook("treeStructureChanged",e,t?"addNode":"removeNode")},treeSetFocus:function(e,t,n){var i;(t=!1!==t)!==this.hasFocus()&&(!(this._hasFocus=t)&&this.focusNode?this.focusNode.setFocus(!1):!t||n&&n.calledByNode||k(this.$container).focus(),this.$container.toggleClass("fancytree-treefocus",t),this._triggerTreeEvent(t?"focusTree":"blurTree"),t&&!this.activeNode&&(i=this._lastMousedownNode||this.getFirstChild())&&i.setFocus())},treeSetOption:function(e,t,n){var i=e.tree,r=!0,o=!1,s=!1;switch(t){case"aria":case"checkbox":case"icon":case"minExpandLevel":case"tabindex":s=o=!0;break;case"checkboxAutoHide":i.$container.toggleClass("fancytree-checkbox-auto-hide",!!n);break;case"escapeTitles":case"tooltip":s=!0;break;case"rtl":!1===n?i.$container.removeAttr("DIR").removeClass("fancytree-rtl"):i.$container.attr("DIR","RTL").addClass("fancytree-rtl"),s=!0;break;case"source":r=!1,i._callHook("treeLoad",i,n),s=!0}i.debug("set option "+t+"="+n+" <"+typeof n+">"),r&&(this.widget._super?this.widget._super.call(this.widget,t,n):k.Widget.prototype._setOption.call(this.widget,t,n)),o&&i._callHook("treeCreate",i),s&&i.render(!0,!1)},treeStructureChanged:function(e,t){}}),k.widget("ui.fancytree",{options:{activeVisible:!0,ajax:{type:"GET",cache:!1,dataType:"json"},aria:!0,autoActivate:!0,autoCollapse:!1,autoScroll:!1,checkbox:!1,clickFolderMode:4,debugLevel:null,disabled:!1,enableAspx:!0,escapeTitles:!1,extensions:[],toggleEffect:{effect:"slideToggle",duration:200},generateIds:!1,icon:!0,idPrefix:"ft_",focusOnSelect:!1,keyboard:!0,keyPathSeparator:"/",minExpandLevel:1,nodata:!0,quicksearch:!1,rtl:!1,scrollOfs:{top:0,bottom:0},scrollParent:null,selectMode:2,strings:{loading:"Loading...",loadError:"Load error!",moreData:"More...",noData:"No data."},tabindex:"0",titlesTabbable:!1,tooltip:!1,treeId:null,_classNames:{node:"fancytree-node",folder:"fancytree-folder",animating:"fancytree-animating",combinedExpanderPrefix:"fancytree-exp-",combinedIconPrefix:"fancytree-ico-",hasChildren:"fancytree-has-children",active:"fancytree-active",selected:"fancytree-selected",expanded:"fancytree-expanded",lazy:"fancytree-lazy",focused:"fancytree-focused",partload:"fancytree-partload",partsel:"fancytree-partsel",radio:"fancytree-radio",unselectable:"fancytree-unselectable",lastsib:"fancytree-lastsib",loading:"fancytree-loading",error:"fancytree-error",statusNodePrefix:"fancytree-statusnode-"},lazyLoad:null,postProcess:null},_create:function(){this.tree=new P(this),this.$source=this.source||"json"===this.element.data("type")?this.element:this.element.find(">ul").first();var e,t,n,i=this.options,r=i.extensions;this.tree;for(n=0;n<r.length;n++)t=r[n],(e=k.ui.fancytree._extensions[t])||k.error("Could not apply extension '"+t+"' (it is not registered, did you forget to include it?)"),this.tree.options[t]=h({},e.options,this.tree.options[t]),C(void 0===this.tree.ext[t],"Extension name must not exist as Fancytree.ext attribute: '"+t+"'"),this.tree.ext[t]={},p(this.tree,0,e,t),e;void 0!==i.icons&&(!0===i.icon?(this.tree.warn("'icons' tree option is deprecated since v2.14.0: use 'icon' instead"),i.icon=i.icons):k.error("'icons' tree option is deprecated since v2.14.0: use 'icon' only instead")),void 0!==i.iconClass&&(i.icon?k.error("'iconClass' tree option is deprecated since v2.14.0: use 'icon' only instead"):(this.tree.warn("'iconClass' tree option is deprecated since v2.14.0: use 'icon' instead"),i.icon=i.iconClass)),void 0!==i.tabbable&&(i.tabindex=i.tabbable?"0":"-1",this.tree.warn("'tabbable' tree option is deprecated since v2.17.0: use 'tabindex='"+i.tabindex+"' instead")),this.tree._callHook("treeCreate",this.tree)},_init:function(){this.tree._callHook("treeInit",this.tree),this._bind()},_setOption:function(e,t){return this.tree._callHook("treeSetOption",this.tree,e,t)},destroy:function(){this._unbind(),this.tree._callHook("treeDestroy",this.tree),k.Widget.prototype.destroy.call(this)},_unbind:function(){var e=this.tree._ns;this.element.off(e),this.tree.$container.off(e),k(document).off(e)},_bind:function(){var s=this,a=this.options,o=this.tree,e=o._ns;this._unbind(),o.$container.on("focusin"+e+" focusout"+e,function(e){var t=g.getNode(e),n="focusin"===e.type;if(!n&&t&&k(e.target).is("a"))t.debug("Ignored focusout on embedded <a> element.");else{if(n){if(o._getExpiringValue("focusin"))return void o.debug("Ignored double focusin.");o._setExpiringValue("focusin",!0,50),t||(t=o._getExpiringValue("mouseDownNode"))&&o.debug("Reconstruct mouse target for focusin from recent event.")}t?o._callHook("nodeSetFocus",o._makeHookContext(t,e),n):o.tbody&&k(e.target).parents("table.fancytree-container > thead").length?o.debug("Ignore focus event outside table body.",e):o._callHook("treeSetFocus",o,n)}}).on("selectstart"+e,"span.fancytree-title",function(e){e.preventDefault()}).on("keydown"+e,function(e){if(a.disabled||!1===a.keyboard)return!0;var t,n=o.focusNode,i=o._makeHookContext(n||o,e),r=o.phase;try{return o.phase="userEvent","preventNav"===(t=n?o._triggerNodeEvent("keydown",n,e):o._triggerTreeEvent("keydown",e))?t=!0:!1!==t&&(t=o._callHook("nodeKeydown",i)),t}finally{o.phase=r}}).on("mousedown"+e,function(e){var t=g.getEventTarget(e);o._lastMousedownNode=t?t.node:null,o._setExpiringValue("mouseDownNode",o._lastMousedownNode)}).on("click"+e+" dblclick"+e,function(e){if(a.disabled)return!0;var t,n=g.getEventTarget(e),i=n.node,r=s.tree,o=r.phase;if(!i)return!0;t=r._makeHookContext(i,e);try{switch(r.phase="userEvent",e.type){case"click":return t.targetType=n.type,i.isPagingNode()?!0===r._triggerNodeEvent("clickPaging",t,e):!1!==r._triggerNodeEvent("click",t,e)&&r._callHook("nodeClick",t);case"dblclick":return t.targetType=n.type,!1!==r._triggerNodeEvent("dblclick",t,e)&&r._callHook("nodeDblclick",t)}}finally{r.phase=o}})},getActiveNode:function(){return this.tree.activeNode},getNodeByKey:function(e){return this.tree.getNodeByKey(e)},getRootNode:function(){return this.tree.rootNode},getTree:function(){return this.tree}}),g=k.ui.fancytree,k.extend(k.ui.fancytree,{version:"2.31.0",buildType: "production",debugLevel: 3,_nextId:1,_nextNodeKey:1,_extensions:{},_FancytreeClass:P,_FancytreeNodeClass:A,jquerySupports:{positionMyOfs:function(e,t,n,i){var r,o,s,a=k.map(k.trim(e).split("."),function(e){return parseInt(e,10)}),l=k.map(Array.prototype.slice.call(arguments,1),function(e){return parseInt(e,10)});for(r=0;r<l.length;r++)if((o=a[r]||0)!==(s=l[r]||0))return s<o;return!0}(k.ui.version,1,9)},assert:function(e,t){return C(e,t)},createTree:function(e,t){return k(e).fancytree(t).fancytree("getTree")},debounce:function(t,n,i,r){var o;return 3===arguments.length&&"boolean"!=typeof i&&(r=i,i=!1),function(){var e=arguments;r=r||this,i&&!o&&n.apply(r,e),clearTimeout(o),o=setTimeout(function(){i||n.apply(r,e),o=null},t)}},debug:function(e){4<=k.ui.fancytree.debugLevel&&d("log",arguments)},error:function(e){1<=k.ui.fancytree.debugLevel&&d("error",arguments)},escapeHtml:function(e){return(""+e).replace(t,function(e){return i[e]})},fixPositionOptions:function(e){if((e.offset||0<=(""+e.my+e.at).indexOf("%"))&&k.error("expected new position syntax (but '%' is not supported)"),!k.ui.fancytree.jquerySupports.positionMyOfs){var t=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(e.my),n=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(e.at),i=(t[2]?+t[2]:0)+(n[2]?+n[2]:0),r=(t[4]?+t[4]:0)+(n[4]?+n[4]:0);e=k.extend({},e,{my:t[1]+" "+t[3],at:n[1]+" "+n[3]}),(i||r)&&(e.offset=i+" "+r)}return e},getEventTarget:function(e){var t,n=e&&e.target?e.target.className:"",i={node:this.getNode(e.target),type:void 0};return/\bfancytree-title\b/.test(n)?i.type="title":/\bfancytree-expander\b/.test(n)?i.type=!1===i.node.hasChildren()?"prefix":"expander":/\bfancytree-checkbox\b/.test(n)?i.type="checkbox":/\bfancytree(-custom)?-icon\b/.test(n)?i.type="icon":/\bfancytree-node\b/.test(n)?i.type="title":e&&e.target&&((t=k(e.target)).is("ul[role=group]")?((i.node&&i.node.tree||g).debug("Ignoring click on outer UL."),i.node=null):t.closest(".fancytree-title").length?i.type="title":t.closest(".fancytree-checkbox").length?i.type="checkbox":t.closest(".fancytree-expander").length&&(i.type="expander")),i},getEventTargetType:function(e){return this.getEventTarget(e).type},getNode:function(e){if(e instanceof A)return e;for(e instanceof k?e=e[0]:void 0!==e.originalEvent&&(e=e.target);e;){if(e.ftnode)return e.ftnode;e=e.parentNode}return null},getTree:function(e){var t,n=e;return e instanceof P?e:(void 0===e&&(e=0),"number"==typeof e?e=k(".fancytree-container").eq(e):"string"==typeof e?(e=k("#ft-id-"+n).eq(0)).length||(e=k(n).eq(0)):e instanceof k?e=e.eq(0):void 0!==e.originalEvent&&(e=k(e.target)),(t=(e=e.closest(":ui-fancytree")).data("ui-fancytree")||e.data("fancytree"))?t.tree:null)},evalOption:function(e,t,n,i,r){var o,s,a=t.tree,l=i[e],d=n[e];return k.isFunction(l)?(o={node:t,tree:a,widget:a.widget,options:a.widget.options,typeInfo:a.types[t.type]||{}},null==(s=l.call(a,{type:e},o))&&(s=d)):s=null==d?l:d,null==s&&(s=r),s},setSpanIcon:function(e,t,n){var i=k(e);"string"==typeof n?i.attr("class",t+" "+n):(n.text?i.text(""+n.text):n.html&&(e.innerHTML=n.html),i.attr("class",t+" "+(n.addClass||"")))},eventToString:function(e){var t=e.which,n=e.type,i=[];return e.altKey&&i.push("alt"),e.ctrlKey&&i.push("ctrl"),e.metaKey&&i.push("meta"),e.shiftKey&&i.push("shift"),"click"===n||"dblclick"===n?i.push(s[e.button]+n):"wheel"===n?i.push(n):r[t]||i.push(y[t]||String.fromCharCode(t).toLowerCase()),i.join("+")},info:function(e){3<=k.ui.fancytree.debugLevel&&d("info",arguments)},keyEventToString:function(e){return this.warn("keyEventToString() is deprecated: use eventToString()"),this.eventToString(e)},overrideMethod:function(e,t,n,i){var r,o=e[t]||k.noop;e[t]=function(){var e=i||this;try{return r=e._super,e._super=o,n.apply(e,arguments)}finally{e._super=r}}},parseHtml:function(s){var a,l,d,c,u,h,f,p,e=s.find(">li"),g=[];return e.each(function(){var e,t,n=k(this),i=n.find(">span",this).first(),r=i.length?null:n.find(">a").first(),o={tooltip:null,data:{}};for(i.length?o.title=i.html():r&&r.length?(o.title=r.html(),o.data.href=r.attr("href"),o.data.target=r.attr("target"),o.tooltip=r.attr("title")):(o.title=n.html(),0<=(u=o.title.search(/<ul/i))&&(o.title=o.title.substring(0,u))),o.title=k.trim(o.title),c=0,h=m.length;c<h;c++)o[m[c]]=void 0;for(a=this.className.split(" "),d=[],c=0,h=a.length;c<h;c++)l=a[c],x[l]?o[l]=!0:d.push(l);if(o.extraClasses=d.join(" "),(f=n.attr("title"))&&(o.tooltip=f),(f=n.attr("id"))&&(o.key=f),n.attr("hideCheckbox")&&(o.checkbox=!1),(e=T(n))&&!k.isEmptyObject(e)){for(t in _)e.hasOwnProperty(t)&&(e[_[t]]=e[t],delete e[t]);for(c=0,h=N.length;c<h;c++)f=N[c],null!=(p=e[f])&&(delete e[f],o[f]=p);k.extend(o.data,e)}(s=n.find(">ul").first()).length?o.children=k.ui.fancytree.parseHtml(s):o.children=o.lazy?void 0:null,g.push(o)}),g},registerExtension:function(e){C(null!=e.name,"extensions must have a `name` property."),C(null!=e.version,"extensions must have a `version` property."),k.ui.fancytree._extensions[e.name]=e},unescapeHtml:function(e){var t=document.createElement("div");return t.innerHTML=e,0===t.childNodes.length?"":t.childNodes[0].nodeValue},warn:function(e){2<=k.ui.fancytree.debugLevel&&d("warn",arguments)}}),k.ui.fancytree}function C(e,t){e||(t=t?": "+t:"",k.error("Fancytree assertion failed"+t))}function d(e,t){var n,i,r=window.console?window.console[e]:null;if(r)try{r.apply(window.console,t)}catch(e){for(i="",n=0;n<t.length;n++)i+=t[n];r(i)}}function h(){var e,t,n,i,r,o=arguments[0]||{},s=1,a=arguments.length;if("object"==typeof o||k.isFunction(o)||(o={}),s===a)throw Error("need at least two args");for(;s<a;s++)if(null!=(e=arguments[s]))for(t in e)if(e.hasOwnProperty(t)){if(n=o[t],o===(i=e[t]))continue;i&&k.isPlainObject(i)?(r=n&&k.isPlainObject(n)?n:{},o[t]=h(r,i)):void 0!==i&&(o[t]=i)}return o}function f(e,i,t,n,r){var o,s,a,l,d;return o=i[e],s=n[e],a=i.ext[r],l=function(){return o.apply(i,arguments)},d=function(e){return o.apply(i,e)},function(){var e=i._local,t=i._super,n=i._superApply;try{return i._local=a,i._super=l,i._superApply=d,s.apply(i,arguments)}finally{i._local=e,i._super=t,i._superApply=n}}}function p(e,t,n,i){for(var r in n)"function"==typeof n[r]?"function"==typeof e[r]?e[r]=f(r,e,0,n,i):"_"===r.charAt(0)?e.ext[i][r]=f(r,e,0,n,i):k.error("Could not override tree."+r+". Use prefix '_' to create tree."+i+"._"+r):"options"!==r&&(e.ext[i][r]=n[r])}function w(e,t){return void 0===e?k.Deferred(function(){this.resolve()}).promise():k.Deferred(function(){this.resolveWith(e,t)}).promise()}function S(e,t){return void 0===e?k.Deferred(function(){this.reject()}).promise():k.Deferred(function(){this.rejectWith(e,t)}).promise()}function E(e,t){return function(){e.resolveWith(t)}}function T(e){var t=k.extend({},e.data()),n=t.json;return delete t.fancytree,delete t.uiFancytree,n&&(delete t.json,t=k.extend(t,n)),t}function L(e){return(""+e).replace(n,function(e){return i[e]})}function H(t){return t=t.toLowerCase(),function(e){return 0<=e.title.toLowerCase().indexOf(t)}}function A(e,t){var n,i,r,o;for(this.parent=e,this.tree=e.tree,this.ul=null,this.li=null,this.statusNodeType=null,this._isLoading=!1,this._error=null,this.data={},n=0,i=N.length;n<i;n++)this[r=N[n]]=t[r];for(r in null==this.unselectableIgnore&&null==this.unselectableStatus||(this.unselectable=!0),t.hideCheckbox&&k.error("'hideCheckbox' node option was removed in v2.23.0: use 'checkbox: false'"),t.data&&k.extend(this.data,t.data),t)a[r]||k.isFunction(t[r])||l[r]||(this.data[r]=t[r]);null==this.key?this.tree.options.defaultKey?(this.key=this.tree.options.defaultKey(this),C(this.key,"defaultKey() must return a unique key")):this.key="_"+g._nextNodeKey++:this.key=""+this.key,t.active&&(C(null===this.tree.activeNode,"only one active node allowed"),this.tree.activeNode=this),t.selected&&(this.tree.lastSelectedNode=this),(o=t.children)?o.length?this._setChildren(o):this.children=this.lazy?[]:null:this.children=null,this.tree._callHook("treeRegisterNode",this.tree,!0,this)}function P(e){this.widget=e,this.$div=e.element,this.options=e.options,this.options&&(void 0!==this.options.lazyload&&k.error("The 'lazyload' event is deprecated since 2014-02-25. Use 'lazyLoad' (with uppercase L) instead."),void 0!==this.options.loaderror&&k.error("The 'loaderror' event was renamed since 2014-07-03. Use 'loadError' (with uppercase E) instead."),void 0!==this.options.fx&&k.error("The 'fx' option was replaced by 'toggleEffect' since 2014-11-30."),void 0!==this.options.removeNode&&k.error("The 'removeNode' event was replaced by 'modifyChild' since 2.20 (2016-09-10).")),this.ext={},this.types={},this.columns={},this.data=T(this.$div),this._id=""+(this.options.treeId||k.ui.fancytree._nextId++),this._ns=".fancytree-"+this._id,this.activeNode=null,this.focusNode=null,this._hasFocus=null,this._tempCache={},this._lastMousedownNode=null,this._enableUpdate=!0,this.lastSelectedNode=null,this.systemFocusElement=null,this.lastQuicksearchTerm="",this.lastQuicksearchTime=0,this.viewport=null,this.statusClassPropName="span",this.ariaPropName="li",this.nodeContainerAttrName="li",this.$div.find(">ul.fancytree-container").remove();var t,n={tree:this};this.rootNode=new A(n,{title:"root",key:"root_"+this._id,children:null,expanded:!0}),this.rootNode.parent=null,t=k("<ul>",{id:"ft-id-"+this._id,class:"ui-fancytree fancytree-container fancytree-plain"}).appendTo(this.$div),this.$container=t,this.rootNode.ul=t[0],null==this.options.debugLevel&&(this.options.debugLevel=g.debugLevel)}k.ui.fancytree.warn("Fancytree: ignored duplicate include")}); |
Copyright 2008-2019 Martin Wendt, | ||
http://wwWendt.de/ | ||
https://wwWendt.de/ | ||
@@ -4,0 +4,0 @@ Permission is hereby granted, free of charge, to any person obtaining |
@@ -10,3 +10,3 @@ /*! | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -16,4 +16,4 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
@@ -106,3 +106,6 @@ | ||
function findNeighbourTd(tree, $target, keyCode) { | ||
var $td = $target.closest("td"), | ||
var nextNode, | ||
node, | ||
navMap = { "ctrl+home": "first", "ctrl+end": "last" }, | ||
$td = $target.closest("td"), | ||
$tr = $td.parent(), | ||
@@ -113,2 +116,4 @@ treeOpts = tree.options, | ||
keyCode = navMap[keyCode] || keyCode; | ||
switch (keyCode) { | ||
@@ -123,26 +128,10 @@ case "left": | ||
case "down": | ||
while (true) { | ||
$tr = keyCode === "up" ? $tr.prev() : $tr.next(); | ||
if (!$tr.length) { | ||
break; | ||
} | ||
// Skip hidden rows | ||
if ($tr.is(":hidden")) { | ||
continue; | ||
} | ||
// Find adjacent cell in the same column | ||
$tdNext = findTdAtColIdx($tr, colIdx); | ||
break; | ||
} | ||
break; | ||
case "ctrl+home": | ||
$tdNext = findTdAtColIdx($tr.siblings().first(), colIdx); | ||
if ($tdNext.is(":hidden")) { | ||
$tdNext = findNeighbourTd(tree, $tdNext.parent(), "down"); | ||
} | ||
break; | ||
case "ctrl+end": | ||
$tdNext = findTdAtColIdx($tr.siblings().last(), colIdx); | ||
if ($tdNext.is(":hidden")) { | ||
$tdNext = findNeighbourTd(tree, $tdNext.parent(), "up"); | ||
node = $tr[0].ftnode; | ||
nextNode = tree.findRelatedNode(node, keyCode); | ||
if (nextNode) { | ||
nextNode.makeVisible(); | ||
nextNode.setActive(); | ||
$tdNext = findTdAtColIdx($(nextNode.tr), colIdx); | ||
} | ||
@@ -176,5 +165,6 @@ break; | ||
// $td.find( "a" ).click(); | ||
var event = document.createEvent("MouseEvent"); | ||
var event = document.createEvent("MouseEvent"), | ||
a = $td.find("a")[0]; // document.getElementById('nameOfID'); | ||
event = new CustomEvent("click"); | ||
var a = $td.find("a")[0]; // document.getElementById('nameOfID'); | ||
a.dispatchEvent(event); | ||
@@ -213,3 +203,3 @@ } | ||
($prevTd ? $prevTd.text() : "null") + | ||
" -> " + | ||
") -> " + | ||
($td ? $td.text() : "OFF") | ||
@@ -306,3 +296,3 @@ ); | ||
name: "ariagrid", | ||
version: "2.30.2", | ||
version: "2.31.0", | ||
// Default options for this extension. | ||
@@ -323,3 +313,7 @@ options: { | ||
// ariagrid requires the table extension to be loaded before itself | ||
this._requireExtension("table", true, true); | ||
if (tree.ext.grid) { | ||
this._requireExtension("grid", true, true); | ||
} else { | ||
this._requireExtension("table", true, true); | ||
} | ||
if (!treeOpts.aria) { | ||
@@ -397,3 +391,3 @@ $.error("ext-ariagrid requires `aria: true`"); | ||
// Enforce cell-mode when container gets focus | ||
if (opts.cellFocus === "force" && !tree.activeTd) { | ||
if (opts.cellFocus === "force" && !tree.$activeTd) { | ||
var node = tree.getActiveNode() || tree.getFirstChild(); | ||
@@ -403,2 +397,14 @@ tree.debug("Enforce cell-mode on focusTree event"); | ||
} | ||
}) | ||
// .on("fancytreeupdateviewport", function(event, data) { | ||
// tree.debug(event.type, data); | ||
// }) | ||
.on("fancytreebeforeupdateviewport", function(event, data) { | ||
// When scrolling, the TR may be re-used by another node, so the | ||
// active cell marker an | ||
// tree.debug(event.type, data); | ||
if (tree.viewport && tree.$activeTd) { | ||
tree.info("Cancel cell-mode due to scroll event."); | ||
tree.activateCell(null); | ||
} | ||
}); | ||
@@ -411,3 +417,4 @@ }, | ||
event = ctx.originalEvent, | ||
$td = $(event.target).closest("td"); | ||
$target = $(event.target), | ||
$td = $target.closest("td"); | ||
@@ -430,4 +437,9 @@ tree.debug( | ||
tree.activateCell($td); | ||
if ($(event.target).is(":input")) { | ||
if ($target.is(":input")) { | ||
return; | ||
} else if ( | ||
$target.is(".fancytree-checkbox") || | ||
$target.is(".fancytree-expander") | ||
) { | ||
return this._superApply(arguments); | ||
} | ||
@@ -549,3 +561,3 @@ return false; | ||
} | ||
ctx.tree.debug( | ||
tree.debug( | ||
"nodeKeydown(" + | ||
@@ -584,3 +596,5 @@ eventString + | ||
// Row mode: switch to cell-mode | ||
$td = $(node.tr).find(">td:first"); | ||
$td = $(node.tr) | ||
.find(">td") | ||
.first(); | ||
tree.activateCell($td); | ||
@@ -675,5 +689,5 @@ } | ||
// https://github.com/w3c/aria-practices/issues/132#issuecomment-407634891 | ||
$td = $(node.tr).find( | ||
">td:nth(" + this.nodeColumnIdx + ")" | ||
); | ||
$td = $(node.tr) | ||
.find(">td") | ||
.nth(this.nodeColumnIdx); | ||
tree.activateCell($td); | ||
@@ -680,0 +694,0 @@ } |
// Extending Fancytree | ||
// =================== | ||
// | ||
// See also the [live demo](http://wwwendt.de/tech/fancytree/demo/sample-ext-childcounter.html) of this code. | ||
// See also the [live demo](https://wwWendt.de/tech/fancytree/demo/sample-ext-childcounter.html) of this code. | ||
// | ||
@@ -17,3 +17,3 @@ // Every extension should have a comment header containing some information | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -23,4 +23,4 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
@@ -50,6 +50,6 @@ | ||
// The [coding guidelines](http://contribute.jquery.org/style-guide/js/) | ||
// require jshint compliance. | ||
// require jshint /eslint compliance. | ||
// But for this sample, we want to allow unused variables for demonstration purpose. | ||
/*jshint unused:false */ | ||
/*eslint-disable no-unused-vars */ | ||
@@ -125,3 +125,3 @@ // Adding methods | ||
// A full blown extension, extension is available for all trees and can be | ||
// enabled like so (see also the [live demo](http://wwwendt.de/tech/fancytree/demo/sample-ext-childcounter.html)): | ||
// enabled like so (see also the [live demo](https://wwWendt.de/tech/fancytree/demo/sample-ext-childcounter.html)): | ||
// | ||
@@ -146,3 +146,3 @@ // <script src="../src/jquery.fancytree.js"></script> | ||
// Version information should be compliant with [semver](http://semver.org) | ||
version: "2.30.2", | ||
version: "2.31.0", | ||
@@ -174,3 +174,3 @@ // Extension specific options and their defaults. | ||
// Fancytree implements a number of 'hook methods', prefixed by 'node...' or 'tree...'. | ||
// with a `ctx` argument (see [EventData](http://www.wwwendt.de/tech/fancytree/doc/jsdoc/global.html#EventData) | ||
// with a `ctx` argument (see [EventData](https://wwWendt.de/tech/fancytree/doc/jsdoc/global.html#EventData) | ||
// for details) and an extended calling context:<br> | ||
@@ -181,3 +181,3 @@ // `this` : the Fancytree instance<br> | ||
// | ||
// See also the [complete list of available hook functions](http://www.wwwendt.de/tech/fancytree/doc/jsdoc/Fancytree_Hooks.html). | ||
// See also the [complete list of available hook functions](https://wwWendt.de/tech/fancytree/doc/jsdoc/Fancytree_Hooks.html). | ||
@@ -184,0 +184,0 @@ /* Init */ |
@@ -7,3 +7,3 @@ /*! | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -13,4 +13,4 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
@@ -71,3 +71,3 @@ | ||
function hashMurmur3(key, asString, seed) { | ||
/*jshint bitwise:false */ | ||
/*eslint-disable no-bitwise */ | ||
var h1b, | ||
@@ -112,7 +112,8 @@ k1, | ||
switch (remainder) { | ||
/*jshint -W086:true */ | ||
case 3: | ||
k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16; | ||
// fall through | ||
case 2: | ||
k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8; | ||
// fall through | ||
case 1: | ||
@@ -152,15 +153,22 @@ k1 ^= key.charCodeAt(i) & 0xff; | ||
return h1 >>> 0; | ||
/*eslint-enable no-bitwise */ | ||
} | ||
/* | ||
* Return a unique key for node by calculating the hash of the parents refKey-list. | ||
*/ | ||
* Return a unique key for node by calculating the hash of the parents refKey-list. | ||
*/ | ||
function calcUniqueKey(node) { | ||
var key, | ||
h1, | ||
path = $.map(node.getParentList(false, true), function(e) { | ||
return e.refKey || e.key; | ||
}); | ||
path = path.join("/"); | ||
key = "id_" + hashMurmur3(path, true); | ||
// node.debug(path + " -> " + key); | ||
// 32-bit has a high probability of collisions, so we pump up to 64-bit | ||
// https://security.stackexchange.com/q/209882/207588 | ||
h1 = hashMurmur3(path, true); | ||
key = "id_" + h1 + hashMurmur3(h1 + path, true); | ||
return key; | ||
@@ -368,3 +376,3 @@ } | ||
name: "clones", | ||
version: "2.30.2", | ||
version: "2.31.0", | ||
// Default options for this extension. | ||
@@ -413,8 +421,17 @@ options: { | ||
if (keyMap[node.key] != null) { | ||
$.error( | ||
"clones.treeRegisterNode: node.key already exists: " + | ||
node | ||
); | ||
var other = keyMap[node.key], | ||
msg = | ||
"clones.treeRegisterNode: duplicate key '" + | ||
node.key + | ||
"': /" + | ||
node.getPath(true) + | ||
" => " + | ||
other.getPath(true); | ||
// Sometimes this exception is not visible in the console, | ||
// so we also write it: | ||
tree.error(msg); | ||
$.error(msg); | ||
} | ||
keyMap[key] = node; | ||
if (refKey) { | ||
@@ -421,0 +438,0 @@ refList = refMap[refKey]; |
@@ -7,3 +7,3 @@ /*! | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -13,4 +13,4 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
@@ -44,3 +44,3 @@ | ||
name: "columnview", | ||
version: "2.30.2", | ||
version: "2.31.0", | ||
// Default options for this extension. | ||
@@ -47,0 +47,0 @@ options: {}, |
@@ -7,3 +7,3 @@ /*! | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -13,4 +13,4 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
@@ -51,2 +51,3 @@ | ||
function offsetString(n) { | ||
// eslint-disable-next-line no-nested-ternary | ||
return n === 0 ? "" : n > 0 ? "+" + n : "" + n; | ||
@@ -364,3 +365,3 @@ } | ||
name: "dnd", | ||
version: "2.30.2", | ||
version: "2.31.0", | ||
// Default options for this extension. | ||
@@ -513,17 +514,17 @@ options: { | ||
/* | ||
* Handles drag'n'drop functionality. | ||
* | ||
* A standard jQuery drag-and-drop process may generate these calls: | ||
* | ||
* start: | ||
* _onDragEvent("start", sourceNode, null, event, ui, draggable); | ||
* drag: | ||
* _onDragEvent("leave", prevTargetNode, sourceNode, event, ui, draggable); | ||
* _onDragEvent("over", targetNode, sourceNode, event, ui, draggable); | ||
* _onDragEvent("enter", targetNode, sourceNode, event, ui, draggable); | ||
* stop: | ||
* _onDragEvent("drop", targetNode, sourceNode, event, ui, draggable); | ||
* _onDragEvent("leave", targetNode, sourceNode, event, ui, draggable); | ||
* _onDragEvent("stop", sourceNode, null, event, ui, draggable); | ||
*/ | ||
* Handles drag'n'drop functionality. | ||
* | ||
* A standard jQuery drag-and-drop process may generate these calls: | ||
* | ||
* start: | ||
* _onDragEvent("start", sourceNode, null, event, ui, draggable); | ||
* drag: | ||
* _onDragEvent("leave", prevTargetNode, sourceNode, event, ui, draggable); | ||
* _onDragEvent("over", targetNode, sourceNode, event, ui, draggable); | ||
* _onDragEvent("enter", targetNode, sourceNode, event, ui, draggable); | ||
* stop: | ||
* _onDragEvent("drop", targetNode, sourceNode, event, ui, draggable); | ||
* _onDragEvent("leave", targetNode, sourceNode, event, ui, draggable); | ||
* _onDragEvent("stop", sourceNode, null, event, ui, draggable); | ||
*/ | ||
_onDragEvent: function( | ||
@@ -557,3 +558,3 @@ eventName, | ||
res = null, | ||
that = this, | ||
self = this, | ||
$nodeTag = $(node.span); | ||
@@ -607,5 +608,5 @@ | ||
) { | ||
that.ext.dnd._cancelDrag(); | ||
self.ext.dnd._cancelDrag(); | ||
} else if (event.type === "mousedown") { | ||
that.ext.dnd._cancelDrag(); | ||
self.ext.dnd._cancelDrag(); | ||
} | ||
@@ -612,0 +613,0 @@ } |
@@ -7,3 +7,3 @@ /*! | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -13,4 +13,4 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
@@ -61,2 +61,4 @@ | ||
$dropMarker = null, | ||
$dragImage, | ||
$extraHelper, | ||
SOURCE_NODE = null, | ||
@@ -66,2 +68,6 @@ SOURCE_NODE_LIST = null, | ||
DRAG_ENTER_RESPONSE = null, | ||
// SESSION_DATA = null, // plain object passed to events as `data` | ||
SUGGESTED_DROP_EFFECT = null, | ||
REQUESTED_DROP_EFFECT = null, | ||
REQUESTED_EFFECT_ALLOWED = null, | ||
LAST_HIT_MODE = null, | ||
@@ -72,2 +78,7 @@ DRAG_OVER_STAMP = null; // Time when a node entered the 'over' hitmode | ||
function _clearGlobals() { | ||
DRAG_ENTER_RESPONSE = null; | ||
DRAG_OVER_STAMP = null; | ||
REQUESTED_DROP_EFFECT = null; | ||
REQUESTED_EFFECT_ALLOWED = null; | ||
SUGGESTED_DROP_EFFECT = null; | ||
SOURCE_NODE = null; | ||
@@ -79,4 +90,10 @@ SOURCE_NODE_LIST = null; | ||
$sourceList = null; | ||
DRAG_ENTER_RESPONSE = null; | ||
DRAG_OVER_STAMP = null; | ||
if ($dropMarker) { | ||
$dropMarker.hide(); | ||
} | ||
// Take this badge off of me - I can't use it anymore: | ||
if ($extraHelper) { | ||
$extraHelper.remove(); | ||
$extraHelper = null; | ||
} | ||
} | ||
@@ -86,2 +103,3 @@ | ||
function offsetString(n) { | ||
// eslint-disable-next-line no-nested-ternary | ||
return n === 0 ? "" : n > 0 ? "+" + n : "" + n; | ||
@@ -129,2 +147,21 @@ } | ||
/* Convert a dataTransfer.effectAllowed to a canonical form. | ||
* Return false or plain object | ||
* @param {string|boolean} r | ||
* @return {object|false} | ||
*/ | ||
// function normalizeEffectAllowed(r) { | ||
// if (!r || r === "none") { | ||
// return false; | ||
// } | ||
// var all = r === "all", | ||
// res = { | ||
// copy: all || /copy/i.test(r), | ||
// link: all || /link/i.test(r), | ||
// move: all || /move/i.test(r), | ||
// }; | ||
// return res; | ||
// } | ||
/* Implement auto scrolling when drag cursor is in top/bottom area of scroll parent. */ | ||
@@ -181,3 +218,189 @@ function autoScroll(tree, event) { | ||
/* Handle dragover event (fired every x ms) and return hitMode. */ | ||
/* Guess dropEffect from modifier keys. | ||
* Using rules suggested here: | ||
* https://ux.stackexchange.com/a/83769 | ||
* @returns | ||
* 'copy', 'link', 'move', or 'none' | ||
*/ | ||
function evalEffectModifiers(tree, event, effectDefault) { | ||
var res = effectDefault; | ||
if (isMac) { | ||
if (event.metaKey && event.altKey) { | ||
// Mac: [Control] + [Option] | ||
res = "link"; | ||
} else if (event.ctrlKey) { | ||
// Chrome on Mac: [Control] | ||
res = "link"; | ||
} else if (event.metaKey) { | ||
// Mac: [Command] | ||
res = "move"; | ||
} else if (event.altKey) { | ||
// Mac: [Option] | ||
res = "copy"; | ||
} | ||
} else { | ||
if (event.ctrlKey) { | ||
// Windows: [Ctrl] | ||
res = "copy"; | ||
} else if (event.shiftKey) { | ||
// Windows: [Shift] | ||
res = "move"; | ||
} else if (event.altKey) { | ||
// Windows: [Alt] | ||
res = "link"; | ||
} | ||
} | ||
if (res !== SUGGESTED_DROP_EFFECT) { | ||
tree.info( | ||
"evalEffectModifiers: " + | ||
event.type + | ||
" - evalEffectModifiers(): " + | ||
SUGGESTED_DROP_EFFECT + | ||
" -> " + | ||
res | ||
); | ||
} | ||
SUGGESTED_DROP_EFFECT = res; | ||
// tree.debug("evalEffectModifiers: " + res); | ||
return res; | ||
} | ||
/* | ||
* Check if the previous callback (dragEnter, dragOver, ...) has changed | ||
* the `data` object and apply those settings. | ||
* | ||
* Safari: | ||
* It seems that `dataTransfer.dropEffect` can only be set on dragStart, and will remain | ||
* even if the cursor changes when [Alt] or [Ctrl] are pressed (?) | ||
* Using rules suggested here: | ||
* https://ux.stackexchange.com/a/83769 | ||
* @returns | ||
* 'copy', 'link', 'move', or 'none' | ||
*/ | ||
function prepareDropEffectCallback(event, data) { | ||
var tree = data.tree, | ||
dataTransfer = data.dataTransfer; | ||
if (event.type === "dragstart") { | ||
data.effectAllowed = tree.options.dnd5.effectAllowed; | ||
data.dropEffect = tree.options.dnd5.dropEffectDefault; | ||
} else { | ||
data.effectAllowed = REQUESTED_EFFECT_ALLOWED; | ||
data.dropEffect = REQUESTED_DROP_EFFECT; | ||
} | ||
data.dropEffectSuggested = evalEffectModifiers( | ||
tree, | ||
event, | ||
tree.options.dnd5.dropEffectDefault | ||
); | ||
data.isMove = data.dropEffect === "move"; | ||
data.files = dataTransfer.files || []; | ||
// if (REQUESTED_EFFECT_ALLOWED !== dataTransfer.effectAllowed) { | ||
// tree.warn( | ||
// "prepareDropEffectCallback(" + | ||
// event.type + | ||
// "): dataTransfer.effectAllowed changed from " + | ||
// REQUESTED_EFFECT_ALLOWED + | ||
// " -> " + | ||
// dataTransfer.effectAllowed | ||
// ); | ||
// } | ||
// if (REQUESTED_DROP_EFFECT !== dataTransfer.dropEffect) { | ||
// tree.warn( | ||
// "prepareDropEffectCallback(" + | ||
// event.type + | ||
// "): dataTransfer.dropEffect changed from requested " + | ||
// REQUESTED_DROP_EFFECT + | ||
// " to " + | ||
// dataTransfer.dropEffect | ||
// ); | ||
// } | ||
} | ||
function applyDropEffectCallback(event, data, allowDrop) { | ||
var tree = data.tree, | ||
dataTransfer = data.dataTransfer; | ||
if ( | ||
event.type !== "dragstart" && | ||
REQUESTED_EFFECT_ALLOWED !== data.effectAllowed | ||
) { | ||
tree.warn( | ||
"effectAllowed should only be changed in dragstart event: " + | ||
event.type + | ||
": data.effectAllowed changed from " + | ||
REQUESTED_EFFECT_ALLOWED + | ||
" -> " + | ||
data.effectAllowed | ||
); | ||
} | ||
if (allowDrop === false) { | ||
tree.info("applyDropEffectCallback: allowDrop === false"); | ||
data.effectAllowed = "none"; | ||
data.dropEffect = "none"; | ||
} | ||
// if (REQUESTED_DROP_EFFECT !== data.dropEffect) { | ||
// tree.debug( | ||
// "applyDropEffectCallback(" + | ||
// event.type + | ||
// "): data.dropEffect changed from previous " + | ||
// REQUESTED_DROP_EFFECT + | ||
// " to " + | ||
// data.dropEffect | ||
// ); | ||
// } | ||
data.isMove = data.dropEffect === "move"; | ||
// data.isMove = data.dropEffectSuggested === "move"; | ||
REQUESTED_EFFECT_ALLOWED = data.effectAllowed; | ||
REQUESTED_DROP_EFFECT = data.dropEffect; | ||
// if (REQUESTED_DROP_EFFECT !== dataTransfer.dropEffect) { | ||
// data.tree.info( | ||
// "applyDropEffectCallback(" + | ||
// event.type + | ||
// "): dataTransfer.dropEffect changed from " + | ||
// REQUESTED_DROP_EFFECT + | ||
// " -> " + | ||
// dataTransfer.dropEffect | ||
// ); | ||
// } | ||
dataTransfer.effectAllowed = REQUESTED_EFFECT_ALLOWED; | ||
dataTransfer.dropEffect = REQUESTED_DROP_EFFECT; | ||
// tree.debug( | ||
// "applyDropEffectCallback(" + | ||
// event.type + | ||
// "): set " + | ||
// dataTransfer.dropEffect + | ||
// "/" + | ||
// dataTransfer.effectAllowed | ||
// ); | ||
// if (REQUESTED_DROP_EFFECT !== dataTransfer.dropEffect) { | ||
// data.tree.warn( | ||
// "applyDropEffectCallback(" + | ||
// event.type + | ||
// "): could not set dataTransfer.dropEffect to " + | ||
// REQUESTED_DROP_EFFECT + | ||
// ": got " + | ||
// dataTransfer.dropEffect | ||
// ); | ||
// } | ||
return REQUESTED_DROP_EFFECT; | ||
} | ||
/* Handle dragover event (fired every x ms) on valid drop targets. | ||
* | ||
* - Auto-scroll when cursor is in border regions | ||
* - Apply restrictioan like 'preventVoidMoves' | ||
* - Calculate hit mode | ||
* - Calculate drop effect | ||
* - Trigger dragOver() callback to let user modify hit mode and drop effect | ||
* - Adjust the drop marker accordingly | ||
* | ||
* @returns hitMode | ||
*/ | ||
function handleDragOver(event, data) { | ||
@@ -213,60 +436,55 @@ // Implement auto-scrolling | ||
$.error("assert failed: dragenter returned string"); | ||
// Use hitMode from onEnter if provided. | ||
// hitMode = DRAG_ENTER_RESPONSE; | ||
} else { | ||
// Calculate hitMode from relative cursor position. | ||
nodeOfs = $target.offset(); | ||
relPosY = (event.pageY - nodeOfs.top) / $target.height(); | ||
} | ||
// Calculate hitMode from relative cursor position. | ||
nodeOfs = $target.offset(); | ||
relPosY = (event.pageY - nodeOfs.top) / $target.height(); | ||
if (DRAG_ENTER_RESPONSE.after && relPosY > 0.75) { | ||
hitMode = "after"; | ||
if (DRAG_ENTER_RESPONSE.after && relPosY > 0.75) { | ||
hitMode = "after"; | ||
} else if ( | ||
!DRAG_ENTER_RESPONSE.over && | ||
DRAG_ENTER_RESPONSE.after && | ||
relPosY > 0.5 | ||
) { | ||
hitMode = "after"; | ||
} else if (DRAG_ENTER_RESPONSE.before && relPosY <= 0.25) { | ||
hitMode = "before"; | ||
} else if ( | ||
!DRAG_ENTER_RESPONSE.over && | ||
DRAG_ENTER_RESPONSE.before && | ||
relPosY <= 0.5 | ||
) { | ||
hitMode = "before"; | ||
} else if (DRAG_ENTER_RESPONSE.over) { | ||
hitMode = "over"; | ||
} | ||
// Prevent no-ops like 'before source node' | ||
// TODO: these are no-ops when moving nodes, but not in copy mode | ||
if (dndOpts.preventVoidMoves && data.dropEffect === "move") { | ||
if (targetNode === sourceNode) { | ||
targetNode.debug("Drop over source node prevented."); | ||
hitMode = null; | ||
} else if ( | ||
!DRAG_ENTER_RESPONSE.over && | ||
DRAG_ENTER_RESPONSE.after && | ||
relPosY > 0.5 | ||
hitMode === "before" && | ||
sourceNode && | ||
targetNode === sourceNode.getNextSibling() | ||
) { | ||
hitMode = "after"; | ||
} else if (DRAG_ENTER_RESPONSE.before && relPosY <= 0.25) { | ||
hitMode = "before"; | ||
targetNode.debug("Drop after source node prevented."); | ||
hitMode = null; | ||
} else if ( | ||
!DRAG_ENTER_RESPONSE.over && | ||
DRAG_ENTER_RESPONSE.before && | ||
relPosY <= 0.5 | ||
hitMode === "after" && | ||
sourceNode && | ||
targetNode === sourceNode.getPrevSibling() | ||
) { | ||
hitMode = "before"; | ||
} else if (DRAG_ENTER_RESPONSE.over) { | ||
hitMode = "over"; | ||
targetNode.debug("Drop before source node prevented."); | ||
hitMode = null; | ||
} else if ( | ||
hitMode === "over" && | ||
sourceNode && | ||
sourceNode.parent === targetNode && | ||
sourceNode.isLastSibling() | ||
) { | ||
targetNode.debug("Drop last child over own parent prevented."); | ||
hitMode = null; | ||
} | ||
// Prevent no-ops like 'before source node' | ||
// TODO: these are no-ops when moving nodes, but not in copy mode | ||
if (dndOpts.preventVoidMoves) { | ||
if (targetNode === sourceNode) { | ||
targetNode.debug("Drop over source node prevented."); | ||
hitMode = null; | ||
} else if ( | ||
hitMode === "before" && | ||
sourceNode && | ||
targetNode === sourceNode.getNextSibling() | ||
) { | ||
targetNode.debug("Drop after source node prevented."); | ||
hitMode = null; | ||
} else if ( | ||
hitMode === "after" && | ||
sourceNode && | ||
targetNode === sourceNode.getPrevSibling() | ||
) { | ||
targetNode.debug("Drop before source node prevented."); | ||
hitMode = null; | ||
} else if ( | ||
hitMode === "over" && | ||
sourceNode && | ||
sourceNode.parent === targetNode && | ||
sourceNode.isLastSibling() | ||
) { | ||
targetNode.debug( | ||
"Drop last child over own parent prevented." | ||
); | ||
hitMode = null; | ||
} | ||
} | ||
} | ||
@@ -276,8 +494,8 @@ // Let callback modify the calculated hitMode | ||
if (hitMode && dndOpts.dragOver) { | ||
// TODO: http://code.google.com/p/dynatree/source/detail?r=625 | ||
prepareDropEffectCallback(event, data); | ||
dndOpts.dragOver(targetNode, data); | ||
var allowDrop = !!hitMode; | ||
applyDropEffectCallback(event, data, allowDrop); | ||
hitMode = data.hitMode; | ||
} | ||
// LAST_DROP_EFFECT = data.dataTransfer.dropEffect; | ||
// LAST_EFFECT_ALLOWED = data.dataTransfer.effectAllowed; | ||
LAST_HIT_MODE = hitMode; | ||
@@ -334,48 +552,468 @@ // | ||
/* Guess dropEffect from modifier keys. | ||
* Safari: | ||
* It seems that `dataTransfer.dropEffect` can only be set on dragStart, and will remain | ||
* even if the cursor changes when [Alt] or [Ctrl] are pressed (?) | ||
* Using rules suggested here: | ||
* https://ux.stackexchange.com/a/83769 | ||
* @returns | ||
* 'copy', 'link', 'move', or 'none' | ||
/* | ||
* Handle dragstart drag dragend events on the container | ||
*/ | ||
function getDropEffect(event, data) { | ||
var dndOpts = data.options.dnd5, | ||
res = dndOpts.dropEffectDefault; | ||
// dataTransfer = event.dataTransfer || event.originalEvent.dataTransfer, | ||
function onDragEvent(event) { | ||
var json, | ||
tree = this, | ||
dndOpts = tree.options.dnd5, | ||
node = FT.getNode(event), | ||
dataTransfer = | ||
event.dataTransfer || event.originalEvent.dataTransfer, | ||
data = { | ||
tree: tree, | ||
node: node, | ||
options: tree.options, | ||
originalEvent: event.originalEvent, | ||
widget: tree.widget, | ||
dataTransfer: dataTransfer, | ||
useDefaultImage: true, | ||
dropEffect: undefined, | ||
dropEffectSuggested: undefined, | ||
effectAllowed: undefined, // set by dragstart | ||
files: undefined, // only for drop events | ||
isCancelled: undefined, // set by dragend | ||
isMove: undefined, | ||
}; | ||
// Use callback if any: | ||
if (dndOpts.dropEffect) { | ||
return dndOpts.dropEffect(event, data); | ||
switch (event.type) { | ||
case "dragstart": | ||
if (!node) { | ||
tree.info("Ignored dragstart on a non-node."); | ||
return false; | ||
} | ||
// Store current source node in different formats | ||
SOURCE_NODE = node; | ||
// Also optionally store selected nodes | ||
if (dndOpts.multiSource === false) { | ||
SOURCE_NODE_LIST = [node]; | ||
} else if (dndOpts.multiSource === true) { | ||
SOURCE_NODE_LIST = tree.getSelectedNodes(); | ||
if (!node.isSelected()) { | ||
SOURCE_NODE_LIST.unshift(node); | ||
} | ||
} else { | ||
SOURCE_NODE_LIST = dndOpts.multiSource(node, data); | ||
} | ||
// Cache as array of jQuery objects for faster access: | ||
$sourceList = $( | ||
$.map(SOURCE_NODE_LIST, function(n) { | ||
return n.span; | ||
}) | ||
); | ||
// Set visual feedback | ||
$sourceList.addClass(classDragSource); | ||
// Set payload | ||
// Note: | ||
// Transfer data is only accessible on dragstart and drop! | ||
// For all other events the formats and kinds in the drag | ||
// data store list of items representing dragged data can be | ||
// enumerated, but the data itself is unavailable and no new | ||
// data can be added. | ||
var nodeData = node.toDict(); | ||
nodeData.treeId = node.tree._id; | ||
json = JSON.stringify(nodeData); | ||
try { | ||
dataTransfer.setData(nodeMimeType, json); | ||
dataTransfer.setData("text/html", $(node.span).html()); | ||
dataTransfer.setData("text/plain", node.title); | ||
} catch (ex) { | ||
// IE only accepts 'text' type | ||
tree.warn( | ||
"Could not set data (IE only accepts 'text') - " + ex | ||
); | ||
} | ||
// We always need to set the 'text' type if we want to drag | ||
// Because IE 11 only accepts this single type. | ||
// If we pass JSON here, IE can can access all node properties, | ||
// even when the source lives in another window. (D'n'd inside | ||
// the same window will always work.) | ||
// The drawback is, that in this case ALL browsers will see | ||
// the JSON representation as 'text', so dragging | ||
// to a text field will insert the JSON string instead of | ||
// the node title. | ||
if (dndOpts.setTextTypeJson) { | ||
dataTransfer.setData("text", json); | ||
} else { | ||
dataTransfer.setData("text", node.title); | ||
} | ||
// Set the allowed drag modes (combinations of move, copy, and link) | ||
// (effectAllowed can only be set in the dragstart event.) | ||
// This can be overridden in the dragStart() callback | ||
prepareDropEffectCallback(event, data); | ||
// Let user cancel or modify above settings | ||
// Realize potential changes by previous callback | ||
if (dndOpts.dragStart(node, data) === false) { | ||
// Cancel dragging | ||
// dataTransfer.dropEffect = "none"; | ||
_clearGlobals(); | ||
return false; | ||
} | ||
applyDropEffectCallback(event, data); | ||
// Unless user set `data.useDefaultImage` to false in dragStart, | ||
// generata a default drag image now: | ||
$extraHelper = null; | ||
if (data.useDefaultImage) { | ||
// Set the title as drag image (otherwise it would contain the expander) | ||
$dragImage = $(node.span).find(".fancytree-title"); | ||
if (SOURCE_NODE_LIST && SOURCE_NODE_LIST.length > 1) { | ||
// Add a counter badge to node title if dragging more than one node. | ||
// We want this, because the element that is used as drag image | ||
// must be *visible* in the DOM, so we cannot create some hidden | ||
// custom markup. | ||
// See https://kryogenix.org/code/browser/custom-drag-image.html | ||
// Also, since IE 11 and Edge don't support setDragImage() alltogether, | ||
// it gives som feedback to the user. | ||
// The badge will be removed later on drag end. | ||
$extraHelper = $( | ||
"<span class='fancytree-childcounter'/>" | ||
) | ||
.text("+" + (SOURCE_NODE_LIST.length - 1)) | ||
.appendTo($dragImage); | ||
} | ||
if (dataTransfer.setDragImage) { | ||
// IE 11 and Edge do not support this | ||
dataTransfer.setDragImage($dragImage[0], -10, -10); | ||
} | ||
} | ||
return true; | ||
case "drag": | ||
// Called every few milliseconds (no matter if the | ||
// cursor is over a valid drop target) | ||
// data.tree.info("drag", SOURCE_NODE) | ||
prepareDropEffectCallback(event, data); | ||
dndOpts.dragDrag(node, data); | ||
applyDropEffectCallback(event, data); | ||
$sourceList.toggleClass(classDragRemove, data.isMove); | ||
break; | ||
case "dragend": | ||
// Called at the end of a d'n'd process (after drop) | ||
// Note caveat: If drop removed the dragged source element, | ||
// we may not get this event, since the target does not exist | ||
// anymore | ||
prepareDropEffectCallback(event, data); | ||
_clearGlobals(); | ||
data.isCancelled = !LAST_HIT_MODE; | ||
dndOpts.dragEnd(node, data, !LAST_HIT_MODE); | ||
// applyDropEffectCallback(event, data); | ||
break; | ||
} | ||
} | ||
/* | ||
* Handle dragenter dragover dragleave drop events on the container | ||
*/ | ||
function onDropEvent(event) { | ||
var json, | ||
nodeData, | ||
isSourceFtNode, | ||
r, | ||
res, | ||
tree = this, | ||
dndOpts = tree.options.dnd5, | ||
allowDrop = null, | ||
node = FT.getNode(event), | ||
dataTransfer = | ||
event.dataTransfer || event.originalEvent.dataTransfer, | ||
data = { | ||
tree: tree, | ||
node: node, | ||
options: tree.options, | ||
originalEvent: event.originalEvent, | ||
widget: tree.widget, | ||
hitMode: DRAG_ENTER_RESPONSE, | ||
dataTransfer: dataTransfer, | ||
otherNode: SOURCE_NODE || null, | ||
otherNodeList: SOURCE_NODE_LIST || null, | ||
otherNodeData: null, // set by drop event | ||
useDefaultImage: true, | ||
dropEffect: undefined, | ||
dropEffectSuggested: undefined, | ||
effectAllowed: undefined, // set by dragstart | ||
files: null, // list of File objects (may be []) | ||
isCancelled: undefined, // set by drop event | ||
isMove: undefined, | ||
}; | ||
if (isMac) { | ||
if (event.metaKey && event.altKey) { | ||
// Mac: [Control] + [Option] | ||
return "link"; | ||
} else if (event.metaKey) { | ||
// Mac: [Command] | ||
return "move"; | ||
} else if (event.altKey) { | ||
// Mac: [Option] | ||
return "copy"; | ||
} | ||
} else { | ||
if (event.ctrlKey) { | ||
// Windows: [Ctrl] | ||
return "copy"; | ||
} else if (event.shiftKey) { | ||
// Windows: [Shift] | ||
return "move"; | ||
} else if (event.altKey) { | ||
// Windows: [Alt] | ||
return "link"; | ||
} | ||
// data.isMove = dropEffect === "move"; | ||
switch (event.type) { | ||
case "dragenter": | ||
// The dragenter event is fired when a dragged element or | ||
// text selection enters a valid drop target. | ||
DRAG_OVER_STAMP = null; | ||
if (!node) { | ||
// Sometimes we get dragenter for the container element | ||
tree.debug( | ||
"Ignore non-node " + | ||
event.type + | ||
": " + | ||
event.target.tagName + | ||
"." + | ||
event.target.className | ||
); | ||
DRAG_ENTER_RESPONSE = false; | ||
break; | ||
} | ||
$(node.span) | ||
.addClass(classDropOver) | ||
.removeClass(classDropAccept + " " + classDropReject); | ||
// Data is only readable in the dragstart and drop event, | ||
// but we can check for the type: | ||
isSourceFtNode = | ||
$.inArray(nodeMimeType, dataTransfer.types) >= 0; | ||
if (dndOpts.preventNonNodes && !isSourceFtNode) { | ||
node.debug("Reject dropping a non-node."); | ||
DRAG_ENTER_RESPONSE = false; | ||
break; | ||
} else if ( | ||
dndOpts.preventForeignNodes && | ||
(!SOURCE_NODE || SOURCE_NODE.tree !== node.tree) | ||
) { | ||
node.debug("Reject dropping a foreign node."); | ||
DRAG_ENTER_RESPONSE = false; | ||
break; | ||
} else if ( | ||
dndOpts.preventSameParent && | ||
data.otherNode && | ||
data.otherNode.tree === node.tree && | ||
node.parent === data.otherNode.parent | ||
) { | ||
node.debug("Reject dropping as sibling (same parent)."); | ||
DRAG_ENTER_RESPONSE = false; | ||
break; | ||
} else if ( | ||
dndOpts.preventRecursion && | ||
data.otherNode && | ||
data.otherNode.tree === node.tree && | ||
node.isDescendantOf(data.otherNode) | ||
) { | ||
node.debug("Reject dropping below own ancestor."); | ||
DRAG_ENTER_RESPONSE = false; | ||
break; | ||
} | ||
$dropMarker.show(); | ||
// Call dragEnter() to figure out if (and where) dropping is allowed | ||
prepareDropEffectCallback(event, data); | ||
r = dndOpts.dragEnter(node, data); | ||
res = normalizeDragEnterResponse(r); | ||
DRAG_ENTER_RESPONSE = res; | ||
allowDrop = res && (res.over || res.before || res.after); | ||
applyDropEffectCallback(event, data, allowDrop); | ||
break; | ||
case "dragover": | ||
if (!node) { | ||
tree.debug( | ||
"Ignore non-node " + | ||
event.type + | ||
": " + | ||
event.target.tagName + | ||
"." + | ||
event.target.className | ||
); | ||
break; | ||
} | ||
// The dragover event is fired when an element or text | ||
// selection is being dragged over a valid drop target | ||
// (every few hundred milliseconds). | ||
// tree.debug( | ||
// event.type + | ||
// ": dropEffect: " + | ||
// dataTransfer.dropEffect | ||
// ); | ||
LAST_HIT_MODE = handleDragOver(event, data); | ||
// The flag controls the preventDefault() below: | ||
allowDrop = !!LAST_HIT_MODE; | ||
if ( | ||
LAST_HIT_MODE === "over" && | ||
!node.expanded && | ||
node.hasChildren() !== false | ||
) { | ||
if (!DRAG_OVER_STAMP) { | ||
DRAG_OVER_STAMP = Date.now(); | ||
} else if ( | ||
dndOpts.autoExpandMS && | ||
Date.now() - DRAG_OVER_STAMP > dndOpts.autoExpandMS && | ||
(!dndOpts.dragExpand || | ||
dndOpts.dragExpand(node, data) !== false) | ||
) { | ||
node.setExpanded(); | ||
} | ||
} else { | ||
DRAG_OVER_STAMP = null; | ||
} | ||
break; | ||
case "dragleave": | ||
// NOTE: dragleave is fired AFTER the dragenter event of the | ||
// FOLLOWING element. | ||
if (!node) { | ||
tree.debug( | ||
"Ignore non-node " + | ||
event.type + | ||
": " + | ||
event.target.tagName + | ||
"." + | ||
event.target.className | ||
); | ||
break; | ||
} | ||
if (!$(node.span).hasClass(classDropOver)) { | ||
node.debug("Ignore dragleave (multi)."); | ||
break; | ||
} | ||
$(node.span).removeClass( | ||
classDropOver + | ||
" " + | ||
classDropAccept + | ||
" " + | ||
classDropReject | ||
); | ||
node.scheduleAction("cancel"); | ||
dndOpts.dragLeave(node, data); | ||
$dropMarker.hide(); | ||
break; | ||
case "drop": | ||
// Data is only readable in the (dragstart and) drop event: | ||
if ($.inArray(nodeMimeType, dataTransfer.types) >= 0) { | ||
nodeData = dataTransfer.getData(nodeMimeType); | ||
tree.info( | ||
event.type + | ||
": getData('application/x-fancytree-node'): '" + | ||
nodeData + | ||
"'" | ||
); | ||
} | ||
if (!nodeData) { | ||
// 1. Source is not a Fancytree node, or | ||
// 2. If the FT mime type was set, but returns '', this | ||
// is probably IE 11 (which only supports 'text') | ||
nodeData = dataTransfer.getData("text"); | ||
tree.info( | ||
event.type + ": getData('text'): '" + nodeData + "'" | ||
); | ||
} | ||
if (nodeData) { | ||
try { | ||
// 'text' type may contain JSON if IE is involved | ||
// and setTextTypeJson option was set | ||
json = JSON.parse(nodeData); | ||
if (json.title !== undefined) { | ||
data.otherNodeData = json; | ||
} | ||
} catch (ex) { | ||
// assume 'text' type contains plain text, so `otherNodeData` | ||
// should not be set | ||
} | ||
} | ||
tree.debug( | ||
event.type + | ||
": nodeData: '" + | ||
nodeData + | ||
"', otherNodeData: ", | ||
data.otherNodeData | ||
); | ||
$(node.span).removeClass( | ||
classDropOver + | ||
" " + | ||
classDropAccept + | ||
" " + | ||
classDropReject | ||
); | ||
// Let user implement the actual drop operation | ||
data.hitMode = LAST_HIT_MODE; | ||
prepareDropEffectCallback(event, data, !LAST_HIT_MODE); | ||
data.isCancelled = !LAST_HIT_MODE; | ||
var orgSourceElem = SOURCE_NODE && SOURCE_NODE.span, | ||
orgSourceTree = SOURCE_NODE && SOURCE_NODE.tree; | ||
dndOpts.dragDrop(node, data); | ||
// applyDropEffectCallback(event, data); | ||
// Prevent browser's default drop handling, i.e. open as link, ... | ||
event.preventDefault(); | ||
if (orgSourceElem && !document.body.contains(orgSourceElem)) { | ||
// The drop handler removed the original drag source from | ||
// the DOM, so the dragend event will probaly not fire. | ||
if (orgSourceTree === tree) { | ||
tree.debug( | ||
"Drop handler removed source element: generating dragEnd." | ||
); | ||
dndOpts.dragEnd(SOURCE_NODE, data); | ||
} else { | ||
tree.warn( | ||
"Drop handler removed source element: dragend event may be lost." | ||
); | ||
} | ||
} | ||
_clearGlobals(); | ||
break; | ||
} | ||
// data.tree.debug("getDropEffect: " + res); | ||
return res; | ||
// Dnd API madness: we must PREVENT default handling to enable dropping | ||
if (allowDrop) { | ||
event.preventDefault(); | ||
return false; | ||
} | ||
} | ||
/** [ext-dnd5] Return a Fancytree instance, from element, index, event, or jQueryObject. | ||
* | ||
* @returns {FancytreeNode[]} List of nodes (empty if no drag operation) | ||
* @example | ||
* $.ui.fancytree.getDragNodeList(); | ||
* | ||
* @alias Fancytree_Static#getDragNodeList | ||
* @requires jquery.fancytree.dnd5.js | ||
* @since 2.31 | ||
*/ | ||
$.ui.fancytree.getDragNodeList = function() { | ||
return SOURCE_NODE_LIST || []; | ||
}; | ||
/** [ext-dnd5] Return the FancytreeNode that is currently being dragged. | ||
* | ||
* If multiple nodes are dragged, only the first is returned. | ||
* | ||
* @returns {FancytreeNode | null} dragged nodes or null if no drag operation | ||
* @example | ||
* $.ui.fancytree.getDragNode(); | ||
* | ||
* @alias Fancytree_Static#getDragNode | ||
* @requires jquery.fancytree.dnd5.js | ||
* @since 2.31 | ||
*/ | ||
$.ui.fancytree.getDragNode = function() { | ||
return SOURCE_NODE; | ||
}; | ||
/****************************************************************************** | ||
@@ -387,3 +1025,3 @@ * | ||
name: "dnd5", | ||
version: "2.30.2", | ||
version: "2.31.0", | ||
// Default options for this extension. | ||
@@ -394,9 +1032,10 @@ options: { | ||
dropMarkerOffsetX: -24, // Absolute position offset for .fancytree-drop-marker relatively to ..fancytree-title (icon/img near a node accepting drop) | ||
multiSource: false, // true: Drag multiple (i.e. selected) nodes. | ||
dragImage: null, // Callback(node, data) that can be used to call dataTransfer.setDragImage(). | ||
dropEffect: null, // Callback(node, data) that returns 'copy', 'link', 'move', or 'none'. | ||
dropEffectDefault: "move", // Default dropEffect ('copy', 'link', or 'move'). | ||
multiSource: false, // true: Drag multiple (i.e. selected) nodes. Also a callback() is allowed | ||
effectAllowed: "all", // Restrict the possible cursor shapes and modifier operations (can also be set in the dragStart event) | ||
// dropEffect: "auto", // 'copy'|'link'|'move'|'auto'(calculate from `effectAllowed`+modifier keys) or callback(node, data) that returns such string. | ||
dropEffectDefault: "move", // Default dropEffect ('copy', 'link', or 'move') when no modifier is pressed (overide in dragDrag, dragOver). | ||
preventForeignNodes: false, // Prevent dropping nodes from different Fancytrees | ||
preventNonNodes: false, // Prevent dropping items other than Fancytree nodes | ||
preventRecursiveMoves: true, // Prevent dropping nodes on own descendants | ||
preventRecursion: true, // Prevent dropping nodes on own descendants | ||
preventSameParent: false, // Prevent dropping nodes under same direct parent | ||
preventVoidMoves: true, // Prevent dropping nodes 'before self', etc. | ||
@@ -420,10 +1059,7 @@ scroll: true, // Enable auto-scrolling while dragging | ||
treeInit: function(ctx) { | ||
var $dragImage, | ||
$extraHelper, | ||
$temp, | ||
var $temp, | ||
tree = ctx.tree, | ||
opts = ctx.options, | ||
glyph = opts.glyph || null, | ||
dndOpts = opts.dnd5, | ||
getNode = FT.getNode; | ||
dndOpts = opts.dnd5; | ||
@@ -438,2 +1074,7 @@ if ($.inArray("dnd", opts.extensions) >= 0) { | ||
} | ||
if (dndOpts.preventRecursiveMoves != null) { | ||
$.error( | ||
"preventRecursiveMoves was renamed to preventRecursion." | ||
); | ||
} | ||
@@ -449,3 +1090,7 @@ // Implement `opts.createNode` event to add the 'draggable' attribute | ||
this._super.apply(this, arguments); | ||
data.node.span.draggable = true; | ||
if (data.node.span) { | ||
data.node.span.draggable = true; | ||
} else { | ||
data.node.warn("Cannot add `draggable`: no span tag"); | ||
} | ||
}); | ||
@@ -480,171 +1125,13 @@ } | ||
); | ||
// $dropMarker.addClass(glyph.map._addClass + " " + glyph.map.dropMarker); | ||
} | ||
} | ||
$dropMarker.toggleClass("fancytree-rtl", !!opts.rtl); | ||
// Enable drag support if dragStart() is specified: | ||
if (dndOpts.dragStart) { | ||
// Bind drag event handlers | ||
tree.$container.on("dragstart drag dragend", function(event) { | ||
var json, | ||
node = getNode(event), | ||
dataTransfer = | ||
event.dataTransfer || | ||
event.originalEvent.dataTransfer, | ||
data = { | ||
node: node, | ||
tree: tree, | ||
options: tree.options, | ||
originalEvent: event, | ||
dataTransfer: dataTransfer, | ||
// dropEffect: undefined, // set by dragend | ||
isCancelled: undefined, // set by dragend | ||
}, | ||
dropEffect = getDropEffect(event, data), | ||
isMove = dropEffect === "move"; | ||
// console.log(event.type, "dropEffect: " + dropEffect); | ||
switch (event.type) { | ||
case "dragstart": | ||
if (!node) { | ||
tree.info("Ignored dragstart on a non-node."); | ||
return false; | ||
} | ||
// Store current source node in different formats | ||
SOURCE_NODE = node; | ||
// Also optionally store selected nodes | ||
if (dndOpts.multiSource === false) { | ||
SOURCE_NODE_LIST = [node]; | ||
} else if (dndOpts.multiSource === true) { | ||
SOURCE_NODE_LIST = tree.getSelectedNodes(); | ||
if (!node.isSelected()) { | ||
SOURCE_NODE_LIST.unshift(node); | ||
} | ||
} else { | ||
SOURCE_NODE_LIST = dndOpts.multiSource( | ||
node, | ||
data | ||
); | ||
} | ||
// Cache as array of jQuery objects for faster access: | ||
$sourceList = $( | ||
$.map(SOURCE_NODE_LIST, function(n) { | ||
return n.span; | ||
}) | ||
); | ||
// Set visual feedback | ||
$sourceList.addClass(classDragSource); | ||
// Set payload | ||
// Note: | ||
// Transfer data is only accessible on dragstart and drop! | ||
// For all other events the formats and kinds in the drag | ||
// data store list of items representing dragged data can be | ||
// enumerated, but the data itself is unavailable and no new | ||
// data can be added. | ||
json = JSON.stringify(node.toDict()); | ||
try { | ||
dataTransfer.setData(nodeMimeType, json); | ||
dataTransfer.setData( | ||
"text/html", | ||
$(node.span).html() | ||
); | ||
dataTransfer.setData("text/plain", node.title); | ||
} catch (ex) { | ||
// IE only accepts 'text' type | ||
tree.warn( | ||
"Could not set data (IE only accepts 'text') - " + | ||
ex | ||
); | ||
} | ||
// We always need to set the 'text' type if we want to drag | ||
// Because IE 11 only accepts this single type. | ||
// If we pass JSON here, IE can can access all node properties, | ||
// even when the source lives in another window. (D'n'd inside | ||
// the same window will always work.) | ||
// The drawback is, that in this case ALL browsers will see | ||
// the JSON representation as 'text', so dragging | ||
// to a text field will insert the JSON string instead of | ||
// the node title. | ||
if (dndOpts.setTextTypeJson) { | ||
dataTransfer.setData("text", json); | ||
} else { | ||
dataTransfer.setData("text", node.title); | ||
} | ||
// Set the allowed and current drag mode (move, copy, or link) | ||
dataTransfer.effectAllowed = "all"; // "copyMove" | ||
// dropEffect = "move"; | ||
$extraHelper = null; | ||
if (dndOpts.dragImage) { | ||
// Let caller set a custom drag image using dataTransfer.setDragImage() | ||
// and/or modify visual feedback otherwise. | ||
dndOpts.dragImage(node, data); | ||
} else { | ||
// Set the title as drag image (otherwise it would contain the expander) | ||
$dragImage = $(node.span).find( | ||
".fancytree-title" | ||
); | ||
if ( | ||
SOURCE_NODE_LIST && | ||
SOURCE_NODE_LIST.length > 1 | ||
) { | ||
// Add a counter badge to node title if dragging more than one node. | ||
// We want this, because the element that is used as drag image | ||
// must be *visible* in the DOM, so we cannot create some hidden | ||
// custom markup. | ||
// See https://kryogenix.org/code/browser/custom-drag-image.html | ||
// Also, since IE 11 and Edge don't support setDragImage() alltogether, | ||
// it gives som feedback to the user. | ||
// The badge will be removed later on drag end. | ||
$extraHelper = $( | ||
"<span class='fancytree-childcounter'/>" | ||
) | ||
.text( | ||
"+" + (SOURCE_NODE_LIST.length - 1) | ||
) | ||
.appendTo($dragImage); | ||
} | ||
if (dataTransfer.setDragImage) { | ||
// IE 11 and Edge do not support this | ||
dataTransfer.setDragImage( | ||
$dragImage[0], | ||
-10, | ||
-10 | ||
); | ||
} | ||
} | ||
// Let user modify above settings | ||
if (dndOpts.dragStart(node, data) !== false) { | ||
return true; | ||
} | ||
// Clear dragged node to be safe | ||
_clearGlobals(); | ||
return false; | ||
case "drag": | ||
// Called every few miliseconds | ||
// data.tree.info("drag", SOURCE_NODE) | ||
$sourceList.toggleClass(classDragRemove, isMove); | ||
dndOpts.dragDrag(node, data); | ||
break; | ||
case "dragend": | ||
_clearGlobals(); | ||
// data.dropEffect = dropEffect; | ||
data.isCancelled = dropEffect === "none"; | ||
$dropMarker.hide(); | ||
// Take this badge off of me - I can't use it anymore: | ||
if ($extraHelper) { | ||
$extraHelper.remove(); | ||
$extraHelper = null; | ||
} | ||
dndOpts.dragEnd(node, data); | ||
break; | ||
} | ||
}); | ||
tree.$container.on( | ||
"dragstart drag dragend", | ||
onDragEvent.bind(tree) | ||
); | ||
} | ||
@@ -656,270 +1143,3 @@ // Enable drop support if dragEnter() is specified: | ||
"dragenter dragover dragleave drop", | ||
function(event) { | ||
var json, | ||
nodeData, | ||
isSourceFtNode, | ||
r, | ||
res, | ||
allowDrop = null, | ||
node = getNode(event), | ||
dataTransfer = | ||
event.dataTransfer || | ||
event.originalEvent.dataTransfer, | ||
// dropEffect = getDropEffect(dataTransfer, opts), | ||
data = { | ||
node: node, | ||
tree: tree, | ||
options: tree.options, | ||
hitMode: DRAG_ENTER_RESPONSE, | ||
originalEvent: event, | ||
dataTransfer: dataTransfer, | ||
otherNode: SOURCE_NODE || null, | ||
otherNodeList: SOURCE_NODE_LIST || null, | ||
otherNodeData: null, // set by drop event | ||
dropEffect: undefined, // set by drop event | ||
isCancelled: undefined, // set by drop event | ||
}; | ||
switch (event.type) { | ||
case "dragenter": | ||
// The dragenter event is fired when a dragged element or | ||
// text selection enters a valid drop target. | ||
DRAG_OVER_STAMP = null; | ||
if (!node) { | ||
// Sometimes we get dragenter for the container element | ||
tree.debug( | ||
"Ignore non-node " + | ||
event.type + | ||
": " + | ||
event.target.tagName + | ||
"." + | ||
event.target.className | ||
); | ||
DRAG_ENTER_RESPONSE = false; | ||
break; | ||
} | ||
$(node.span) | ||
.addClass(classDropOver) | ||
.removeClass( | ||
classDropAccept + " " + classDropReject | ||
); | ||
// Data is only readable in the dragstart and drop event, | ||
// but we can check for the type: | ||
isSourceFtNode = | ||
$.inArray( | ||
nodeMimeType, | ||
dataTransfer.types | ||
) >= 0; | ||
if ( | ||
dndOpts.preventNonNodes && | ||
!isSourceFtNode | ||
) { | ||
node.debug("Reject dropping a non-node."); | ||
DRAG_ENTER_RESPONSE = false; | ||
break; | ||
} else if ( | ||
dndOpts.preventForeignNodes && | ||
(!SOURCE_NODE || | ||
SOURCE_NODE.tree !== node.tree) | ||
) { | ||
node.debug( | ||
"Reject dropping a foreign node." | ||
); | ||
DRAG_ENTER_RESPONSE = false; | ||
break; | ||
} | ||
$dropMarker.show(); | ||
// Call dragEnter() to figure out if (and where) dropping is allowed | ||
if ( | ||
dndOpts.preventRecursiveMoves && | ||
node.isDescendantOf(data.otherNode) | ||
) { | ||
node.debug( | ||
"Reject dropping below own ancestor." | ||
); | ||
res = false; | ||
} else { | ||
r = dndOpts.dragEnter(node, data); | ||
res = normalizeDragEnterResponse(r); | ||
} | ||
DRAG_ENTER_RESPONSE = res; | ||
allowDrop = | ||
res && | ||
(res.over || res.before || res.after); | ||
break; | ||
case "dragover": | ||
if (!node) { | ||
tree.debug( | ||
"Ignore non-node " + | ||
event.type + | ||
": " + | ||
event.target.tagName + | ||
"." + | ||
event.target.className | ||
); | ||
break; | ||
} | ||
// The dragover event is fired when an element or text | ||
// selection is being dragged over a valid drop target | ||
// (every few hundred milliseconds). | ||
// console.log(event.type, "dropEffect: " + dataTransfer.dropEffect) | ||
LAST_HIT_MODE = handleDragOver(event, data); | ||
allowDrop = !!LAST_HIT_MODE; | ||
// console.log(event.type, LAST_HIT_MODE, DRAG_OVER_STAMP) | ||
if ( | ||
LAST_HIT_MODE === "over" && | ||
!node.expanded && | ||
node.hasChildren() !== false | ||
) { | ||
if (!DRAG_OVER_STAMP) { | ||
DRAG_OVER_STAMP = Date.now(); | ||
} else if ( | ||
dndOpts.autoExpandMS && | ||
Date.now() - DRAG_OVER_STAMP > | ||
dndOpts.autoExpandMS && | ||
(!dndOpts.dragExpand || | ||
dndOpts.dragExpand(node, data) !== | ||
false) | ||
) { | ||
node.setExpanded(); | ||
} | ||
} else { | ||
DRAG_OVER_STAMP = null; | ||
} | ||
// // NOTE: dragenter is fired BEFORE the dragleave event | ||
// // of the previous element! | ||
// // https://www.w3.org/Bugs/Public/show_bug.cgi?id=19041 | ||
// setTimeout(function(){ | ||
// node.info("DELAYED " + event.type, event.target, DRAG_ENTER_RESPONSE); | ||
// // Auto-expand node (only when 'over' the node, not 'before', or 'after') | ||
// if( dndOpts.autoExpandMS && | ||
// node.hasChildren() !== false && !node.expanded && | ||
// (!dndOpts.dragExpand || dndOpts.dragExpand(node, data) !== false) | ||
// // res.over | ||
// ) { | ||
// node.scheduleAction("expand", dndOpts.autoExpandMS); | ||
// } | ||
// }, 0); | ||
break; | ||
case "dragleave": | ||
// NOTE: dragleave is fired AFTER the dragenter event of the | ||
// FOLLOWING element. | ||
if (!node) { | ||
tree.debug( | ||
"Ignore non-node " + | ||
event.type + | ||
": " + | ||
event.target.tagName + | ||
"." + | ||
event.target.className | ||
); | ||
break; | ||
} | ||
if (!$(node.span).hasClass(classDropOver)) { | ||
node.debug("Ignore dragleave (multi)."); | ||
break; | ||
} | ||
$(node.span).removeClass( | ||
classDropOver + | ||
" " + | ||
classDropAccept + | ||
" " + | ||
classDropReject | ||
); | ||
node.scheduleAction("cancel"); | ||
dndOpts.dragLeave(node, data); | ||
$dropMarker.hide(); | ||
break; | ||
case "drop": | ||
// Data is only readable in the (dragstart and) drop event: | ||
if ( | ||
$.inArray( | ||
nodeMimeType, | ||
dataTransfer.types | ||
) >= 0 | ||
) { | ||
nodeData = dataTransfer.getData( | ||
nodeMimeType | ||
); | ||
tree.info( | ||
event.type + | ||
": getData('application/x-fancytree-node'): '" + | ||
nodeData + | ||
"'" | ||
); | ||
} | ||
if (!nodeData) { | ||
// 1. Source is not a Fancytree node, or | ||
// 2. If the FT mime type was set, but returns '', this | ||
// is probably IE 11 (which only supports 'text') | ||
nodeData = dataTransfer.getData("text"); | ||
tree.info( | ||
event.type + | ||
": getData('text'): '" + | ||
nodeData + | ||
"'" | ||
); | ||
} | ||
if (nodeData) { | ||
try { | ||
// 'text' type may contain JSON if IE is involved | ||
// and setTextTypeJson option was set | ||
json = JSON.parse(nodeData); | ||
if (json.title !== undefined) { | ||
data.otherNodeData = json; | ||
} | ||
} catch (ex) { | ||
// assume 'text' type contains plain text, so `otherNodeData` | ||
// should not be set | ||
} | ||
} | ||
tree.debug( | ||
event.type + | ||
": nodeData: '" + | ||
nodeData + | ||
"', otherNodeData: ", | ||
data.otherNodeData | ||
); | ||
$(node.span).removeClass( | ||
classDropOver + | ||
" " + | ||
classDropAccept + | ||
" " + | ||
classDropReject | ||
); | ||
$dropMarker.hide(); | ||
data.hitMode = LAST_HIT_MODE; | ||
data.dropEffect = dataTransfer.dropEffect; | ||
data.isCancelled = data.dropEffect === "none"; | ||
// Let user implement the actual drop operation | ||
dndOpts.dragDrop(node, data); | ||
// Prevent browser's default drop handling | ||
event.preventDefault(); | ||
_clearGlobals(); | ||
break; | ||
} | ||
// Dnd API madness: we must PREVENT default handling to enable dropping | ||
if (allowDrop) { | ||
event.preventDefault(); | ||
return false; | ||
} | ||
} | ||
onDropEvent.bind(tree) | ||
); | ||
@@ -926,0 +1146,0 @@ } |
@@ -7,3 +7,3 @@ /*! | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -13,4 +13,4 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
@@ -119,3 +119,3 @@ | ||
}) | ||
.keydown(function(event) { | ||
.on("keydown", function(event) { | ||
switch (event.which) { | ||
@@ -308,3 +308,3 @@ case $.ui.keyCode.ESCAPE: | ||
name: "edit", | ||
version: "2.30.2", | ||
version: "2.31.0", | ||
// Default options for this extension. | ||
@@ -330,4 +330,17 @@ options: { | ||
treeInit: function(ctx) { | ||
var tree = ctx.tree; | ||
this._superApply(arguments); | ||
this.$container.addClass("fancytree-ext-edit"); | ||
this.$container | ||
.addClass("fancytree-ext-edit") | ||
.on("fancytreebeforeupdateviewport", function(event, data) { | ||
var editNode = tree.isEditing(); | ||
// When scrolling, the TR may be re-used by another node, so the | ||
// active cell marker an | ||
if (editNode) { | ||
editNode.info("Cancel edit due to scroll event."); | ||
editNode.editEnd(false, event); | ||
} | ||
}); | ||
}, | ||
@@ -334,0 +347,0 @@ nodeClick: function(ctx) { |
@@ -7,3 +7,3 @@ /*! | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -13,4 +13,4 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
@@ -41,4 +41,3 @@ | ||
function _escapeRegex(str) { | ||
/*jshint regexdash:true */ | ||
return (str + "").replace(/([.?*+\^\$\[\]\\(){}|-])/g, "\\$1"); | ||
return (str + "").replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"); | ||
} | ||
@@ -65,2 +64,3 @@ | ||
temp, | ||
prevEnableUpdate, | ||
count = 0, | ||
@@ -133,2 +133,4 @@ treeOpts = this.options, | ||
prevEnableUpdate = this.enableUpdate(false); | ||
this.$div.addClass("fancytree-ext-filter"); | ||
@@ -216,3 +218,5 @@ if (hideMode) { | ||
// Redraw whole tree | ||
this.render(); | ||
this._callHook("treeStructureChanged", this, "applyFilter"); | ||
// this.render(); | ||
this.enableUpdate(prevEnableUpdate); | ||
return count; | ||
@@ -244,12 +248,2 @@ }; | ||
/** | ||
* @deprecated | ||
*/ | ||
$.ui.fancytree._FancytreeClass.prototype.applyFilter = function(filter) { | ||
this.warn( | ||
"Fancytree.applyFilter() is deprecated since 2.1.0 / 2014-05-29. Use .filterNodes() instead." | ||
); | ||
return this.filterNodes.apply(this, arguments); | ||
}; | ||
/** | ||
* [ext-filter] Dimm or hide whole branches. | ||
@@ -280,3 +274,4 @@ * | ||
escapeTitles = this.options.escapeTitles, | ||
enhanceTitle = this.options.enhanceTitle; | ||
enhanceTitle = this.options.enhanceTitle, | ||
prevEnableUpdate = this.enableUpdate(false); | ||
@@ -323,3 +318,5 @@ if (statusNode) { | ||
); | ||
this.render(); | ||
this._callHook("treeStructureChanged", this, "clearFilter"); | ||
// this.render(); | ||
this.enableUpdate(prevEnableUpdate); | ||
}; | ||
@@ -356,3 +353,3 @@ | ||
name: "filter", | ||
version: "2.30.2", | ||
version: "2.31.0", | ||
// Default options for this extension. | ||
@@ -372,12 +369,11 @@ options: { | ||
nodeLoadChildren: function(ctx, source) { | ||
var tree = ctx.tree; | ||
return this._superApply(arguments).done(function() { | ||
if ( | ||
ctx.tree.enableFilter && | ||
ctx.tree.lastFilterArgs && | ||
tree.enableFilter && | ||
tree.lastFilterArgs && | ||
ctx.options.filter.autoApply | ||
) { | ||
ctx.tree._applyFilterImpl.apply( | ||
ctx.tree, | ||
ctx.tree.lastFilterArgs | ||
); | ||
tree._applyFilterImpl.apply(tree, tree.lastFilterArgs); | ||
} | ||
@@ -387,3 +383,5 @@ }); | ||
nodeSetExpanded: function(ctx, flag, callOpts) { | ||
delete ctx.node._filterAutoExpanded; | ||
var node = ctx.node; | ||
delete node._filterAutoExpanded; | ||
// Make sure counter badge is displayed again, when node is beeing collapsed | ||
@@ -393,5 +391,5 @@ if ( | ||
ctx.options.filter.hideExpandedCounter && | ||
ctx.node.$subMatchBadge | ||
node.$subMatchBadge | ||
) { | ||
ctx.node.$subMatchBadge.show(); | ||
node.$subMatchBadge.show(); | ||
} | ||
@@ -443,3 +441,3 @@ return this._superApply(arguments); | ||
// node.debug("nodeRenderStatus", node.titleWithHighlight, node.title) | ||
// #601: also chek for $title.length, because we don't need to render | ||
// #601: also check for $title.length, because we don't need to render | ||
// if node.span is null (i.e. not rendered) | ||
@@ -446,0 +444,0 @@ if (node.span && (!node.isEditing || !node.isEditing.call(node))) { |
@@ -7,3 +7,3 @@ /*! | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -13,6 +13,8 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
// Allow to use multiple var statements inside a function | ||
(function(factory) { | ||
@@ -273,9 +275,9 @@ if (typeof define === "function" && define.amd) { | ||
treeLoad: function(ctx) { | ||
var _this = this, | ||
var self = this, | ||
res = this._superApply(arguments); | ||
res.done(function() { | ||
_this.ext.fixed._adjustLayout.call(_this); | ||
if (_this.options.fixed.resizable) { | ||
_this.ext.fixed._makeTableResizable(); | ||
self.ext.fixed._adjustLayout.call(self); | ||
if (self.options.fixed.resizable) { | ||
self.ext.fixed._makeTableResizable(); | ||
} | ||
@@ -326,6 +328,8 @@ }); | ||
function _removeChild(elem) { | ||
var children = elem.children; | ||
var i, | ||
child, | ||
children = elem.children; | ||
if (children) { | ||
for (var i = 0; i < children.length; i++) { | ||
var child = children[i]; | ||
for (i = 0; i < children.length; i++) { | ||
child = children[i]; | ||
if (child.trRight) { | ||
@@ -397,5 +401,5 @@ $(child.trRight).remove(); | ||
), | ||
$prevLeftNode = $blTableBody.find( | ||
"tr:eq(" + Math.max(idx + 1, 0) + ")" | ||
), | ||
$prevLeftNode = $blTableBody | ||
.find("tr") | ||
.eq(Math.max(idx + 1, 0)), | ||
prevRightNode = $prevLeftNode.data(fcn.counterpart); | ||
@@ -457,3 +461,3 @@ | ||
var res, | ||
_this = this, | ||
self = this, | ||
node = ctx.node, | ||
@@ -478,3 +482,3 @@ $leftTr = $(node.tr), | ||
_this.ext.fixed._adjustRowHeight($trLeft, $trRight); | ||
self.ext.fixed._adjustRowHeight($trLeft, $trRight); | ||
if (!child.expanded) { | ||
@@ -485,4 +489,4 @@ return "skip"; | ||
_this.ext.fixed._adjustColWidths(); | ||
_this.ext.fixed._adjustWrapperLayout(); | ||
self.ext.fixed._adjustColWidths(); | ||
self.ext.fixed._adjustWrapperLayout(); | ||
}); | ||
@@ -500,4 +504,4 @@ } else if (!flag && node.isExpanded()) { | ||
_this.ext.fixed._adjustColWidths(); | ||
_this.ext.fixed._adjustWrapperLayout(); | ||
self.ext.fixed._adjustColWidths(); | ||
self.ext.fixed._adjustWrapperLayout(); | ||
res = this._superApply(arguments); | ||
@@ -571,5 +575,4 @@ } else { | ||
var $thTop = $(this), | ||
$tdBottom = $trBottom.find("td").eq(idx); | ||
var thTopWidth = $thTop.width(), | ||
$tdBottom = $trBottom.find("td").eq(idx), | ||
thTopWidth = $thTop.width(), | ||
thTopOuterWidth = $thTop.outerWidth(), | ||
@@ -663,3 +666,3 @@ tdBottomWidth = $tdBottom.width(), | ||
_adjustLayout: function() { | ||
var _this = this, | ||
var self = this, | ||
$wrapper = this.$fixedWrapper, | ||
@@ -673,4 +676,4 @@ fcn = this.options.fixed.classNames, | ||
$topLeftWrapper.find("table tr").each(function(idx) { | ||
var $trRight = $topRightWrapper.find("tr:eq(" + idx + ")"); | ||
_this.ext.fixed._adjustRowHeight($(this), $trRight); | ||
var $trRight = $topRightWrapper.find("tr").eq(idx); | ||
self.ext.fixed._adjustRowHeight($(this), $trRight); | ||
}); | ||
@@ -682,8 +685,8 @@ | ||
.each(function(idx) { | ||
// var $trRight = $bottomRightWrapper.find("tbody").find("tr:eq(" + idx + ")"); | ||
_this.ext.fixed._adjustRowHeight($(this)); | ||
// var $trRight = $bottomRightWrapper.find("tbody").find("tr").eq(idx); | ||
self.ext.fixed._adjustRowHeight($(this)); | ||
}); | ||
_this.ext.fixed._adjustColWidths.call(this); | ||
_this.ext.fixed._adjustWrapperLayout.call(this); | ||
self.ext.fixed._adjustColWidths.call(this); | ||
self.ext.fixed._adjustWrapperLayout.call(this); | ||
}, | ||
@@ -690,0 +693,0 @@ |
@@ -7,3 +7,3 @@ /*! | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -13,4 +13,4 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
@@ -175,2 +175,3 @@ | ||
$span = $(span), | ||
$counter = $span.find(".fancytree-childcounter"), | ||
setClass = baseClass + " " + (map._addClass || ""); | ||
@@ -181,3 +182,3 @@ | ||
span.innerHTML = ""; | ||
$span.attr("class", setClass + " " + icon); | ||
$span.attr("class", setClass + " " + icon).append($counter); | ||
} else if (icon) { | ||
@@ -191,3 +192,5 @@ if (icon.text) { | ||
} | ||
$span.attr("class", setClass + " " + (icon.addClass || "")); | ||
$span | ||
.attr("class", setClass + " " + (icon.addClass || "")) | ||
.append($counter); | ||
} | ||
@@ -198,3 +201,3 @@ } | ||
name: "glyph", | ||
version: "2.30.2", | ||
version: "2.31.0", | ||
// Default options for this extension. | ||
@@ -274,7 +277,8 @@ options: { | ||
} else { | ||
// eslint-disable-next-line no-nested-ternary | ||
icon = node.selected | ||
? "checkboxSelected" | ||
: node.partsel | ||
? "checkboxUnknown" | ||
: "checkbox"; | ||
? "checkboxUnknown" | ||
: "checkbox"; | ||
// span.className = "fancytree-checkbox " + map[icon]; | ||
@@ -281,0 +285,0 @@ setIcon(span, "fancytree-checkbox", opts, icon); |
@@ -7,3 +7,3 @@ /*! | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -13,4 +13,4 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
@@ -132,3 +132,3 @@ | ||
name: "gridnav", | ||
version: "2.30.2", | ||
version: "2.31.0", | ||
// Default options for this extension. | ||
@@ -185,3 +185,6 @@ options: { | ||
$outer = $(node.tr || node.span); | ||
$outer.find(":input:enabled:first").focus(); | ||
$outer | ||
.find(":input:enabled") | ||
.first() | ||
.focus(); | ||
} | ||
@@ -188,0 +191,0 @@ } |
@@ -7,3 +7,3 @@ /*! | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -13,4 +13,4 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
@@ -40,18 +40,18 @@ | ||
logLine = window.console.log, | ||
HOOK_NAMES = "nodeClick nodeCollapseSiblings".split(" "), | ||
TREE_EVENT_NAMES = "beforeRestore blurTree create init focusTree restore".split( | ||
// HOOK_NAMES = "nodeClick nodeCollapseSiblings".split(" "), | ||
TREE_EVENT_NAMES = "beforeRestore beforeUpdateViewport blurTree create init focusTree restore updateViewport".split( | ||
" " | ||
), | ||
NODE_EVENT_NAMES = "activate beforeActivate beforeExpand beforeSelect blur click collapse createNode dblclick deactivate expand enhanceTitle focus keydown keypress lazyLoad loadChildren loadError modifyChild postProcess renderNode renderTitle select".split( | ||
NODE_EVENT_NAMES = "activate activateCell beforeActivate beforeExpand beforeSelect blur click collapse createNode dblclick deactivate defaultGridAction expand enhanceTitle focus keydown keypress lazyLoad loadChildren loadError modifyChild postProcess renderNode renderTitle select".split( | ||
" " | ||
), | ||
EVENT_NAMES = TREE_EVENT_NAMES.concat(NODE_EVENT_NAMES), | ||
HOOK_NAME_MAP = {}, | ||
// HOOK_NAME_MAP = {}, | ||
EVENT_NAME_MAP = {}; | ||
/* | ||
*/ | ||
for (i = 0; i < HOOK_NAMES.length; i++) { | ||
HOOK_NAME_MAP[HOOK_NAMES[i]] = true; | ||
} | ||
*/ | ||
// for (i = 0; i < HOOK_NAMES.length; i++) { | ||
// HOOK_NAME_MAP[HOOK_NAMES[i]] = true; | ||
// } | ||
for (i = 0; i < EVENT_NAMES.length; i++) { | ||
@@ -69,3 +69,3 @@ EVENT_NAME_MAP[EVENT_NAMES[i]] = true; | ||
if (m && (tem = ua.match(/version\/([\.\d]+)/i)) !== null) { | ||
if (m && (tem = ua.match(/version\/([.\d]+)/i)) !== null) { | ||
m[2] = tem[1]; | ||
@@ -79,3 +79,2 @@ } | ||
var res, | ||
/* jshint validthis: true */ | ||
self = this, | ||
@@ -112,3 +111,3 @@ // logName = PREFIX + "event." + event.type, | ||
function logHook(name, self, args, extra) { | ||
function logHook(name, this_, args, extra) { | ||
var res, | ||
@@ -124,3 +123,3 @@ ctx = args[0], | ||
) { | ||
return self._superApply.call(self, args); | ||
return this_._superApply.call(this_, args); | ||
} | ||
@@ -134,3 +133,3 @@ if ( | ||
window.console.time(logName); | ||
res = self._superApply.call(self, args); | ||
res = this_._superApply.call(this_, args); | ||
window.console.timeEnd(logName); | ||
@@ -145,3 +144,3 @@ } else { | ||
} | ||
res = self._superApply.call(self, args); | ||
res = this_._superApply.call(this_, args); | ||
} | ||
@@ -156,3 +155,3 @@ return res; | ||
name: "logger", | ||
version: "2.30.2", | ||
version: "2.31.0", | ||
// Default options for this extension. | ||
@@ -177,3 +176,5 @@ options: { | ||
) { | ||
throw "Fancytree 'logger' extension must be listed as last entry."; | ||
throw Error( | ||
"Fancytree 'logger' extension must be listed as last entry." | ||
); | ||
} | ||
@@ -301,5 +302,14 @@ tree.warn( | ||
}, | ||
treeSetFocus: function(ctx, flag) { | ||
treeRegisterNode: function(ctx, add, node) { | ||
return logHook("treeRegisterNode", this, arguments); | ||
}, | ||
treeSetFocus: function(ctx, flag, callOpts) { | ||
return logHook("treeSetFocus", this, arguments); | ||
}, | ||
treeSetOption: function(ctx, key, value) { | ||
return logHook("treeSetOption", this, arguments); | ||
}, | ||
treeStructureChanged: function(ctx, type) { | ||
return logHook("treeStructureChanged", this, arguments); | ||
}, | ||
}); | ||
@@ -306,0 +316,0 @@ |
@@ -9,3 +9,3 @@ /*! | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -15,4 +15,4 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
@@ -37,3 +37,3 @@ | ||
name: "menu", | ||
version: "2.30.2", | ||
version: "2.31.0", | ||
// Default options for this extension. | ||
@@ -72,17 +72,15 @@ options: { | ||
// Replace the standard browser context menu with out own | ||
tree.$container.delegate( | ||
"span.fancytree-node", | ||
"contextmenu", | ||
function(event) { | ||
var node = $.ui.fancytree.getNode(event), | ||
ctx = { | ||
node: node, | ||
tree: node.tree, | ||
originalEvent: event, | ||
options: tree.options, | ||
}; | ||
tree.ext.menu._openMenu(ctx); | ||
return false; | ||
} | ||
); | ||
tree.$container.on("contextmenu", "span.fancytree-node", function( | ||
event | ||
) { | ||
var node = $.ui.fancytree.getNode(event), | ||
ctx = { | ||
node: node, | ||
tree: node.tree, | ||
originalEvent: event, | ||
options: tree.options, | ||
}; | ||
tree.ext.menu._openMenu(ctx); | ||
return false; | ||
}); | ||
@@ -89,0 +87,0 @@ // Use jquery.ui.menu |
@@ -7,3 +7,3 @@ /*! | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -13,4 +13,4 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
@@ -44,3 +44,3 @@ | ||
name: "multi", | ||
version: "2.30.2", | ||
version: "2.31.0", | ||
// Default options for this extension. | ||
@@ -47,0 +47,0 @@ options: { |
@@ -9,3 +9,3 @@ /*! | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -15,4 +15,4 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
@@ -93,4 +93,4 @@ | ||
/* Recursively load lazy nodes | ||
* @param {string} mode 'load', 'expand', false | ||
*/ | ||
* @param {string} mode 'load', 'expand', false | ||
*/ | ||
function _loadLazyNodes(tree, local, keyList, mode, dfd) { | ||
@@ -218,3 +218,3 @@ var i, | ||
name: "persist", | ||
version: "2.30.2", | ||
version: "2.31.0", | ||
// Default options for this extension. | ||
@@ -221,0 +221,0 @@ options: { |
@@ -7,3 +7,3 @@ /*! | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -13,4 +13,4 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
@@ -96,20 +96,10 @@ | ||
/* Render callback for 'wide' mode. */ | ||
// function _renderStatusNodeWide(event, data) { | ||
// var node = data.node, | ||
// nodeColumnIdx = data.options.table.nodeColumnIdx, | ||
// $tdList = $(node.tr).find(">td"); | ||
// $tdList.eq(nodeColumnIdx).attr("colspan", data.tree.columnCount); | ||
// $tdList.not(":eq(" + nodeColumnIdx + ")").remove(); | ||
// } | ||
$.ui.fancytree.registerExtension({ | ||
name: "table", | ||
version: "2.30.2", | ||
version: "2.31.0", | ||
// Default options for this extension. | ||
options: { | ||
checkboxColumnIdx: null, // render the checkboxes into the this column index (default: nodeColumnIdx) | ||
indentation: 16, // indent every node level by 16px | ||
mergeStatusColumns: true, // display 'nodata', 'loading', 'error' centered in a single, merged TR | ||
indentation: 16, // indent every node level by 16px | ||
nodeColumnIdx: 0, // render node expander, icon, and title to this column (default: #0) | ||
@@ -131,7 +121,3 @@ }, | ||
if (tableOpts.customStatus != null) { | ||
if (opts.renderStatusColumns != null) { | ||
$.error( | ||
"The 'customStatus' option is deprecated since v2.15.0. Use 'renderStatusColumns' only instead." | ||
); | ||
} else { | ||
if (opts.renderStatusColumns == null) { | ||
tree.warn( | ||
@@ -141,2 +127,6 @@ "The 'customStatus' option is deprecated since v2.15.0. Use 'renderStatusColumns' instead." | ||
opts.renderStatusColumns = tableOpts.customStatus; | ||
} else { | ||
$.error( | ||
"The 'customStatus' option is deprecated since v2.15.0. Use 'renderStatusColumns' only instead." | ||
); | ||
} | ||
@@ -168,5 +158,7 @@ } | ||
// Determine column count from table header if any | ||
tree.columnCount = $("thead >tr:last >th", $table).length; | ||
tree.columnCount = $("thead >tr", $table) | ||
.last() | ||
.find(">th", $table).length; | ||
// Read TR templates from tbody if any | ||
$row = $tbody.children("tr:first"); | ||
$row = $tbody.children("tr").first(); | ||
if ($row.length) { | ||
@@ -207,3 +199,3 @@ n = $row.children("td").length; | ||
// // If tbody contains a second row, use this as status node template | ||
// $row = $tbody.children("tr:eq(1)"); | ||
// $row = $tbody.children("tr").eq(1); | ||
// if( $row.length === 0 ) { | ||
@@ -289,3 +281,11 @@ // tree.statusRowFragment = tree.rowFragment; | ||
} | ||
if (!node.tr) { | ||
if (node.tr) { | ||
if (force) { | ||
// Set icon, link, and title (normally this is only required on initial render) | ||
this.nodeRenderTitle(ctx); // triggers renderColumns() | ||
} else { | ||
// Update element classes according to node state | ||
this.nodeRenderStatus(ctx); | ||
} | ||
} else { | ||
if (ctx.hasCollapsedParents && !deep) { | ||
@@ -314,3 +314,5 @@ // #166: we assume that the parent will be (recursively) rendered | ||
} | ||
if (!prevNode.tr) { | ||
if (prevNode.tr) { | ||
insertSiblingAfter(prevNode.tr, newRow); | ||
} else { | ||
_assert( | ||
@@ -322,4 +324,2 @@ !prevNode.parent, | ||
insertFirstChild(tree.tbody, newRow); // #675 | ||
} else { | ||
insertSiblingAfter(prevNode.tr, newRow); | ||
} | ||
@@ -342,10 +342,2 @@ node.tr = newRow; | ||
} | ||
} else { | ||
if (force) { | ||
// Set icon, link, and title (normally this is only required on initial render) | ||
this.nodeRenderTitle(ctx); // triggers renderColumns() | ||
} else { | ||
// Update element classes according to node state | ||
this.nodeRenderStatus(ctx); | ||
} | ||
} | ||
@@ -431,3 +423,3 @@ } | ||
opts.renderStatusColumns.call( | ||
ctx.tree, | ||
tree, | ||
{ type: "renderStatusColumns" }, | ||
@@ -437,4 +429,4 @@ ctx | ||
} else if (opts.table.mergeStatusColumns && node.isTopLevel()) { | ||
var $tdList = $(node.tr).find(">td"); | ||
$tdList | ||
$(node.tr) | ||
.find(">td") | ||
.eq(0) | ||
@@ -448,7 +440,3 @@ .prop("colspan", tree.columnCount) | ||
} else if (opts.renderColumns) { | ||
opts.renderColumns.call( | ||
ctx.tree, | ||
{ type: "renderColumns" }, | ||
ctx | ||
); | ||
opts.renderColumns.call(tree, { type: "renderColumns" }, ctx); | ||
} | ||
@@ -558,3 +546,5 @@ return res; | ||
this.$container.find("tbody").empty(); | ||
this.$source && this.$source.removeClass("fancytree-helper-hidden"); | ||
if (this.$source) { | ||
this.$source.removeClass("fancytree-helper-hidden"); | ||
} | ||
return this._superApply(arguments); | ||
@@ -561,0 +551,0 @@ }, |
@@ -9,3 +9,3 @@ /*! | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -15,4 +15,4 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
@@ -40,3 +40,3 @@ | ||
name: "themeroller", | ||
version: "2.30.2", | ||
version: "2.31.0", | ||
// Default options for this extension. | ||
@@ -67,5 +67,3 @@ options: { | ||
$el.delegate(".fancytree-node", "mouseenter mouseleave", function( | ||
event | ||
) { | ||
$el.on("mouseenter mouseleave", ".fancytree-node", function(event) { | ||
var node = $.ui.fancytree.getNode(event.target), | ||
@@ -72,0 +70,0 @@ flag = event.type === "mouseenter"; |
@@ -6,3 +6,3 @@ /*! | ||
* | ||
* Copyright (c) 2008-2019, Martin Wendt (http://wwWendt.de) | ||
* Copyright (c) 2008-2019, Martin Wendt (https://wwWendt.de) | ||
* | ||
@@ -12,4 +12,4 @@ * Released under the MIT license | ||
* | ||
* @version 2.30.2 | ||
* @date 2019-01-13T08:17:01Z | ||
* @version 2.31.0 | ||
* @date 2019-05-31T11:32:38Z | ||
*/ | ||
@@ -144,3 +144,3 @@ | ||
name: "wide", | ||
version: "2.30.2", | ||
version: "2.31.0", | ||
// Default options for this extension. | ||
@@ -147,0 +147,0 @@ options: { |
Copyright 2008-2019 Martin Wendt, | ||
http://wwWendt.de/ | ||
https://wwWendt.de/ | ||
@@ -4,0 +4,0 @@ Permission is hereby granted, free of charge, to any person obtaining |
@@ -5,7 +5,7 @@ { | ||
"description": "JavaScript tree view / tree grid plugin with support for keyboard, inline editing, filtering, checkboxes, drag'n'drop, and lazy loading", | ||
"version": "2.30.2", | ||
"version": "2.31.0", | ||
"homepage": "https://github.com/mar10/fancytree", | ||
"author": { | ||
"name": "Martin Wendt", | ||
"url": "http://careers.stackoverflow.com/martin-wendt" | ||
"url": "https://wwWendt.de" | ||
}, | ||
@@ -42,33 +42,32 @@ "repository": { | ||
"dependencies": { | ||
"jquery": ">=1.9" | ||
"jquery": "^3.4.1" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^5.3.0", | ||
"eslint-config-prettier": "^2.9.0", | ||
"eslint-plugin-prettier": "^2.6.2", | ||
"grunt": "^1.0.3", | ||
"grunt-contrib-clean": "^1.0.0", | ||
"eslint": "^5.15.0", | ||
"eslint-config-jquery": "^1.0.1", | ||
"eslint-config-prettier": "^3.6.0", | ||
"eslint-plugin-prettier": "^3.0.1", | ||
"grunt": "^1.0.4", | ||
"grunt-contrib-clean": "^2.0.0", | ||
"grunt-contrib-compress": "^1.0.0", | ||
"grunt-contrib-concat": "^1.0.0", | ||
"grunt-contrib-connect": "^1.0.0", | ||
"grunt-contrib-connect": "^2.0.0", | ||
"grunt-contrib-copy": "^1.0.0", | ||
"grunt-contrib-cssmin": "^1.0.0", | ||
"grunt-contrib-jshint": "^1.0.0", | ||
"grunt-contrib-cssmin": "^3.0.0", | ||
"grunt-contrib-less": "^2.0.0", | ||
"grunt-contrib-qunit": "^1.0.1", | ||
"grunt-contrib-uglify": "^3.2.1", | ||
"grunt-contrib-qunit": "^3.1.0", | ||
"grunt-contrib-uglify": "^4.0.0", | ||
"grunt-contrib-watch": "^1.1.0", | ||
"grunt-dev-update": "^2.0.0", | ||
"grunt-dev-update": "^2.3.0", | ||
"grunt-docco": "^0.5.0", | ||
"grunt-eslint": "^19.0.0", | ||
"grunt-exec": "^1.0.0", | ||
"grunt-jsdoc": "^2.1.0", | ||
"grunt-saucelabs": "^9.0.1", | ||
"grunt-eslint": "^21.0.0", | ||
"grunt-exec": "^3.0.0", | ||
"grunt-jsdoc": "^2.3.1", | ||
"grunt-saucelabs": "mar10/grunt-saucelabs#update-sauce-tunnel", | ||
"grunt-text-replace": "^0.4.0", | ||
"grunt-yabs": "^1.1.4", | ||
"jsdoc": "~3.5.4", | ||
"jshint": "^2.9.7", | ||
"marked": "^0.3.12", | ||
"prettier": "^1.14.0", | ||
"qunitjs": "^1.21" | ||
"marked": "^0.6.2", | ||
"prettier": "^1.16.4", | ||
"qunit": "^2.9.2" | ||
}, | ||
@@ -75,0 +74,0 @@ "scripts": { |
@@ -8,2 +8,3 @@ # ![logo](doc/logo.png?raw=true) Fancytree | ||
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) | ||
[![StackOverflow: fancytree](https://img.shields.io/badge/StackOverflow-fancytree-blue.svg)](https://stackoverflow.com/questions/tagged/fancytree) | ||
@@ -14,3 +15,3 @@ Fancytree (sequel of [DynaTree 1.x](https://code.google.com/p/dynatree/)) is a | ||
[ ![sample](doc/teaser2.png?raw=true) ](http://wwwendt.de/tech/fancytree/demo "Live demo") | ||
[ ![sample](doc/teaser2.png?raw=true) ](https://wwWendt.de/tech/fancytree/demo "Live demo") | ||
@@ -27,3 +28,3 @@ | ||
* [Try the live demo](http://wwwendt.de/tech/fancytree/demo). | ||
* [Try the live demo](https://wwWendt.de/tech/fancytree/demo). | ||
* [Read the documentation](https://github.com/mar10/fancytree/wiki). | ||
@@ -59,3 +60,3 @@ * [Check the Q&A forum](https://groups.google.com/forum/#!forum/fancytree) or | ||
See [module loader support](https://github.com/mar10/fancytree/wiki#use-a-module-loader) and | ||
[API docs](http://www.wwwendt.de/tech/fancytree/doc/jsdoc/Fancytree_Static.html#createTree). | ||
[API docs](https://wwWendt.de/tech/fancytree/doc/jsdoc/Fancytree_Static.html#createTree). | ||
@@ -62,0 +63,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2466073
27
118
50215
68
Updatedjquery@^3.4.1