From 85a182c0a93f67216043ba5ef4eccb0a51cb6938 Mon Sep 17 00:00:00 2001
From: zTreeAPI
Date: Sat, 4 Apr 2020 22:46:38 +0800
Subject: [PATCH] * fixed TypeScript type definition Thanks @UtillYou *
Update demo 'super/keyboard_navigation.html' Thanks @bseddon * Update demo
'core/searchNodes.html' Thanks @bseddon * add setting.view.nodeClasses
Thanks @bseddon
---
README.md | 2 +-
api/API_cn.html | 2 +-
api/API_en.html | 2 +-
api/apiCss/api.js | 3 +-
api/apiCss/jquery.ztree.core.js | 2 +-
api/cn/setting.view.nodeClasses.html | 51 +++++++++
api/en/setting.view.nodeClasses.html | 51 +++++++++
demo/cn/core/searchNodes.html | 124 ++++++++++++++++++++--
demo/en/core/searchNodes.html | 151 +++++++++++++++++++++++----
demo/js/keyboard_navigation.js | 35 ++++++-
index.d.ts | 145 +++++++++++++++----------
js/jquery.ztree.all.js | 33 ++++--
js/jquery.ztree.all.min.js | 2 +-
js/jquery.ztree.core.js | 25 ++++-
js/jquery.ztree.core.min.js | 2 +-
js/jquery.ztree.excheck.js | 4 +-
js/jquery.ztree.exedit.js | 4 +-
js/jquery.ztree.exhide.js | 4 +-
log v3.x.txt | 8 +-
package.json | 2 +-
20 files changed, 541 insertions(+), 111 deletions(-)
create mode 100644 api/cn/setting.view.nodeClasses.html
create mode 100644 api/en/setting.view.nodeClasses.html
diff --git a/README.md b/README.md
index 2b2e464df..65e6299b4 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
jQuery Tree Plugin ---- zTree
============
-last verson : 3.5.42
+last verson : 3.5.43
**Donate to zTree** : http://www.treejs.cn/v3/donate.php
diff --git a/api/API_cn.html b/api/API_cn.html
index c1997512e..a8b1acd71 100644
--- a/api/API_cn.html
+++ b/api/API_cn.html
@@ -35,7 +35,7 @@
浏览本网站建议您使用 Chrome、FireFox、Opera、IE9 等浏览器(只要不是 IE6 7 8 就行), 速度会更快,画面会更炫!
diff --git a/demo/en/core/searchNodes.html b/demo/en/core/searchNodes.html
index 812c3f184..7a5730bec 100644
--- a/demo/en/core/searchNodes.html
+++ b/demo/en/core/searchNodes.html
@@ -3,42 +3,82 @@
ZTREE DEMO - getNodeByParam / getNodesByParam / getNodesByParamFuzzy
+
+
@@ -152,6 +258,9 @@
getNodesByParam
getNodesByParamFuzzy (only string)
getNodesByFilter (see source: function filter)
+ styleNodesByCSS (see source: function filter)
+ style: styleNodesByCSS
+ styleNodesByClasses
diff --git a/demo/js/keyboard_navigation.js b/demo/js/keyboard_navigation.js
index 11f5e05c2..f9344d570 100644
--- a/demo/js/keyboard_navigation.js
+++ b/demo/js/keyboard_navigation.js
@@ -13,6 +13,13 @@
( function ($)
{
+ /**
+ * Dummy function to provide a placeholder for the destroy function
+ */
+ $.fn.zTreeKeyboardNavigationDestroy = function()
+ {
+ }
+
/**
* Creates a function that adds keyboard navigation:
* Home: home key (keycode 36) Goes to the first root element is visible
@@ -22,8 +29,11 @@
* Up: up cursor key (keycode 37) Goes to the prior visible node at the same level
* Previous: left cursor key (keycode 38) Goes to the prior visible node following the hierarchy
* Toggle: space key (keycode 32) Toggles the expand/collapse state of a parent node
+ * @param {IxTreeObj} zTree
+ * @param {string|JQuery;
+ chkDisabled?: boolean;
+ click?: CallBackOnFn;
+ getCheckStatus?: () => object;
+ getIndex?: () => number;
+ getNextNode?: () => ITreeNode;
+ getParentNode?: () => ITreeNode;
+ getPath?: () => Array;
+ getPrevNode?: () => ITreeNode;
+ halfCheck?: boolean;
+ icon?: string;
+ iconClose?: string;
+ iconOpen?: string;
+ iconSkin?: string;
+ isHidden?: boolean;
+ isParent?: boolean;
+ name?: string;
+ nocheck?: boolean;
+ open?: boolean;
+ target?: string;
+ url?: string;
+ check_Child_State?: number;
+ check_Focus?: boolean;
+ checkedOld?: boolean;
+ editNameFlag?: boolean;
+ isAjaxing?: boolean;
+ isFirstNode?: boolean;
+ isHover?: boolean;
+ isLastNode?: boolean;
+ level?: number;
+ parentTId?: string;
+ tId?: string;
+ [key: string]: any;
+}
type ApplicationType = 'application/x-www-form-urlencoded' | 'application/json';
type AjaxType = 'get' | 'post';
-type dataType = 'text' | 'json' | 'jsonp' | 'html' | 'xml' | 'script';
+type DataType = 'text' | 'json' | 'jsonp' | 'html' | 'xml' | 'script';
+
interface IAsync {
autoParam?: string[];
contentType?: ApplicationType;
- dataFilter?: (treeId: string, parentNode: object, responseData: IJSON[] | IJSON | string) => IJSON[] | IJSON;
- dataType?: dataType;
+ dataFilter?: (treeId: string, parentNode: ITreeNode, responseData: IJSON[] | IJSON | string) => IJSON[] | IJSON;
+ dataType?: DataType;
enable?: boolean;
otherParam?: string[] | IJSON;
type?: AjaxType;
headers?: object;
xhrFields?: object;
- url: string;
+ url: ((treeId: string, treeNode: ITreeNode) => string) | string;
}
-type CallBackBeforeFn = (treeId: string, treeNode: object) => boolean;
-type CallBackOnFn = (event: Event, treeId: string, treeNode: IJSON) => void;
+type CallBackBeforeFn = (treeId: string, treeNode: ITreeNode) => boolean | Promise;
+type CallBackOnFn = (event: Event, treeId: string, treeNode: ITreeNode) => void | Promise;
interface ICallback {
beforeAsync?: CallBackBeforeFn;
beforeCheck?: CallBackBeforeFn;
- beforeClick?: (treeId: string, treeNode: object, clickFlag: number) => boolean;
+ beforeClick?: (treeId: string, treeNode: ITreeNode, clickFlag: number) => boolean | Promise;
beforeCollapse?: CallBackBeforeFn;
beforeDblClick?: CallBackBeforeFn;
- beforeDrag?: (treeId: string, treeNode: IJSON[]) => boolean;
+ beforeDrag?: (treeId: string, treeNode: ITreeNode[]) => boolean | Promise;
beforeDragOpen?: CallBackBeforeFn;
- beforeDrop?: (treeId: string, treeNode: IJSON[], targetNode: object, moveType: string, isCopy: boolean) => boolean;
+ beforeDrop?: (treeId: string, treeNode: ITreeNode[], targetNode: object, moveType: string, isCopy: boolean) => boolean | Promise;
beforeEditName?: CallBackBeforeFn;
beforeExpand?: CallBackBeforeFn;
beforeMouseDown?: CallBackBeforeFn;
beforeMouseUp?: CallBackBeforeFn;
beforeRemove?: CallBackBeforeFn;
- beforeRename?: (treeId: string, treeNode: object, newName: string, isCancel: boolean) => boolean;
+ beforeRename?: (treeId: string, treeNode: ITreeNode, newName: string, isCancel: boolean) => boolean | Promise;
beforeRightClick?: CallBackBeforeFn;
- onAsyncError?: (event: Event, treeId: string, treeNode: object, XMLHttpRequest: any, textStatus: string, errorThrown: string) => void;
- onAsyncSuccess?: (event: Event, treeId: string, treeNode: object, msg: string | object) => void;
- onCheck?: (event: Event, treeId: string, treeNode: object) => void;
- onClick?: (event: Event, treeId: string, treeNode: object, clickFlag: number) => void;
- onCollapse?: (event: Event, treeId: string, treeNode: object) => void;
- onDblClick?: (event: Event, treeId: string, treeNode: object) => void;
- onDrag?: (event: Event, treeId: string, treeNodes: IJSON[]) => void;
- onDragMove?: (event: Event, treeId: string, treeNodes: IJSON[]) => void;
- onDrop?: (event: Event, treeId: string, treeNodes: IJSON[], targetNode: object, moveType: string, isCopy: boolean) => void;
+ onAsyncError?: (event: Event, treeId: string, treeNode: ITreeNode, XMLHttpRequest: any, textStatus: string, errorThrown: string) => void | Promise;
+ onAsyncSuccess?: (event: Event, treeId: string, treeNode: ITreeNode, msg: string | object) => void | Promise;
+ onCheck?: (event: Event, treeId: string, treeNode: ITreeNode) => void | Promise;
+ onClick?: (event: Event, treeId: string, treeNode: ITreeNode, clickFlag: number) => void | Promise;
+ onCollapse?: (event: Event, treeId: string, treeNode: ITreeNode) => void | Promise;
+ onDblClick?: (event: Event, treeId: string, treeNode: ITreeNode) => void | Promise;
+ onDrag?: (event: Event, treeId: string, treeNodes: ITreeNode[]) => void | Promise;
+ onDragMove?: (event: Event, treeId: string, treeNodes: ITreeNode[]) => void | Promise;
+ onDrop?: (event: Event, treeId: string, treeNodes: ITreeNode[], targetNode: object, moveType: string, isCopy: boolean) => void | Promise;
onExpand?: CallBackOnFn;
onMouseDown?: CallBackOnFn;
onMouseUp?: CallBackOnFn;
onNodeCreated?: CallBackOnFn;
onRemove?: CallBackOnFn;
- onRename?: (event: Event, treeId: string, treeNode: IJSON, isCancel: boolean) => void;
+ onRename?: (event: Event, treeId: string, treeNode: ITreeNode, isCancel: boolean) => void | Promise;
onRightClick?: CallBackOnFn;
}
@@ -97,7 +133,7 @@ interface IData {
}
-type removeFnType = (treeId: string, treeNode: object) => T;
+type removeFnType = (treeId: string, treeNode: ITreeNode) => T;
interface IEdit {
drag?: {
@@ -122,7 +158,7 @@ interface IEdit {
}
-type dblClickExpandFn = (treeId: string, treeNode: object) => T;
+type dblClickExpandFn = (treeId: string, treeNode: ITreeNode) => T;
interface IView {
addDiyDom?: dblClickExpandFn;
@@ -150,51 +186,52 @@ interface ISetting {
}
-type filterFnType = (node: IJSON) => boolean;
+type filterFnType = (node: ITreeNode) => boolean;
interface IzTreeObj {
setting: ISetting;
- addNodes: (parentNode: object, index?: number, newNodes?: IJSON[] | IJSON, isSilentBoolean?: boolean) => IJSON[];
+ addNodes: (parentNode: object, index?: number, newNodes?: ITreeNode[] | ITreeNode, isSilentBoolean?: boolean) => ITreeNode[];
cancelEditName: (newName?: string) => void;
- cancelSelectedNode: (treeNode?: object) => void;
+ cancelSelectedNode: (treeNode?: ITreeNode) => void;
checkAllNodes: (checked: boolean) => void;
- checkNode: (treeNode: IJSON, checked?: boolean, checkTypeFlag?: boolean, callbackFlag?: boolean) => void;
- copyNode: (targetNode: object, treeNode: IJSON, moveType: string, isSilent: boolean) => IJSON;
+ checkNode: (treeNode: ITreeNode, checked?: boolean, checkTypeFlag?: boolean, callbackFlag?: boolean) => void;
+ copyNode: (targetNode: object, treeNode: ITreeNode, moveType: string, isSilent: boolean) => ITreeNode;
destroy: () => void;
- editName: (treeNode: IJSON) => void;
+ editName: (treeNode: ITreeNode) => void;
expandAll: (expandFlag: boolean) => boolean | null;
- expandNode: (treeNode: IJSON, expandFlag?: boolean, sonSign?: boolean, focus?: boolean, callbackFlag?: boolean) => boolean | null;
- getChangeCheckedNodes: () => IJSON[];
- getCheckedNodes: (checked?: boolean) => IJSON[];
+ expandNode: (treeNode: ITreeNode, expandFlag?: boolean, sonSign?: boolean, focus?: boolean, callbackFlag?: boolean) => boolean | null;
+ getChangeCheckedNodes: () => ITreeNode[];
+ getCheckedNodes: (checked?: boolean) => ITreeNode[];
getNodeByParam: (key: string, value: any, parentNode?: object) => object;
- getNodeByTId: (tId: string) => object;
- getNodeIndex: (treeNode: IJSON) => number;
- getNodes: () => IJSON[];
- getNodesByFilter: (filter: filterFnType, isSingle?: boolean, parentNode?: IJSON, invokeParam?: any) => object;
+ getNodeByTId: (tId: string) => ITreeNode;
+ getNodeIndex: (treeNode: ITreeNode) => number;
+ getNodes: () => ITreeNode[];
+ getNodesByFilter: (filter: filterFnType, isSingle?: boolean, parentNode?: ITreeNode, invokeParam?: any) => any;
getNodesByParam: (key: string, value: any, parentNode?: object) => object;
getNodesByParamFuzzy: (key: string, value: string, parentNode?: object) => object;
- getSelectedNodes: () => any;
- hideNode: (treeNode: IJSON) => void;
- hideNodes: (treeNodes: IJSON[]) => void;
- moveNode: (targetNode: object, treeNode: IJSON, moveType: string, isSilent?: boolean) => IJSON;
- reAsyncChildNodes: (parentNode: IJSON, reloadType: string, isSilent?: boolean, callback?: any) => void;
- reAsyncChildNodesPromise: (parentNode: IJSON, reloadType: string, isSilent?: boolean) => any; // ps: return Promise object
+ getSelectedNodes: (isTure: boolean) => any;
+ hideNode: (treeNode: ITreeNode) => void;
+ hideNodes: (treeNodes: ITreeNode[]) => void;
+ moveNode: (targetNode: object, treeNode: ITreeNode, moveType: string, isSilent?: boolean) => ITreeNode;
+ reAsyncChildNodes: (parentNode: ITreeNode, reloadType: string, isSilent?: boolean, callback?: any) => void;
+ reAsyncChildNodesPromise: (parentNode: ITreeNode, reloadType: string, isSilent?: boolean) => any; // ps: return Promise object
refresh: () => void;
- removeChildNodes: (parentNode: IJSON) => IJSON[];
- removeNode: (treeNode: IJSON, callbackFlag?: boolean) => void;
- selectNode: (treeNode: IJSON, addFlag?: boolean, isSilent?: boolean) => void;
- setChkDisabled: (treeNode: IJSON, disabled?: boolean, inheritParent?: boolean, inheritChildren?: boolean) => void;
+ removeChildNodes: (parentNode: ITreeNode) => ITreeNode[];
+ removeNode: (treeNode: ITreeNode, callbackFlag?: boolean) => void;
+ selectNode: (treeNode: ITreeNode, addFlag?: boolean, isSilent?: boolean) => void;
+ setChkDisabled: (treeNode: ITreeNode, disabled?: boolean, inheritParent?: boolean, inheritChildren?: boolean) => void;
setEditable: (editable: boolean) => void;
- showNode: (treeNode: IJSON) => void;
- showNodes: (treeNodes: IJSON[]) => void;
- transformToArray: (treeNodes: IJSON[] | IJSON) => IJSON[];
- transformTozTreeNodes: (simpleNodes: IJSON[] | IJSON) => IJSON[];
- updateNode: (treeNode: IJSON, checkTypeFlag?: boolean) => void;
+ showNode: (treeNode: ITreeNode) => void;
+ showNodes: (treeNodes: ITreeNode[]) => void;
+ transformToArray: (treeNodes: ITreeNode[] | ITreeNode) => ITreeNode[];
+ transformTozTreeNodes: (simpleNodes: ITreeNode[] | ITreeNode) => ITreeNode[];
+ updateNode: (treeNode: ITreeNode, checkTypeFlag?: boolean) => void;
+ updateNodeIconSkin: (treeNode: ITreeNode) => void;
}
interface IzTree {
- init?: (dom: any, setting: ISetting, zNodes: IJSON[] | object) => IzTreeObj;
+ init?: (dom: any, setting: ISetting, zNodes: ITreeNode[] | object) => IzTreeObj;
getZTreeObj?: (treeId: string) => IzTreeObj;
destroy?: (treeId: string) => void;
_z?: any;
-}
+}
\ No newline at end of file
diff --git a/js/jquery.ztree.all.js b/js/jquery.ztree.all.js
index 8c2788393..65202b9bf 100644
--- a/js/jquery.ztree.all.js
+++ b/js/jquery.ztree.all.js
@@ -1,6 +1,6 @@
/*
* JQuery zTree core
- * v3.5.42
+ * v3.5.43
* http://treejs.cn/
*
* Copyright (c) 2010 Hunter.z
@@ -8,7 +8,7 @@
* Licensed same as jquery - MIT License
* http://www.opensource.org/licenses/mit-license.php
*
- * Date: 2020-01-19
+ * Date: 2020-04-04
*/
(function ($) {
@@ -67,6 +67,7 @@
dblClickExpand: true,
expandSpeed: "fast",
fontCss: {},
+ nodeClasses: {},
nameIsHTML: false,
selectedMulti: true,
showIcon: true,
@@ -1323,11 +1324,14 @@
var title = data.nodeTitle(setting, node),
url = view.makeNodeUrl(setting, node),
fontcss = view.makeNodeFontCss(setting, node),
+ nodeClasses = view.makeNodeClasses(setting, node),
fontStyle = [];
for (var f in fontcss) {
fontStyle.push(f, ":", fontcss[f], ";");
}
- html.push(" 0) ? "href='" + url + "'" : ""), " target='", view.makeNodeTarget(node), "' style='", fontStyle.join(''),
"'");
if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle) && title) {
@@ -1339,6 +1343,10 @@
var fontCss = tools.apply(setting.view.fontCss, [setting.treeId, node], setting.view.fontCss);
return (fontCss && ((typeof fontCss) != "function")) ? fontCss : {};
},
+ makeNodeClasses: function (setting, node) {
+ var classes = tools.apply(setting.view.nodeClasses, [setting.treeId, node], setting.view.nodeClasses);
+ return (classes && (typeof classes !== "function")) ? classes : {add:[], remove:[]};
+ },
makeNodeIcoClass: function (setting, node) {
var icoCss = ["ico"];
if (!node.isAjaxing) {
@@ -1641,6 +1649,16 @@
aObj.css(fontCss);
}
},
+ setNodeClasses: function (setting, treeNode) {
+ var aObj = $$(treeNode, consts.id.A, setting),
+ classes = view.makeNodeClasses(setting, treeNode);
+ if ('add' in classes && classes.add.length) {
+ aObj.addClass(classes.add.join(' '));
+ }
+ if ('remove' in classes && classes.remove.length) {
+ aObj.removeClass(classes.remove.join(' '));
+ }
+ },
setNodeLineIcos: function (setting, node) {
if (!node) return;
var switchObj = $$(node, consts.id.SWITCH, setting),
@@ -1966,6 +1984,7 @@
view.setNodeUrl(setting, node);
view.setNodeLineIcos(setting, node);
view.setNodeFontCss(setting, node);
+ view.setNodeClasses(setting, node);
}
}
};
@@ -1987,7 +2006,7 @@
})(jQuery);
/*
* JQuery zTree excheck
- * v3.5.42
+ * v3.5.43
* http://treejs.cn/
*
* Copyright (c) 2010 Hunter.z
@@ -1995,7 +2014,7 @@
* Licensed same as jquery - MIT License
* http://www.opensource.org/licenses/mit-license.php
*
- * Date: 2020-01-19
+ * Date: 2020-04-04
*/
(function ($) {
@@ -2639,7 +2658,7 @@
})(jQuery);
/*
* JQuery zTree exedit
- * v3.5.42
+ * v3.5.43
* http://treejs.cn/
*
* Copyright (c) 2010 Hunter.z
@@ -2647,7 +2666,7 @@
* Licensed same as jquery - MIT License
* http://www.opensource.org/licenses/mit-license.php
*
- * Date: 2020-01-19
+ * Date: 2020-04-04
*/
(function ($) {
diff --git a/js/jquery.ztree.all.min.js b/js/jquery.ztree.all.min.js
index 274165d44..feabc33df 100644
--- a/js/jquery.ztree.all.min.js
+++ b/js/jquery.ztree.all.min.js
@@ -1,3 +1,3 @@
-!function($){var settings={},roots={},caches={},_consts={className:{BUTTON:"button",LEVEL:"level",ICO_LOADING:"ico_loading",SWITCH:"switch",NAME:"node_name"},event:{NODECREATED:"ztree_nodeCreated",CLICK:"ztree_click",EXPAND:"ztree_expand",COLLAPSE:"ztree_collapse",ASYNC_SUCCESS:"ztree_async_success",ASYNC_ERROR:"ztree_async_error",REMOVE:"ztree_remove",SELECTED:"ztree_selected",UNSELECTED:"ztree_unselected"},id:{A:"_a",ICON:"_ico",SPAN:"_span",SWITCH:"_switch",UL:"_ul"},line:{ROOT:"root",ROOTS:"roots",CENTER:"center",BOTTOM:"bottom",NOLINE:"noline",LINE:"line"},folder:{OPEN:"open",CLOSE:"close",DOCU:"docu"},node:{CURSELECTED:"curSelectedNode"}},_setting={treeId:"",treeObj:null,view:{addDiyDom:null,autoCancelSelected:!0,dblClickExpand:!0,expandSpeed:"fast",fontCss:{},nameIsHTML:!1,selectedMulti:!0,showIcon:!0,showLine:!0,showTitle:!0,txtSelectedEnable:!1},data:{key:{isParent:"isParent",children:"children",name:"name",title:"",url:"url",icon:"icon"},simpleData:{enable:!1,idKey:"id",pIdKey:"pId",rootPId:null},keep:{parent:!1,leaf:!1}},async:{enable:!1,contentType:"application/x-www-form-urlencoded",type:"post",dataType:"text",headers:{},xhrFields:{},url:"",autoParam:[],otherParam:[],dataFilter:null},callback:{beforeAsync:null,beforeClick:null,beforeDblClick:null,beforeRightClick:null,beforeMouseDown:null,beforeMouseUp:null,beforeExpand:null,beforeCollapse:null,beforeRemove:null,onAsyncError:null,onAsyncSuccess:null,onNodeCreated:null,onClick:null,onDblClick:null,onRightClick:null,onMouseDown:null,onMouseUp:null,onExpand:null,onCollapse:null,onRemove:null}},_initRoot=function(e){var t=data.getRoot(e);t||(t={},data.setRoot(e,t)),data.nodeChildren(e,t,[]),t.expandTriggerFlag=!1,t.curSelectedList=[],t.noSelection=!0,t.createdNodes=[],t.zId=0,t._ver=(new Date).getTime()},_initCache=function(e){var t=data.getCache(e);t||(t={},data.setCache(e,t)),t.nodes=[],t.doms=[]},_bindEvent=function(d){var e=d.treeObj,t=consts.event;e.bind(t.NODECREATED,function(e,t,n){tools.apply(d.callback.onNodeCreated,[e,t,n])}),e.bind(t.CLICK,function(e,t,n,o,a){tools.apply(d.callback.onClick,[t,n,o,a])}),e.bind(t.EXPAND,function(e,t,n){tools.apply(d.callback.onExpand,[e,t,n])}),e.bind(t.COLLAPSE,function(e,t,n){tools.apply(d.callback.onCollapse,[e,t,n])}),e.bind(t.ASYNC_SUCCESS,function(e,t,n,o){tools.apply(d.callback.onAsyncSuccess,[e,t,n,o])}),e.bind(t.ASYNC_ERROR,function(e,t,n,o,a,r){tools.apply(d.callback.onAsyncError,[e,t,n,o,a,r])}),e.bind(t.REMOVE,function(e,t,n){tools.apply(d.callback.onRemove,[e,t,n])}),e.bind(t.SELECTED,function(e,t,n){tools.apply(d.callback.onSelected,[t,n])}),e.bind(t.UNSELECTED,function(e,t,n){tools.apply(d.callback.onUnSelected,[t,n])})},_unbindEvent=function(e){var t=e.treeObj,n=consts.event;t.unbind(n.NODECREATED).unbind(n.CLICK).unbind(n.EXPAND).unbind(n.COLLAPSE).unbind(n.ASYNC_SUCCESS).unbind(n.ASYNC_ERROR).unbind(n.REMOVE).unbind(n.SELECTED).unbind(n.UNSELECTED)},_eventProxy=function(e){var t=e.target,n=data.getSetting(e.data.treeId),o="",a=null,r="",d="",i=null,s=null,l=null;if(tools.eqs(e.type,"mousedown")?d="mousedown":tools.eqs(e.type,"mouseup")?d="mouseup":tools.eqs(e.type,"contextmenu")?d="contextmenu":tools.eqs(e.type,"click")?tools.eqs(t.tagName,"span")&&null!==t.getAttribute("treeNode"+consts.id.SWITCH)?(o=tools.getNodeMainDom(t).id,r="switchNode"):(l=tools.getMDom(n,t,[{tagName:"a",attrName:"treeNode"+consts.id.A}]))&&(o=tools.getNodeMainDom(l).id,r="clickNode"):tools.eqs(e.type,"dblclick")&&(d="dblclick",(l=tools.getMDom(n,t,[{tagName:"a",attrName:"treeNode"+consts.id.A}]))&&(o=tools.getNodeMainDom(l).id,r="switchNode")),0=r.length&&(n=-1):(r=data.nodeChildren(e,t,[]),n=-1),0=u.length-n.length)&&(a=-1);for(var p=0,f=n.length;p/g,">");e.push("",a,"")},makeDOMNodeLine:function(e,t,n){e.push("")},makeDOMNodeMainAfter:function(e,t,n){e.push("")},makeDOMNodeMainBefore:function(e,t,n){e.push("")},makeDOMNodeNameAfter:function(e,t,n){e.push("")},makeDOMNodeNameBefore:function(e,t,n){var o=data.nodeTitle(t,n),a=view.makeNodeUrl(t,n),r=view.makeNodeFontCss(t,n),d=[];for(var i in r)d.push(i,":",r[i],";");e.push("/g,">"),"'"),e.push(">")},makeNodeFontCss:function(e,t){var n=tools.apply(e.view.fontCss,[e.treeId,t],e.view.fontCss);return n&&"function"!=typeof n?n:{}},makeNodeIcoClass:function(e,t){var n=["ico"];if(!t.isAjaxing){var o=data.nodeIsParent(e,t);n[0]=(t.iconSkin?t.iconSkin+"_":"")+n[0],o?n.push(t.open?consts.folder.OPEN:consts.folder.CLOSE):n.push(consts.folder.DOCU)}return consts.className.BUTTON+" "+n.join("_")},makeNodeIcoStyle:function(e,t){var n=[];if(!t.isAjaxing){var o=data.nodeIsParent(e,t)&&t.iconOpen&&t.iconClose?t.open?t.iconOpen:t.iconClose:t[e.data.key.icon];o&&n.push("background:url(",o,") 0 0 no-repeat;"),0!=e.view.showIcon&&tools.apply(e.view.showIcon,[e.treeId,t],!0)||n.push("display:none;")}return n.join("")},makeNodeLineClass:function(e,t){var n=[];return e.view.showLine?0==t.level&&t.isFirstNode&&t.isLastNode?n.push(consts.line.ROOT):0==t.level&&t.isFirstNode?n.push(consts.line.ROOTS):t.isLastNode?n.push(consts.line.BOTTOM):n.push(consts.line.CENTER):n.push(consts.line.NOLINE),data.nodeIsParent(e,t)?n.push(t.open?consts.folder.OPEN:consts.folder.CLOSE):n.push(consts.folder.DOCU),view.makeNodeLineClassEx(t)+n.join("_")},makeNodeLineClassEx:function(e){return consts.className.BUTTON+" "+consts.className.LEVEL+e.level+" "+consts.className.SWITCH+" "},makeNodeTarget:function(e){return e.target||"_blank"},makeNodeUrl:function(e,t){var n=e.data.key.url;return t[n]?t[n]:null},makeUlHtml:function(e,t,n,o){n.push("")},makeUlLineClass:function(e,t){return e.view.showLine&&!t.isLastNode?consts.line.LINE:""},removeChildNodes:function(e,t){if(t){var n=data.nodeChildren(e,t);if(n){for(var o=0,a=n.length;on.bottom||o.right>n.right||o.left=r.length&&(n=-1):(r=data.nodeChildren(e,t,[]),n=-1),0=u.length-n.length)&&(a=-1);for(var p=0,f=n.length;p/g,">");e.push("",a,"")},makeDOMNodeLine:function(e,t,n){e.push("")},makeDOMNodeMainAfter:function(e,t,n){e.push("")},makeDOMNodeMainBefore:function(e,t,n){e.push("")},makeDOMNodeNameAfter:function(e,t,n){e.push("")},makeDOMNodeNameBefore:function(e,t,n){var o=data.nodeTitle(t,n),a=view.makeNodeUrl(t,n),r=view.makeNodeFontCss(t,n),d=view.makeNodeClasses(t,n),i=[];for(var s in r)i.push(s,":",r[s],";");e.push("/g,">"),"'"),e.push(">")},makeNodeFontCss:function(e,t){var n=tools.apply(e.view.fontCss,[e.treeId,t],e.view.fontCss);return n&&"function"!=typeof n?n:{}},makeNodeClasses:function(e,t){var n=tools.apply(e.view.nodeClasses,[e.treeId,t],e.view.nodeClasses);return n&&"function"!=typeof n?n:{add:[],remove:[]}},makeNodeIcoClass:function(e,t){var n=["ico"];if(!t.isAjaxing){var o=data.nodeIsParent(e,t);n[0]=(t.iconSkin?t.iconSkin+"_":"")+n[0],o?n.push(t.open?consts.folder.OPEN:consts.folder.CLOSE):n.push(consts.folder.DOCU)}return consts.className.BUTTON+" "+n.join("_")},makeNodeIcoStyle:function(e,t){var n=[];if(!t.isAjaxing){var o=data.nodeIsParent(e,t)&&t.iconOpen&&t.iconClose?t.open?t.iconOpen:t.iconClose:t[e.data.key.icon];o&&n.push("background:url(",o,") 0 0 no-repeat;"),0!=e.view.showIcon&&tools.apply(e.view.showIcon,[e.treeId,t],!0)||n.push("display:none;")}return n.join("")},makeNodeLineClass:function(e,t){var n=[];return e.view.showLine?0==t.level&&t.isFirstNode&&t.isLastNode?n.push(consts.line.ROOT):0==t.level&&t.isFirstNode?n.push(consts.line.ROOTS):t.isLastNode?n.push(consts.line.BOTTOM):n.push(consts.line.CENTER):n.push(consts.line.NOLINE),data.nodeIsParent(e,t)?n.push(t.open?consts.folder.OPEN:consts.folder.CLOSE):n.push(consts.folder.DOCU),view.makeNodeLineClassEx(t)+n.join("_")},makeNodeLineClassEx:function(e){return consts.className.BUTTON+" "+consts.className.LEVEL+e.level+" "+consts.className.SWITCH+" "},makeNodeTarget:function(e){return e.target||"_blank"},makeNodeUrl:function(e,t){var n=e.data.key.url;return t[n]?t[n]:null},makeUlHtml:function(e,t,n,o){n.push("")},makeUlLineClass:function(e,t){return e.view.showLine&&!t.isLastNode?consts.line.LINE:""},removeChildNodes:function(e,t){if(t){var n=data.nodeChildren(e,t);if(n){for(var o=0,a=n.length;on.bottom||o.right>n.right||o.left"))}),C.addZTreeTools(function(i,h){h.checkNode=function(e,t,c,h){var a=C.nodeChecked(i,e);if(!0!==e.chkDisabled&&(!0!==t&&!1!==t&&(t=!a),h=!!h,(a!==t||c)&&(!h||0!=o.apply(this.setting.callback.beforeCheck,[this.setting.treeId,e],!0))&&o.uCanDo(this.setting)&&this.setting.check.enable&&!0!==e.nocheck)){C.nodeChecked(i,e,t);var n=f(e,s.id.CHECK,this.setting);!c&&this.setting.check.chkStyle!==s.radio.STYLE||l.checkNodeRelation(this.setting,e),l.setChkClass(this.setting,n,e),l.repairParentChkClassWithSelf(this.setting,e),h&&this.setting.treeObj.trigger(s.event.CHECK,[null,this.setting.treeId,e])}},h.checkAllNodes=function(e){l.repairAllChk(this.setting,!!e)},h.getCheckedNodes=function(e){e=!1!==e;var t=C.nodeChildren(i,C.getRoot(this.setting));return C.getTreeCheckedNodes(this.setting,t,e)},h.getChangeCheckedNodes=function(){var e=C.nodeChildren(i,C.getRoot(this.setting));return C.getTreeChangeCheckedNodes(this.setting,e)},h.setChkDisabled=function(e,t,c,h){t=!!t,c=!!c,h=!!h,l.repairSonChkDisabled(this.setting,e,t,h),l.repairParentChkDisabled(this.setting,e.getParentNode(),t,c)};var a=h.updateNode;h.updateNode=function(e,t){if((a&&a.apply(h,arguments),e&&this.setting.check.enable)&&(f(e,this.setting).get(0)&&o.uCanDo(this.setting))){var c=f(e,s.id.CHECK,this.setting);1!=t&&this.setting.check.chkStyle!==s.radio.STYLE||l.checkNodeRelation(this.setting,e),l.setChkClass(this.setting,c,e),l.repairParentChkClassWithSelf(this.setting,e)}}});var n=l.createNodes;l.createNodes=function(e,t,c,h,a){n&&n.apply(l,arguments),c&&l.repairParentChkClassWithSelf(e,h)};var i=l.removeNode;l.removeNode=function(e,t){var c=t.getParentNode();i&&i.apply(l,arguments),t&&c&&(l.repairChkClass(e,c),l.repairParentChkClass(e,c))};var d=l.appendNodes;l.appendNodes=function(e,t,c,h,a,n,i){var r="";return d&&(r=d.apply(l,arguments)),h&&C.makeChkFlag(e,h),r}}(jQuery);
!function(fe){var Ee={event:{DRAG:"ztree_drag",DROP:"ztree_drop",RENAME:"ztree_rename",DRAGMOVE:"ztree_dragmove"},id:{EDIT:"_edit",INPUT:"_input",REMOVE:"_remove"},move:{TYPE_INNER:"inner",TYPE_PREV:"prev",TYPE_NEXT:"next"},node:{CURSELECTED_EDIT:"curSelectedNode_Edit",TMPTARGET_TREE:"tmpTargetzTree",TMPTARGET_NODE:"tmpTargetNode"}},s={onHoverOverNode:function(e,t){var o=Re.getSetting(e.data.treeId),d=Re.getRoot(o);d.curHoverNode!=t&&s.onHoverOutNode(e),d.curHoverNode=t,be.addHoverDom(o,t)},onHoverOutNode:function(e,t){var o=Re.getSetting(e.data.treeId),d=Re.getRoot(o);d.curHoverNode&&!Re.isSelectedNode(o,d.curHoverNode)&&(be.removeTreeDom(o,d.curHoverNode),d.curHoverNode=null)},onMousedownNode:function(e,t){var o,d,Z=Re.getSetting(e.data.treeId),$=Re.getRoot(Z),J=Re.getRoots();if(2==e.button||!Z.edit.enable||!Z.edit.drag.isCopy&&!Z.edit.drag.isMove)return!0;var r=e.target,n=Re.getRoot(Z).curSelectedList,ee=[];if(Re.isSelectedNode(Z,t))for(o=0,d=n.length;o",Z),t=0,o=ee.length;tZ.edit.drag.maxShowNodeNum-1||((r=Pe("",Z)).append(Pe(d,he.id.A,Z).clone()),r.css("padding","0"),r.children("#"+d.tId+he.id.A).removeClass(he.node.CURSELECTED),te.append(r),t==Z.edit.drag.maxShowNodeNum-1&&(r=Pe(" ... ",Z),te.append(r)));te.attr("id",ee[0].tId+he.id.UL+"_tmp"),te.addClass(Z.treeObj.attr("class")),te.appendTo(ie),(oe=Pe("",Z)).attr("id","zTreeMove_arrow_tmp"),oe.appendTo(ie),Z.treeObj.trigger(he.event.DRAG,[e,Z.treeId,ee])}if(1==$.dragFlag){if(de&&oe.attr("id")==e.target.id&&ue&&e.clientX+ae.scrollLeft()+2>fe("#"+ue+he.id.A,de).offset().left){var s=fe("#"+ue+he.id.A,de);e.target=0Z.edit.drag.borderMin,b=fZ.edit.drag.borderMin,R=EZ.edit.drag.borderMin,P=IZ.edit.drag.borderMin,C=T>Z.edit.drag.borderMin&&f>Z.edit.drag.borderMin&&E>Z.edit.drag.borderMin&&I>Z.edit.drag.borderMin,w=h&&se.treeObj.scrollTop()<=0,M=b&&se.treeObj.scrollTop()+se.treeObj.height()+10>=m,_=R&&se.treeObj.scrollLeft()<=0,O=P&&se.treeObj.scrollLeft()+se.treeObj.width()+10>=p;if(e.target&&Ie.isChildOrSelf(e.target,se.treeId)){for(var D=e.target;D&&D.tagName&&!Ie.eqs(D.tagName,"li")&&D.id!=se.treeId;)D=D.parentNode;var y=!0;for(t=0,o=ee.length;tse.edit.drag.autoOpenTime&&Ie.apply(se.callback.beforeDragOpen,[se.treeId,A],!0)&&(be.switchNode(se,A),se.edit.drag.autoExpandTrigger&&se.treeObj.trigger(he.event.EXPAND,[se.treeId,A]))},se.edit.drag.autoOpenTime+50),window.zTreeMoveTargetNodeTId=A.tId)}}else F()}else ge=he.move.TYPE_INNER,de&&Ie.apply(se.edit.drag.inner,[se.treeId,ee,null],!!se.edit.drag.inner)?de.addClass(he.node.TMPTARGET_TREE):de=null,oe.css({display:"none"}),window.zTreeMoveTimer&&(clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null);ce=ue,Ne=ge,Z.treeObj.trigger(he.event.DRAGMOVE,[e,Z.treeId,ee])}return!1}function Te(d){if(window.zTreeMoveTimer&&(clearTimeout(window.zTreeMoveTimer),window.zTreeMoveTargetNodeTId=null),Ne=ce=null,ae.unbind("mousemove",s),ae.unbind("mouseup",Te),ae.unbind("selectstart",c),ie.css("cursor",""),de&&(de.removeClass(he.node.TMPTARGET_TREE),ue&&fe("#"+ue+he.id.A,de).removeClass(he.node.TMPTARGET_NODE+"_"+he.move.TYPE_PREV).removeClass(he.node.TMPTARGET_NODE+"_"+Ee.move.TYPE_NEXT).removeClass(he.node.TMPTARGET_NODE+"_"+Ee.move.TYPE_INNER)),Ie.showIfameMask(Z,!1),J.showHoverDom=!0,0!=$.dragFlag){var e,t,o;for(e=$.dragFlag=0,t=ee.length;e",e);l.appendTo(Pe("body",e)),o.dragMaskList.push(l)}}},view:{addEditBtn:function(e,t){if(!(t.editNameFlag||0";o.append(d),Pe(t,he.id.EDIT,e).bind("click",function(){return Ie.uCanDo(e)&&0!=Ie.apply(e.callback.beforeEditName,[e.treeId,t],!0)&&be.editNode(e,t),!1}).show()}},addRemoveBtn:function(e,t){if(!(t.editNameFlag||0";o.append(d),Pe(t,he.id.REMOVE,e).bind("click",function(){return Ie.uCanDo(e)&&0!=Ie.apply(e.callback.beforeRemove,[e.treeId,t],!0)&&(be.removeNode(e,t),e.treeObj.trigger(he.event.REMOVE,[e.treeId,t])),!1}).bind("mousedown",function(e){return!0}).show()}},addHoverDom:function(e,t){Re.getRoots().showHoverDom&&(t.isHover=!0,e.edit.enable&&(be.addEditBtn(e,t),be.addRemoveBtn(e,t)),Ie.apply(e.view.addHoverDom,[e.treeId,t]))},cancelCurEditNode:function(e,t,o){var d=Re.getRoot(e),r=d.curEditNode;if(r){var n=d.curEditInput,a=t||(o?Re.nodeName(e,r):n.val());if(!1===Ie.apply(e.callback.beforeRename,[e.treeId,r,a,o],!0))return!1;Re.nodeName(e,r,a),Pe(r,he.id.A,e).removeClass(he.node.CURSELECTED_EDIT),n.unbind(),be.setNodeName(e,r),r.editNameFlag=!1,d.curEditNode=null,d.curEditInput=null,be.selectNode(e,r,!1),e.treeObj.trigger(he.event.RENAME,[e.treeId,r,o])}return d.noSelection=!0},editNode:function(t,e){var o=Re.getRoot(t);if(be.editNodeBlur=!1,Re.isSelectedNode(t,e)&&o.curEditNode==e&&e.editNameFlag)setTimeout(function(){Ie.inputFocus(o.curEditInput)},0);else{e.editNameFlag=!0,be.removeTreeDom(t,e),be.cancelCurEditNode(t),be.selectNode(t,e,!1),Pe(e,he.id.SPAN,t).html("");var d=Pe(e,he.id.INPUT,t);d.attr("value",Re.nodeName(t,e)),t.edit.editNameSelectAll?Ie.inputSelect(d):Ie.inputFocus(d),d.bind("blur",function(e){be.editNodeBlur||be.cancelCurEditNode(t)}).bind("keydown",function(e){"13"==e.keyCode?(be.editNodeBlur=!0,be.cancelCurEditNode(t)):"27"==e.keyCode&&be.cancelCurEditNode(t,null,!0)}).bind("click",function(e){return!1}).bind("dblclick",function(e){return!1}),Pe(e,he.id.A,t).addClass(he.node.CURSELECTED_EDIT),o.curEditInput=d,o.noSelection=!1,o.curEditNode=e}},moveNode:function(e,t,o,d,r,n){var a=Re.getRoot(e);if(t!=o&&(!e.data.keep.leaf||!t||Re.nodeIsParent(e,t)||d!=he.move.TYPE_INNER)){var i=o.parentTId?o.getParentNode():a,l=null===t||t==a;l&&null===t&&(t=a),l&&(d=he.move.TYPE_INNER);var s,c,N=t.parentTId?t.getParentNode():a;if(d!=he.move.TYPE_PREV&&d!=he.move.TYPE_NEXT&&(d=he.move.TYPE_INNER),d==he.move.TYPE_INNER&&(l?o.parentTId=null:(Re.nodeIsParent(e,t)||(Re.nodeIsParent(e,t,!0),t.open=!!t.open,be.setNodeLineIcos(e,t)),o.parentTId=t.tId)),l)c=s=e.treeObj;else{if(n||d!=he.move.TYPE_INNER?n||be.expandCollapseNode(e,t.getParentNode(),!0,!1):be.expandCollapseNode(e,t,!0,!1),s=Pe(t,e),c=Pe(t,he.id.UL,e),s.get(0)&&!c.get(0)){var u=[];be.makeUlHtml(e,t,u,""),s.append(u.join(""))}c=Pe(t,he.id.UL,e)}var g=Pe(o,e);g.get(0)?s.get(0)||g.remove():g=be.appendNodes(e,o.level,[o],null,-1,!1,!0).join(""),c.get(0)&&d==he.move.TYPE_INNER?c.append(g):s.get(0)&&d==he.move.TYPE_PREV?s.before(g):s.get(0)&&d==he.move.TYPE_NEXT&&s.after(g);var v,m,p=-1,T=0,f=null,E=null,I=o.level,h=Re.nodeChildren(e,i),b=Re.nodeChildren(e,N),R=Re.nodeChildren(e,t);if(o.isFirstNode)p=0,1 0) ? "href='" + url + "'" : ""), " target='", view.makeNodeTarget(node), "' style='", fontStyle.join(''),
"'");
if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle) && title) {
@@ -1339,6 +1343,10 @@
var fontCss = tools.apply(setting.view.fontCss, [setting.treeId, node], setting.view.fontCss);
return (fontCss && ((typeof fontCss) != "function")) ? fontCss : {};
},
+ makeNodeClasses: function (setting, node) {
+ var classes = tools.apply(setting.view.nodeClasses, [setting.treeId, node], setting.view.nodeClasses);
+ return (classes && (typeof classes !== "function")) ? classes : {add:[], remove:[]};
+ },
makeNodeIcoClass: function (setting, node) {
var icoCss = ["ico"];
if (!node.isAjaxing) {
@@ -1641,6 +1649,16 @@
aObj.css(fontCss);
}
},
+ setNodeClasses: function (setting, treeNode) {
+ var aObj = $$(treeNode, consts.id.A, setting),
+ classes = view.makeNodeClasses(setting, treeNode);
+ if ('add' in classes && classes.add.length) {
+ aObj.addClass(classes.add.join(' '));
+ }
+ if ('remove' in classes && classes.remove.length) {
+ aObj.removeClass(classes.remove.join(' '));
+ }
+ },
setNodeLineIcos: function (setting, node) {
if (!node) return;
var switchObj = $$(node, consts.id.SWITCH, setting),
@@ -1966,6 +1984,7 @@
view.setNodeUrl(setting, node);
view.setNodeLineIcos(setting, node);
view.setNodeFontCss(setting, node);
+ view.setNodeClasses(setting, node);
}
}
};
diff --git a/js/jquery.ztree.core.min.js b/js/jquery.ztree.core.min.js
index 6887da993..3eea2ac6c 100644
--- a/js/jquery.ztree.core.min.js
+++ b/js/jquery.ztree.core.min.js
@@ -1 +1 @@
-!function($){var settings={},roots={},caches={},_consts={className:{BUTTON:"button",LEVEL:"level",ICO_LOADING:"ico_loading",SWITCH:"switch",NAME:"node_name"},event:{NODECREATED:"ztree_nodeCreated",CLICK:"ztree_click",EXPAND:"ztree_expand",COLLAPSE:"ztree_collapse",ASYNC_SUCCESS:"ztree_async_success",ASYNC_ERROR:"ztree_async_error",REMOVE:"ztree_remove",SELECTED:"ztree_selected",UNSELECTED:"ztree_unselected"},id:{A:"_a",ICON:"_ico",SPAN:"_span",SWITCH:"_switch",UL:"_ul"},line:{ROOT:"root",ROOTS:"roots",CENTER:"center",BOTTOM:"bottom",NOLINE:"noline",LINE:"line"},folder:{OPEN:"open",CLOSE:"close",DOCU:"docu"},node:{CURSELECTED:"curSelectedNode"}},_setting={treeId:"",treeObj:null,view:{addDiyDom:null,autoCancelSelected:!0,dblClickExpand:!0,expandSpeed:"fast",fontCss:{},nameIsHTML:!1,selectedMulti:!0,showIcon:!0,showLine:!0,showTitle:!0,txtSelectedEnable:!1},data:{key:{isParent:"isParent",children:"children",name:"name",title:"",url:"url",icon:"icon"},simpleData:{enable:!1,idKey:"id",pIdKey:"pId",rootPId:null},keep:{parent:!1,leaf:!1}},async:{enable:!1,contentType:"application/x-www-form-urlencoded",type:"post",dataType:"text",headers:{},xhrFields:{},url:"",autoParam:[],otherParam:[],dataFilter:null},callback:{beforeAsync:null,beforeClick:null,beforeDblClick:null,beforeRightClick:null,beforeMouseDown:null,beforeMouseUp:null,beforeExpand:null,beforeCollapse:null,beforeRemove:null,onAsyncError:null,onAsyncSuccess:null,onNodeCreated:null,onClick:null,onDblClick:null,onRightClick:null,onMouseDown:null,onMouseUp:null,onExpand:null,onCollapse:null,onRemove:null}},_initRoot=function(e){var t=data.getRoot(e);t||(t={},data.setRoot(e,t)),data.nodeChildren(e,t,[]),t.expandTriggerFlag=!1,t.curSelectedList=[],t.noSelection=!0,t.createdNodes=[],t.zId=0,t._ver=(new Date).getTime()},_initCache=function(e){var t=data.getCache(e);t||(t={},data.setCache(e,t)),t.nodes=[],t.doms=[]},_bindEvent=function(d){var e=d.treeObj,t=consts.event;e.bind(t.NODECREATED,function(e,t,n){tools.apply(d.callback.onNodeCreated,[e,t,n])}),e.bind(t.CLICK,function(e,t,n,o,a){tools.apply(d.callback.onClick,[t,n,o,a])}),e.bind(t.EXPAND,function(e,t,n){tools.apply(d.callback.onExpand,[e,t,n])}),e.bind(t.COLLAPSE,function(e,t,n){tools.apply(d.callback.onCollapse,[e,t,n])}),e.bind(t.ASYNC_SUCCESS,function(e,t,n,o){tools.apply(d.callback.onAsyncSuccess,[e,t,n,o])}),e.bind(t.ASYNC_ERROR,function(e,t,n,o,a,r){tools.apply(d.callback.onAsyncError,[e,t,n,o,a,r])}),e.bind(t.REMOVE,function(e,t,n){tools.apply(d.callback.onRemove,[e,t,n])}),e.bind(t.SELECTED,function(e,t,n){tools.apply(d.callback.onSelected,[t,n])}),e.bind(t.UNSELECTED,function(e,t,n){tools.apply(d.callback.onUnSelected,[t,n])})},_unbindEvent=function(e){var t=e.treeObj,n=consts.event;t.unbind(n.NODECREATED).unbind(n.CLICK).unbind(n.EXPAND).unbind(n.COLLAPSE).unbind(n.ASYNC_SUCCESS).unbind(n.ASYNC_ERROR).unbind(n.REMOVE).unbind(n.SELECTED).unbind(n.UNSELECTED)},_eventProxy=function(e){var t=e.target,n=data.getSetting(e.data.treeId),o="",a=null,r="",d="",i=null,s=null,l=null;if(tools.eqs(e.type,"mousedown")?d="mousedown":tools.eqs(e.type,"mouseup")?d="mouseup":tools.eqs(e.type,"contextmenu")?d="contextmenu":tools.eqs(e.type,"click")?tools.eqs(t.tagName,"span")&&null!==t.getAttribute("treeNode"+consts.id.SWITCH)?(o=tools.getNodeMainDom(t).id,r="switchNode"):(l=tools.getMDom(n,t,[{tagName:"a",attrName:"treeNode"+consts.id.A}]))&&(o=tools.getNodeMainDom(l).id,r="clickNode"):tools.eqs(e.type,"dblclick")&&(d="dblclick",(l=tools.getMDom(n,t,[{tagName:"a",attrName:"treeNode"+consts.id.A}]))&&(o=tools.getNodeMainDom(l).id,r="switchNode")),0=r.length&&(n=-1):(r=data.nodeChildren(e,t,[]),n=-1),0=u.length-n.length)&&(a=-1);for(var p=0,f=n.length;p/g,">");e.push("",a,"")},makeDOMNodeLine:function(e,t,n){e.push("")},makeDOMNodeMainAfter:function(e,t,n){e.push("")},makeDOMNodeMainBefore:function(e,t,n){e.push("")},makeDOMNodeNameAfter:function(e,t,n){e.push("")},makeDOMNodeNameBefore:function(e,t,n){var o=data.nodeTitle(t,n),a=view.makeNodeUrl(t,n),r=view.makeNodeFontCss(t,n),d=[];for(var i in r)d.push(i,":",r[i],";");e.push("/g,">"),"'"),e.push(">")},makeNodeFontCss:function(e,t){var n=tools.apply(e.view.fontCss,[e.treeId,t],e.view.fontCss);return n&&"function"!=typeof n?n:{}},makeNodeIcoClass:function(e,t){var n=["ico"];if(!t.isAjaxing){var o=data.nodeIsParent(e,t);n[0]=(t.iconSkin?t.iconSkin+"_":"")+n[0],o?n.push(t.open?consts.folder.OPEN:consts.folder.CLOSE):n.push(consts.folder.DOCU)}return consts.className.BUTTON+" "+n.join("_")},makeNodeIcoStyle:function(e,t){var n=[];if(!t.isAjaxing){var o=data.nodeIsParent(e,t)&&t.iconOpen&&t.iconClose?t.open?t.iconOpen:t.iconClose:t[e.data.key.icon];o&&n.push("background:url(",o,") 0 0 no-repeat;"),0!=e.view.showIcon&&tools.apply(e.view.showIcon,[e.treeId,t],!0)||n.push("display:none;")}return n.join("")},makeNodeLineClass:function(e,t){var n=[];return e.view.showLine?0==t.level&&t.isFirstNode&&t.isLastNode?n.push(consts.line.ROOT):0==t.level&&t.isFirstNode?n.push(consts.line.ROOTS):t.isLastNode?n.push(consts.line.BOTTOM):n.push(consts.line.CENTER):n.push(consts.line.NOLINE),data.nodeIsParent(e,t)?n.push(t.open?consts.folder.OPEN:consts.folder.CLOSE):n.push(consts.folder.DOCU),view.makeNodeLineClassEx(t)+n.join("_")},makeNodeLineClassEx:function(e){return consts.className.BUTTON+" "+consts.className.LEVEL+e.level+" "+consts.className.SWITCH+" "},makeNodeTarget:function(e){return e.target||"_blank"},makeNodeUrl:function(e,t){var n=e.data.key.url;return t[n]?t[n]:null},makeUlHtml:function(e,t,n,o){n.push("")},makeUlLineClass:function(e,t){return e.view.showLine&&!t.isLastNode?consts.line.LINE:""},removeChildNodes:function(e,t){if(t){var n=data.nodeChildren(e,t);if(n){for(var o=0,a=n.length;on.bottom||o.right>n.right||o.left=r.length&&(n=-1):(r=data.nodeChildren(e,t,[]),n=-1),0=u.length-n.length)&&(a=-1);for(var p=0,f=n.length;p/g,">");e.push("",a,"")},makeDOMNodeLine:function(e,t,n){e.push("")},makeDOMNodeMainAfter:function(e,t,n){e.push("")},makeDOMNodeMainBefore:function(e,t,n){e.push("")},makeDOMNodeNameAfter:function(e,t,n){e.push("")},makeDOMNodeNameBefore:function(e,t,n){var o=data.nodeTitle(t,n),a=view.makeNodeUrl(t,n),r=view.makeNodeFontCss(t,n),d=view.makeNodeClasses(t,n),i=[];for(var s in r)i.push(s,":",r[s],";");e.push("/g,">"),"'"),e.push(">")},makeNodeFontCss:function(e,t){var n=tools.apply(e.view.fontCss,[e.treeId,t],e.view.fontCss);return n&&"function"!=typeof n?n:{}},makeNodeClasses:function(e,t){var n=tools.apply(e.view.nodeClasses,[e.treeId,t],e.view.nodeClasses);return n&&"function"!=typeof n?n:{add:[],remove:[]}},makeNodeIcoClass:function(e,t){var n=["ico"];if(!t.isAjaxing){var o=data.nodeIsParent(e,t);n[0]=(t.iconSkin?t.iconSkin+"_":"")+n[0],o?n.push(t.open?consts.folder.OPEN:consts.folder.CLOSE):n.push(consts.folder.DOCU)}return consts.className.BUTTON+" "+n.join("_")},makeNodeIcoStyle:function(e,t){var n=[];if(!t.isAjaxing){var o=data.nodeIsParent(e,t)&&t.iconOpen&&t.iconClose?t.open?t.iconOpen:t.iconClose:t[e.data.key.icon];o&&n.push("background:url(",o,") 0 0 no-repeat;"),0!=e.view.showIcon&&tools.apply(e.view.showIcon,[e.treeId,t],!0)||n.push("display:none;")}return n.join("")},makeNodeLineClass:function(e,t){var n=[];return e.view.showLine?0==t.level&&t.isFirstNode&&t.isLastNode?n.push(consts.line.ROOT):0==t.level&&t.isFirstNode?n.push(consts.line.ROOTS):t.isLastNode?n.push(consts.line.BOTTOM):n.push(consts.line.CENTER):n.push(consts.line.NOLINE),data.nodeIsParent(e,t)?n.push(t.open?consts.folder.OPEN:consts.folder.CLOSE):n.push(consts.folder.DOCU),view.makeNodeLineClassEx(t)+n.join("_")},makeNodeLineClassEx:function(e){return consts.className.BUTTON+" "+consts.className.LEVEL+e.level+" "+consts.className.SWITCH+" "},makeNodeTarget:function(e){return e.target||"_blank"},makeNodeUrl:function(e,t){var n=e.data.key.url;return t[n]?t[n]:null},makeUlHtml:function(e,t,n,o){n.push("")},makeUlLineClass:function(e,t){return e.view.showLine&&!t.isLastNode?consts.line.LINE:""},removeChildNodes:function(e,t){if(t){var n=data.nodeChildren(e,t);if(n){for(var o=0,a=n.length;on.bottom||o.right>n.right||o.left
+*2020.04.04* v3.5.43
+ * fixed TypeScript type definition Thanks @UtillYou
+ * Update demo 'super/keyboard_navigation.html' Thanks @bseddon
+ * Update demo 'core/searchNodes.html' Thanks @bseddon
+ * add setting.view.nodeClasses Thanks @bseddon
+
*2020.03.02* v3.5.42
- * add demo 'Keyboard Navigation' Thanks @bseddon
+ * add demo 'super/keyboard_navigation.html' Thanks @bseddon
*2020.01.19* v3.5.42
* merge PullRequest(fixed 'HTMLElement undefined' error) Thanks @ChangJin0520
diff --git a/package.json b/package.json
index 1d7f73908..344818f37 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "@ztree/ztree_v3",
"description": "zTree is a multi-functional 'tree plug-ins.' based on jQuery. The main advantages of zTree includes excellent performance, flexible configuration, and the combination of multiple functions.",
- "version": "3.5.42",
+ "version": "3.5.43",
"homepage": "http://www.treejs.cn/v3/main.php",
"author": "zTree (https://github.com/zTree)",
"licenses": [
--
GitLab