From c5e2b4ade40c761a5dafd7fcb92cc12c2596b689 Mon Sep 17 00:00:00 2001 From: yiminghe Date: Wed, 20 Aug 2014 18:40:15 +0800 Subject: [PATCH] add domEvent for tree --- build/tree-min.js | 10 +- build/tree.js | 6 +- build/tree/assets/dpl-min.css | 2 +- build/tree/assets/dpl.css | 2 +- src/tree/coverage/src/tree/check-node.js | 177 +++--- src/tree/coverage/src/tree/node.js | 774 +++++++++++------------ src/tree/src/tree/check-node.js | 2 - src/tree/src/tree/node.js | 5 +- 8 files changed, 485 insertions(+), 493 deletions(-) diff --git a/build/tree-min.js b/build/tree-min.js index f57ba93b6e..90db3b4860 100644 --- a/build/tree-min.js +++ b/build/tree-min.js @@ -1,7 +1,7 @@ /* Copyright 2014, KISSY v1.47 MIT Licensed -build time: May 22 12:31 +build time: Aug 20 18:40 */ KISSY.add("tree/node-xtpl",["component/extension/content-xtpl"],function(i,f,g,k){return function(d){var a,h=this,b;a=this.config.utils;"undefined"!==typeof k&&k.kissy&&(b=k);var n=a.runBlockCommand,e=a.renderOutput,g=a.getProperty,i=a.runInlineCommand,o=a.getPropertyOrRunCommand;a='
\n
\n
\n ';c={};j=[];m=g(h,d,"checkable",0,10);j.push(m);c.params=j;c.fn=function(a){var l;l='\n
a?" dblclick ":"");this.$el.delegate(e,"."+d,this.handleChildrenEvents, this)},_onSetSelectedItem:function(a,b){a&&b.prevVal&&b.prevVal.set("selected",!1,{data:{byPassSetTreeSelectedItem:1}})},_onSetShowRootNode:function(a){this.get("rowEl")[a?"show":"hide"]()}});return g}); KISSY.add("tree/control",["./node","./tree-manager"],function(i,f){var g=f("./node"),k=f("./tree-manager");return g.extend([k],{handleKeyDownInternal:function(d){var a=this.get("selectedItem");return a===this?this.callSuper(d):a&&a.handleKeyDownInternal(d)},_onSetFocused:function(d){this.callSuper(d);d&&!this.get("selectedItem")&&this.select()}},{ATTRS:{defaultChildCfg:{value:{xclass:"tree-node"}}},xclass:"tree"})}); -KISSY.add("tree/check-node",["node","./node"],function(i,f){var g=f("node"),k=f("./node"),d=g.all,g=k.extend({handleClickInternal:function(a){var h=this.get("expanded"),b=this.get("expandIconEl"),f=this.get("tree"),e=d(a.target);f.focus();this.callSuper(a);if(e.equals(b))this.set("expanded",!h);else return a=this.get("checkState"),this.set("checkState",1===a?0:1),this.fire("click"),!0},_onSetCheckState:function(a){var d=this.get("parent"),b,f,e,g;(1===a||0===a)&&i.each(this.get("children"),function(b){b.set("checkState", +KISSY.add("tree/check-node",["node","./node"],function(i,f){var g=f("node"),k=f("./node"),d=g.all,g=k.extend({handleClickInternal:function(a){var h=this.get("expanded"),b=this.get("expandIconEl"),f=this.get("tree"),e=d(a.target);f.focus();this.callSuper(a);if(e.equals(b))this.set("expanded",!h);else return a=this.get("checkState"),this.set("checkState",1===a?0:1),!0},_onSetCheckState:function(a){var d=this.get("parent"),b,f,e,g;(1===a||0===a)&&i.each(this.get("children"),function(b){b.set("checkState", a)});if(d){b=0;g=d.get("children");for(f=0;f