芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/public_html/cepali/admin/tool/lp/amd/build/tree.min.js
define(["jquery","core/url","core/log"],function(a,b,c){var d=a('
'),e=a('
'),f=function(b,c){this.treeRoot=a(b),this.multiSelect="undefined"==typeof c||c===!0,this.items=this.treeRoot.find("li"),this.expandAll=this.items.length<20,this.parents=this.treeRoot.find("li:has(ul)"),c&&this.treeRoot.attr("aria-multiselectable","true"),this.items.attr("aria-selected","false"),this.visibleItems=null,this.activeItem=null,this.lastActiveItem=null,this.keys={tab:9,enter:13,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,eight:56,asterisk:106},this.init(),this.bindEventHandlers()};return f.prototype.init=function(){this.parents.attr("aria-expanded","true"),this.parents.prepend(d.clone()),this.items.attr("role","tree-item"),this.items.attr("tabindex","-1"),this.parents.attr("role","group"),this.treeRoot.attr("role","tree"),this.visibleItems=this.treeRoot.find("li");var b=this;this.expandAll||(this.parents.each(function(){b.collapseGroup(a(this))}),this.expandGroup(this.parents.first()))},f.prototype.expandGroup=function(a){var b=a.children("ul");b.show().attr("aria-hidden","false"),a.attr("aria-expanded","true"),a.children("img").attr("src",d.attr("src")),this.visibleItems=this.treeRoot.find("li:visible")},f.prototype.collapseGroup=function(a){var b=a.children("ul");b.hide().attr("aria-hidden","true"),a.attr("aria-expanded","false"),a.children("img").attr("src",e.attr("src")),this.visibleItems=this.treeRoot.find("li:visible")},f.prototype.toggleGroup=function(a){"true"==a.attr("aria-expanded")?this.collapseGroup(a):this.expandGroup(a)},f.prototype.triggerChange=function(){var a=this.items.filter("[aria-selected=true]");this.multiSelect||(a=a.first()),this.treeRoot.trigger("selectionchanged",{selected:a})},f.prototype.multiSelectItem=function(b){if(this.multiSelect){if(null!==this.lastActiveItem){for(var c=this.visibleItems.index(this.lastActiveItem),d=this.visibleItems.index(this.activeItem),e=null;c
d;)e=a(this.visibleItems.get(c)),e.attr("aria-selected","true"),c--}}else this.items.attr("aria-selected","false");b.attr("aria-selected","true"),this.triggerChange()},f.prototype.selectItem=function(a){for(var b=a.parent();"tree"!=b.attr("role");)b=b.parent(),"false"==b.attr("aria-expanded")&&this.expandGroup(b),b=b.parent();this.items.attr("aria-selected","false"),a.attr("aria-selected","true"),this.triggerChange()},f.prototype.toggleItem=function(a){if(!this.multiSelect)return void this.selectItem(a);var b=a.attr("aria-selected");b="true"===b?"false":"true",a.attr("aria-selected",b),this.triggerChange()},f.prototype.updateFocus=function(a){this.lastActiveItem=this.activeItem,this.activeItem=a;for(var b=a.parent();"tree"!=b.attr("role");)b=b.parent(),"false"==b.attr("aria-expanded")&&this.expandGroup(b),b=b.parent();this.items.attr("tabindex","-1"),a.attr("tabindex",0)},f.prototype.handleKeyDown=function(b,c){var d=this.visibleItems.index(b),e=null,f=c.shiftKey||c.ctrlKey||c.metaKey||c.altKey,g=this;switch(c.keyCode){case this.keys.home:return e=this.parents.first(),e.focus(),c.shiftKey?this.multiSelectItem(e):f||this.selectItem(e),c.stopPropagation(),!1;case this.keys.end:return e=this.visibleItems.last(),e.focus(),c.shiftKey?this.multiSelectItem(e):f||this.selectItem(e),c.stopPropagation(),!1;case this.keys.enter:case this.keys.space:return c.shiftKey?this.multiSelectItem(b):c.metaKey||c.ctrlKey?this.toggleItem(b):this.selectItem(b),c.stopPropagation(),!1;case this.keys.left:if(b.has("ul")&&"true"==b.attr("aria-expanded"))this.collapseGroup(b);else{var h=b.parent(),i=h.parent();i.is("li")&&(i.focus(),c.shiftKey?this.multiSelectItem(i):f||this.selectItem(i))}return c.stopPropagation(),!1;case this.keys.right:return b.has("ul")&&"false"==b.attr("aria-expanded")?this.expandGroup(b):(e=b.children("ul").children("li").first(),e.length>0&&(e.focus(),c.shiftKey?this.multiSelectItem(e):f||this.selectItem(e))),c.stopPropagation(),!1;case this.keys.up:if(d>0){var j=this.visibleItems.eq(d-1);j.focus(),c.shiftKey?this.multiSelectItem(j):f||this.selectItem(j)}return c.stopPropagation(),!1;case this.keys.down:if(d