Skip to content

Commit

Permalink
added the wholerow plugin (rewritten - yet to be tested in old browsers)
Browse files Browse the repository at this point in the history
added the z_no_clean plugin - only use with high performance large trees when you can supply all the dom elements for a tree (advanced users only)
  • Loading branch information
vakata committed Sep 12, 2012
1 parent 22dfab6 commit 8ca0a34
Show file tree
Hide file tree
Showing 31 changed files with 387 additions and 45 deletions.
120 changes: 109 additions & 11 deletions dist/jstree.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! jstree - v1.0.0 - 2012-08-30
/*! jstree - v1.0.0 - 2012-09-11
* http://jstree.com
* Copyright (c) 2012 Ivan Bozhanov; Licensed MIT, GPL */

Expand Down Expand Up @@ -2485,7 +2485,7 @@ Some static functions and variables, unless you know exactly what you are doing
if(document.selection && document.selection.empty) { document.selection.empty(); }
else { if(window.getSelection) { var sel = window.getSelection(); try { sel.removeAllRanges(); sel.collapse(); } catch (er) { } } }
})
.delegate("li > ins", "click.jstree", $.proxy(function (e) {
.delegate(".jstree-ocl", "click.jstree", $.proxy(function (e) {
// var trgt = $(e.target);
// if(trgt.is("ins") && e.pageY - trgt.offset().top < this.data.core.li_height) { this.toggle_node(trgt); }
this.toggle_node(e.target);
Expand Down Expand Up @@ -4032,13 +4032,14 @@ Some static functions and variables, unless you know exactly what you are doing
// add core CSS
$(function() {
var css_string = '' +
'.jstree * { -webkit-box-sizing:content-box; -moz-box-sizing:content-box; box-sizing:content-box; }' +
'.jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } ' +
'.jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; min-width:18px; } ' +
'.jstree-rtl li { margin-left:0; margin-right:18px; } ' +
'.jstree > ul > li { margin-left:0px; } ' +
'.jstree-rtl > ul > li { margin-right:0px; } ' +
'.jstree .jstree-icon { display:inline-block; text-decoration:none; margin:0; padding:0; vertical-align:top; } ' +
'.jstree .jstree-ocl { width:18px; height:18px; text-align:center; line-height:18px; cursor:default; vertical-align:top; } ' +
'.jstree .jstree-ocl { width:18px; height:18px; text-align:center; line-height:18px; cursor:pointer; vertical-align:top; } ' +
'.jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; padding:1px 2px; margin:0; } ' +
'.jstree a:focus { outline: none; } ' +
'li.jstree-open > ul { display:block; } ' +
Expand Down Expand Up @@ -4791,7 +4792,6 @@ This plugin makes it possible for jstree to use HTML data sources (other than th
This plugin makes it possible for jstree to use JSON data sources.
*/
/* Group: jstree json plugin */
/*global console */
(function ($) {
$.jstree.plugin("json", {
__construct : function () {
Expand Down Expand Up @@ -5435,14 +5435,22 @@ This plugin enables selecting, deselecting and hovering tree items.
this.data.ui.last_selected = false;

this.get_container() // TODO: configurable event (click/dblclick/etc)
.delegate("a", "click.jstree", $.proxy(function (e) {
.delegate("a", "click.jstree", $.proxy(function (e, data) {
e.preventDefault();
e.currentTarget.blur();
var s = this.get_settings(true).ui,
obj = this.get_node(e.currentTarget),
var s = this.get_settings(true).ui;
if(data) {
if(s.select_multiple_modifier !== "on" && s.select_multiple_modifier !== false && data[s.select_multiple_modifier + 'Key']) {
e[s.select_multiple_modifier + 'Key'] = data[s.select_multiple_modifier + 'Key'];
}
if(s.select_range_modifier !== "on" && s.select_range_modifier !== false && data[s.select_range_modifier + 'Key']) {
e[s.select_range_modifier + 'Key'] = data[s.select_range_modifier + 'Key'];
}
}
var obj = this.get_node(e.currentTarget),
is_selected = this.is_selected(obj),
is_multiple = s.select_multiple_modifier === "on" || (s.select_multiple_modifier !== false && e && e[s.select_multiple_modifier + "Key"]),
is_range = s.select_multiple_modifier === "on" || (s.select_range_modifier !== false && e && e[s.select_range_modifier + "Key"] && this.data.ui.last_selected && this.data.ui.last_selected[0] !== obj[0] && this.data.ui.last_selected.parent()[0] === obj.parent()[0]);
is_range = s.select_range_modifier === "on" || (s.select_range_modifier !== false && e && e[s.select_range_modifier + "Key"] && this.data.ui.last_selected && this.data.ui.last_selected[0] !== obj[0] && this.data.ui.last_selected.parent()[0] === obj.parent()[0]);

switch(!0) {
case (is_range && this.data.ui.last_selected !== false):
Expand Down Expand Up @@ -5583,7 +5591,7 @@ This plugin enables selecting, deselecting and hovering tree items.
d = t.data("jstree");
t.find('.jstree-clicked').removeClass('jstree-clicked');
if(d && d.selected) {
_this.select_node(t);
setTimeout(function () { _this.select_node(t); }, 0);
delete d.selected;
}
});
Expand Down Expand Up @@ -5661,8 +5669,98 @@ Does not allow the same name amongst siblings (still a bit experimental).
/*
* jsTree wholerow plugin
* Makes select and hover work on the entire width of the node
* MAY BE HEAVY IN LARGE DOM
*/
(function ($) {
$.jstree.plugin("wholerow", {
__construct : function () {
// do not continue if UI plugin is unavailable
if(!this.data.ui) {
throw "jsTree wholerow: jsTree UI plugin not included.";
}
// remove dots if themes plugin is loaded
if(this.data.themes) {
this.get_container().bind('set_state.jstree', $.proxy(function () {
this.hide_dots();
}, this));
}
this.get_container()
.bind("__ready.jstree", $.proxy(function () {
var t = this;
$(function () {
t.get_container_ul().addClass('jstree-wholerow-ul');
$.vakata.css.add_sheet({
str : '.jstree-' + t.get_index() + ' .jstree-wholerow { height:' + t.data.core.li_height + 'px; }',
title : "jstree"
});
});
}, this))
.bind("deselect_all.jstree", $.proxy(function (e, data) {
this.get_container().find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked');
}, this))
.bind("select_node.jstree deselect_node.jstree ", $.proxy(function (e, data) {
data.rslt.obj.each(function () {
$(this).children('.jstree-wholerow')[ e.type === 'select_node' ? 'addClass' : 'removeClass' ]('jstree-wholerow-clicked');
});
}, this))
.bind("hover_node.jstree dehover_node.jstree", $.proxy(function (e, data) {
this.get_container().find('.jstree-wholerow-hovered').removeClass('jstree-wholerow-hovered');
if(e.type === "hover_node") {
data.rslt.obj.each(function () {
$(this).children('.jstree-wholerow').addClass('jstree-wholerow-hovered');
});
}
}, this))
.delegate(".jstree-wholerow", "click.jstree", function (e) {
e.stopImmediatePropagation();
$(e.currentTarget).closest("li").children("a:eq(0)").trigger('click',e);
})
.delegate(".jstree-leaf > .jstree-ocl", "click.jstree", $.proxy(function (e) {
e.stopImmediatePropagation();
$(e.currentTarget).closest("li").children("a:eq(0)").trigger('click',e);
}, this))
.delegate("li", "mouseover.jstree", $.proxy(function (e) {
e.stopImmediatePropagation();
if($(e.currentTarget).closest('li').children(".jstree-hovered, .jstree-clicked").length) {
return false;
}
this.hover_node(e.currentTarget);
return false;
}, this))
.delegate("li", "mouseleave.jstree", $.proxy(function (e) {
this.dehover_node(e.currentTarget);
}, this));
},
defaults : {
},
__destroy : function () {
this.get_container().find(".jstree-wholerow").remove();
},
_fn : {
clean_node : function(obj) {
obj = this.__call_old();
var t = this;
return obj.each(function () {
var o = $(this);
if(!o.find("> .jstree-wholerow").length) {
o.prepend("<div class='jstree-wholerow' style='position:absolute;' unselectable='on'>&#160;</div>");
}
});
}
}
});
$(function () {
$.vakata.css.add_sheet({
str : '' +
'.jstree .jstree-wholerow-ul { position:relative; display:inline-block; min-width:100%; }' +
'.jstree-wholerow-ul li > a, .jstree-wholerow-ul li > ins { position:relative; }' +
'.jstree-wholerow-ul .jstree-wholerow { width:100%; cursor:pointer; position:absolute; left:0; user-select:none;-webkit-user-select:none; -moz-user-select:none; -ms-user-select:none; }',
title : "jstree"
});
});
// include the wholerow plugin by default
$.jstree.defaults.plugins.push("wholerow");
})(jQuery);
/*
(function ($) {
$.jstree.plugin("wholerow", {
__construct : function () {
Expand Down Expand Up @@ -5780,7 +5878,7 @@ Does not allow the same name amongst siblings (still a bit experimental).
// include the selection plugin by default
$.jstree.defaults.plugins.push("wholerow");
})(jQuery);
//*/
*/
/* File: jstree.xml.js
This plugin makes it possible for jstree to use XML data sources.
*/
Expand Down
4 changes: 2 additions & 2 deletions dist/jstree.min.js

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion dist/themes/default/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@
.jstree-default .jstree-clicked { background:#beebff; border:1px solid #99defd; padding:0 2px 0 1px; border-radius:2px; }
.jstree-default a .jstree-themeicon { background-position:-56px -19px; }

.jstree-default.jstree-focused { background:#ffffee; }
/*.jstree-default.jstree-focused { background:#ffffee; }*/

.jstree-default .jstree-no-dots li,
.jstree-default .jstree-no-dots .jstree-leaf > .jstree-ocl { background:transparent; }
.jstree-default .jstree-no-dots .jstree-open > .jstree-ocl { background-position:-18px 0; }
.jstree-default .jstree-no-dots .jstree-closed > .jstree-ocl { background-position:0 0; }

.jstree-default > .jstree-wholerow-ul .jstree-hovered,
.jstree-default > .jstree-wholerow-ul .jstree-clicked { background:transparent; border:0; padding:1px 2px; border-radius:0; }

.jstree-default > .jstree-wholerow-ul .jstree-wholerow-hovered { background:#e7f4f9; }
.jstree-default > .jstree-wholerow-ul .jstree-wholerow-clicked { background:#beebff; }

.jstree-default .jstree-no-icons a .jstree-themeicon { display:none; }

.jstree-default .jstree-search { font-style:italic; color:aqua; }
Expand Down
2 changes: 1 addition & 1 deletion docs/files/jstree-checkbox-js.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div><!--Content-->


<div id=Footer>Copyright &copy; 2010 Ivan Bozhanov&nbsp; &middot;&nbsp; Updated August 30th, 2012&nbsp; &middot;&nbsp; <a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
<div id=Footer>Copyright &copy; 2010 Ivan Bozhanov&nbsp; &middot;&nbsp; Updated September 11th, 2012&nbsp; &middot;&nbsp; <a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->


<div id=Menu><div class=MTitle>jstree<div class=MSubTitle>jquery treeview plugin</div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Core</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MFile><a href="jstree-js.html">jstree.js</a></div></div><div class=MEntry><div class=MFile><a href="vakata-js.html">vakata.js</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent2')">Plugins</a><div class=MGroupContent id=MGroupContent2><div class=MEntry><div class=MFile><a href="jstree-html-js.html">jstree.<wbr>html.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-json-js.html">jstree.<wbr>json.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-themes-js.html">jstree.<wbr>themes.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-ui-js.html">jstree.<wbr>ui.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-state-js.html">jstree.<wbr>state.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-contextmenu-js.html">jstree.<wbr>contextmenu.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-hotkeys-js.html">jstree.<wbr>hotkeys.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-sort-js.html">jstree.<wbr>sort.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-dnd-js.html">jstree.<wbr>dnd.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-unique-js.html">jstree.<wbr>unique.js</a></div></div><div class=MEntry><div class=MFile id=MSelected>jstree.<wbr>checkbox.js</div></div><div class=MEntry><div class=MFile><a href="jstree-xml-js.html">jstree.<wbr>xml.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-rules-js.html">jstree.<wbr>rules.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-search-js.html">jstree.<wbr>search.js</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent3')">Index</a><div class=MGroupContent id=MGroupContent3><div class=MEntry><div class=MIndex><a href="../index/General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Events.html">Events</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Files.html">Files</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Functions.html">Functions</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Variables.html">Variables</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Classes.html">Classes</a></div></div></div></div></div><script type="text/javascript"><!--
Expand Down
2 changes: 1 addition & 1 deletion docs/files/jstree-contextmenu-js.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div><!--Content-->


<div id=Footer>Copyright &copy; 2010 Ivan Bozhanov&nbsp; &middot;&nbsp; Updated August 30th, 2012&nbsp; &middot;&nbsp; <a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
<div id=Footer>Copyright &copy; 2010 Ivan Bozhanov&nbsp; &middot;&nbsp; Updated September 11th, 2012&nbsp; &middot;&nbsp; <a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->


<div id=Menu><div class=MTitle>jstree<div class=MSubTitle>jquery treeview plugin</div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Core</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MFile><a href="jstree-js.html">jstree.js</a></div></div><div class=MEntry><div class=MFile><a href="vakata-js.html">vakata.js</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent2')">Plugins</a><div class=MGroupContent id=MGroupContent2><div class=MEntry><div class=MFile><a href="jstree-html-js.html">jstree.<wbr>html.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-json-js.html">jstree.<wbr>json.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-themes-js.html">jstree.<wbr>themes.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-ui-js.html">jstree.<wbr>ui.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-state-js.html">jstree.<wbr>state.js</a></div></div><div class=MEntry><div class=MFile id=MSelected>jstree.<wbr>contextmenu.js</div></div><div class=MEntry><div class=MFile><a href="jstree-hotkeys-js.html">jstree.<wbr>hotkeys.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-sort-js.html">jstree.<wbr>sort.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-dnd-js.html">jstree.<wbr>dnd.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-unique-js.html">jstree.<wbr>unique.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-checkbox-js.html">jstree.<wbr>checkbox.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-xml-js.html">jstree.<wbr>xml.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-rules-js.html">jstree.<wbr>rules.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-search-js.html">jstree.<wbr>search.js</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent3')">Index</a><div class=MGroupContent id=MGroupContent3><div class=MEntry><div class=MIndex><a href="../index/General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Events.html">Events</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Files.html">Files</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Functions.html">Functions</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Variables.html">Variables</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Classes.html">Classes</a></div></div></div></div></div><script type="text/javascript"><!--
Expand Down
2 changes: 1 addition & 1 deletion docs/files/jstree-dnd-js.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div><!--Content-->


<div id=Footer>Copyright &copy; 2010 Ivan Bozhanov&nbsp; &middot;&nbsp; Updated August 30th, 2012&nbsp; &middot;&nbsp; <a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->
<div id=Footer>Copyright &copy; 2010 Ivan Bozhanov&nbsp; &middot;&nbsp; Updated September 11th, 2012&nbsp; &middot;&nbsp; <a href="http://www.naturaldocs.org">Generated by Natural Docs</a></div><!--Footer-->


<div id=Menu><div class=MTitle>jstree<div class=MSubTitle>jquery treeview plugin</div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent1')">Core</a><div class=MGroupContent id=MGroupContent1><div class=MEntry><div class=MFile><a href="jstree-js.html">jstree.js</a></div></div><div class=MEntry><div class=MFile><a href="vakata-js.html">vakata.js</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent2')">Plugins</a><div class=MGroupContent id=MGroupContent2><div class=MEntry><div class=MFile><a href="jstree-html-js.html">jstree.<wbr>html.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-json-js.html">jstree.<wbr>json.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-themes-js.html">jstree.<wbr>themes.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-ui-js.html">jstree.<wbr>ui.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-state-js.html">jstree.<wbr>state.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-contextmenu-js.html">jstree.<wbr>contextmenu.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-hotkeys-js.html">jstree.<wbr>hotkeys.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-sort-js.html">jstree.<wbr>sort.js</a></div></div><div class=MEntry><div class=MFile id=MSelected>jstree.<wbr>dnd.js</div></div><div class=MEntry><div class=MFile><a href="jstree-unique-js.html">jstree.<wbr>unique.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-checkbox-js.html">jstree.<wbr>checkbox.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-xml-js.html">jstree.<wbr>xml.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-rules-js.html">jstree.<wbr>rules.js</a></div></div><div class=MEntry><div class=MFile><a href="jstree-search-js.html">jstree.<wbr>search.js</a></div></div></div></div></div><div class=MEntry><div class=MGroup><a href="javascript:ToggleMenu('MGroupContent3')">Index</a><div class=MGroupContent id=MGroupContent3><div class=MEntry><div class=MIndex><a href="../index/General.html">Everything</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Events.html">Events</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Files.html">Files</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Functions.html">Functions</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Variables.html">Variables</a></div></div><div class=MEntry><div class=MIndex><a href="../index/Classes.html">Classes</a></div></div></div></div></div><script type="text/javascript"><!--
Expand Down
Loading

0 comments on commit 8ca0a34

Please sign in to comment.