Current state

This commit is contained in:
2026-02-07 08:23:18 +01:00
commit 0a4372c40d
22479 changed files with 1553543 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
/*globals jQuery, define, exports, require, window, document */
(function (factory) {
"use strict";
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
}
else if(typeof exports === 'object') {
factory(require('jquery'));
}
else {
factory(jQuery);
}
}(function ($, undefined) {
"use strict";

View File

@@ -0,0 +1,351 @@
/**
* ### Checkbox plugin
*
* This plugin renders checkbox icons in front of each node, making multiple selection much easier.
* It also supports tri-state behavior, meaning that if a node has a few of its children checked it will be rendered as undetermined, and state will be propagated up.
*/
/*globals jQuery, define, exports, require, document */
(function (factory) {
"use strict";
if (typeof define === 'function' && define.amd) {
define('jstree.checkbox', ['jquery','jstree'], factory);
}
else if(typeof exports === 'object') {
factory(require('jquery'), require('jstree'));
}
else {
factory(jQuery, jQuery.jstree);
}
}(function ($, jstree, undefined) {
"use strict";
if($.jstree.plugins.checkbox) { return; }
var _i = document.createElement('I');
_i.className = 'jstree-icon jstree-checkbox';
/**
* stores all defaults for the checkbox plugin
* @name $.jstree.defaults.checkbox
* @plugin checkbox
*/
$.jstree.defaults.checkbox = {
/**
* a boolean indicating if checkboxes should be visible (can be changed at a later time using `show_checkboxes()` and `hide_checkboxes`). Defaults to `true`.
* @name $.jstree.defaults.checkbox.visible
* @plugin checkbox
*/
visible : true,
/**
* a boolean indicating if checkboxes should cascade down and have an undetermined state. Defaults to `true`.
* @name $.jstree.defaults.checkbox.three_state
* @plugin checkbox
*/
three_state : true,
/**
* a boolean indicating if clicking anywhere on the node should act as clicking on the checkbox. Defaults to `true`.
* @name $.jstree.defaults.checkbox.whole_node
* @plugin checkbox
*/
whole_node : true,
/**
* a boolean indicating if the selected style of a node should be kept, or removed. Defaults to `true`.
* @name $.jstree.defaults.checkbox.keep_selected_style
* @plugin checkbox
*/
keep_selected_style : true
};
$.jstree.plugins.checkbox = function (options, parent) {
this.bind = function () {
parent.bind.call(this);
this._data.checkbox.uto = false;
this.element
.on("init.jstree", $.proxy(function () {
this._data.checkbox.visible = this.settings.checkbox.visible;
if(!this.settings.checkbox.keep_selected_style) {
this.element.addClass('jstree-checkbox-no-clicked');
}
}, this))
.on("loading.jstree", $.proxy(function () {
this[ this._data.checkbox.visible ? 'show_checkboxes' : 'hide_checkboxes' ]();
}, this));
if(this.settings.checkbox.three_state) {
this.element
.on('changed.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree', $.proxy(function () {
if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); }
this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50);
}, this))
.on('model.jstree', $.proxy(function (e, data) {
var m = this._model.data,
p = m[data.parent],
dpc = data.nodes,
chd = [],
c, i, j, k, l, tmp;
// apply down
if(p.state.selected) {
for(i = 0, j = dpc.length; i < j; i++) {
m[dpc[i]].state.selected = true;
}
this._data.core.selected = this._data.core.selected.concat(dpc);
}
else {
for(i = 0, j = dpc.length; i < j; i++) {
if(m[dpc[i]].state.selected) {
for(k = 0, l = m[dpc[i]].children_d.length; k < l; k++) {
m[m[dpc[i]].children_d[k]].state.selected = true;
}
this._data.core.selected = this._data.core.selected.concat(m[dpc[i]].children_d);
}
}
}
// apply up
for(i = 0, j = p.children_d.length; i < j; i++) {
if(!m[p.children_d[i]].children.length) {
chd.push(m[p.children_d[i]].parent);
}
}
chd = $.vakata.array_unique(chd);
for(k = 0, l = chd.length; k < l; k++) {
p = m[chd[k]];
while(p && p.id !== '#') {
c = 0;
for(i = 0, j = p.children.length; i < j; i++) {
c += m[p.children[i]].state.selected;
}
if(c === j) {
p.state.selected = true;
this._data.core.selected.push(p.id);
tmp = this.get_node(p, true);
if(tmp && tmp.length) {
tmp.children('.jstree-anchor').addClass('jstree-clicked');
}
}
else {
break;
}
p = this.get_node(p.parent);
}
}
this._data.core.selected = $.vakata.array_unique(this._data.core.selected);
}, this))
.on('select_node.jstree', $.proxy(function (e, data) {
var obj = data.node,
m = this._model.data,
par = this.get_node(obj.parent),
dom = this.get_node(obj, true),
i, j, c, tmp;
this._data.core.selected = $.vakata.array_unique(this._data.core.selected.concat(obj.children_d));
for(i = 0, j = obj.children_d.length; i < j; i++) {
m[obj.children_d[i]].state.selected = true;
}
while(par && par.id !== '#') {
c = 0;
for(i = 0, j = par.children.length; i < j; i++) {
c += m[par.children[i]].state.selected;
}
if(c === j) {
par.state.selected = true;
this._data.core.selected.push(par.id);
tmp = this.get_node(par, true);
if(tmp && tmp.length) {
tmp.children('.jstree-anchor').addClass('jstree-clicked');
}
}
else {
break;
}
par = this.get_node(par.parent);
}
if(dom.length) {
dom.find('.jstree-anchor').addClass('jstree-clicked');
}
}, this))
.on('deselect_node.jstree', $.proxy(function (e, data) {
var obj = data.node,
dom = this.get_node(obj, true),
i, j, tmp;
for(i = 0, j = obj.children_d.length; i < j; i++) {
this._model.data[obj.children_d[i]].state.selected = false;
}
for(i = 0, j = obj.parents.length; i < j; i++) {
this._model.data[obj.parents[i]].state.selected = false;
tmp = this.get_node(obj.parents[i], true);
if(tmp && tmp.length) {
tmp.children('.jstree-anchor').removeClass('jstree-clicked');
}
}
tmp = [];
for(i = 0, j = this._data.core.selected.length; i < j; i++) {
if($.inArray(this._data.core.selected[i], obj.children_d) === -1 && $.inArray(this._data.core.selected[i], obj.parents) === -1) {
tmp.push(this._data.core.selected[i]);
}
}
this._data.core.selected = $.vakata.array_unique(tmp);
if(dom.length) {
dom.find('.jstree-anchor').removeClass('jstree-clicked');
}
}, this))
.on('delete_node.jstree', $.proxy(function (e, data) {
var p = this.get_node(data.parent),
m = this._model.data,
i, j, c, tmp;
while(p && p.id !== '#') {
c = 0;
for(i = 0, j = p.children.length; i < j; i++) {
c += m[p.children[i]].state.selected;
}
if(c === j) {
p.state.selected = true;
this._data.core.selected.push(p.id);
tmp = this.get_node(p, true);
if(tmp && tmp.length) {
tmp.children('.jstree-anchor').addClass('jstree-clicked');
}
}
else {
break;
}
p = this.get_node(p.parent);
}
}, this))
.on('move_node.jstree', $.proxy(function (e, data) {
var is_multi = data.is_multi,
old_par = data.old_parent,
new_par = this.get_node(data.parent),
m = this._model.data,
p, c, i, j, tmp;
if(!is_multi) {
p = this.get_node(old_par);
while(p && p.id !== '#') {
c = 0;
for(i = 0, j = p.children.length; i < j; i++) {
c += m[p.children[i]].state.selected;
}
if(c === j) {
p.state.selected = true;
this._data.core.selected.push(p.id);
tmp = this.get_node(p, true);
if(tmp && tmp.length) {
tmp.children('.jstree-anchor').addClass('jstree-clicked');
}
}
else {
break;
}
p = this.get_node(p.parent);
}
}
p = new_par;
while(p && p.id !== '#') {
c = 0;
for(i = 0, j = p.children.length; i < j; i++) {
c += m[p.children[i]].state.selected;
}
if(c === j) {
if(!p.state.selected) {
p.state.selected = true;
this._data.core.selected.push(p.id);
tmp = this.get_node(p, true);
if(tmp && tmp.length) {
tmp.children('.jstree-anchor').addClass('jstree-clicked');
}
}
}
else {
if(p.state.selected) {
p.state.selected = false;
this._data.core.selected = $.vakata.array_remove_item(this._data.core.selected, p.id);
tmp = this.get_node(p, true);
if(tmp && tmp.length) {
tmp.children('.jstree-anchor').removeClass('jstree-clicked');
}
}
else {
break;
}
}
p = this.get_node(p.parent);
}
}, this));
}
};
/**
* set the undetermined state where and if necessary. Used internally.
* @private
* @name _undetermined()
* @plugin checkbox
*/
this._undetermined = function () {
var i, j, m = this._model.data, s = this._data.core.selected, p = [], t = this;
for(i = 0, j = s.length; i < j; i++) {
if(m[s[i]] && m[s[i]].parents) {
p = p.concat(m[s[i]].parents);
}
}
// attempt for server side undetermined state
this.element.find('.jstree-closed').not(':has(ul)')
.each(function () {
var tmp = t.get_node(this);
if(!tmp.state.loaded && tmp.original && tmp.original.state && tmp.original.state.undetermined && tmp.original.state.undetermined === true) {
p.push(tmp.id);
p = p.concat(tmp.parents);
}
});
p = $.vakata.array_unique(p);
i = $.inArray('#', p);
if(i !== -1) {
p = $.vakata.array_remove(p, i);
}
this.element.find('.jstree-undetermined').removeClass('jstree-undetermined');
for(i = 0, j = p.length; i < j; i++) {
if(!m[p[i]].state.selected) {
s = this.get_node(p[i], true);
if(s && s.length) {
s.children('a').children('.jstree-checkbox').addClass('jstree-undetermined');
}
}
}
};
this.redraw_node = function(obj, deep, is_callback) {
obj = parent.redraw_node.call(this, obj, deep, is_callback);
if(obj) {
var tmp = obj.getElementsByTagName('A')[0];
tmp.insertBefore(_i.cloneNode(), tmp.childNodes[0]);
}
if(!is_callback && this.settings.checkbox.three_state) {
if(this._data.checkbox.uto) { clearTimeout(this._data.checkbox.uto); }
this._data.checkbox.uto = setTimeout($.proxy(this._undetermined, this), 50);
}
return obj;
};
this.activate_node = function (obj, e) {
if(this.settings.checkbox.whole_node || $(e.target).hasClass('jstree-checkbox')) {
e.ctrlKey = true;
}
return parent.activate_node.call(this, obj, e);
};
/**
* show the node checkbox icons
* @name show_checkboxes()
* @plugin checkbox
*/
this.show_checkboxes = function () { this._data.core.themes.checkboxes = true; this.element.children("ul").removeClass("jstree-no-checkboxes"); };
/**
* hide the node checkbox icons
* @name hide_checkboxes()
* @plugin checkbox
*/
this.hide_checkboxes = function () { this._data.core.themes.checkboxes = false; this.element.children("ul").addClass("jstree-no-checkboxes"); };
/**
* toggle the node icons
* @name toggle_checkboxes()
* @plugin checkbox
*/
this.toggle_checkboxes = function () { if(this._data.core.themes.checkboxes) { this.hide_checkboxes(); } else { this.show_checkboxes(); } };
};
// include the checkbox plugin by default
// $.jstree.defaults.plugins.push("checkbox");
}));

View File

@@ -0,0 +1,601 @@
/**
* ### Contextmenu plugin
*
* Shows a context menu when a node is right-clicked.
*/
// TODO: move logic outside of function + check multiple move
/*globals jQuery, define, exports, require, document */
(function (factory) {
"use strict";
if (typeof define === 'function' && define.amd) {
define('jstree.contextmenu', ['jquery','jstree'], factory);
}
else if(typeof exports === 'object') {
factory(require('jquery'), require('jstree'));
}
else {
factory(jQuery, jQuery.jstree);
}
}(function ($, jstree, undefined) {
"use strict";
if($.jstree.plugins.contextmenu) { return; }
/**
* stores all defaults for the contextmenu plugin
* @name $.jstree.defaults.contextmenu
* @plugin contextmenu
*/
$.jstree.defaults.contextmenu = {
/**
* a boolean indicating if the node should be selected when the context menu is invoked on it. Defaults to `true`.
* @name $.jstree.defaults.contextmenu.select_node
* @plugin contextmenu
*/
select_node : true,
/**
* a boolean indicating if the menu should be shown aligned with the node. Defaults to `true`, otherwise the mouse coordinates are used.
* @name $.jstree.defaults.contextmenu.show_at_node
* @plugin contextmenu
*/
show_at_node : true,
/**
* an object of actions, or a function that accepts a node and a callback function and calls the callback function with an object of actions available for that node (you can also return the items too).
*
* Each action consists of a key (a unique name) and a value which is an object with the following properties (only label and action are required):
*
* * `separator_before` - a boolean indicating if there should be a separator before this item
* * `separator_after` - a boolean indicating if there should be a separator after this item
* * `_disabled` - a boolean indicating if this action should be disabled
* * `label` - a string - the name of the action
* * `action` - a function to be executed if this item is chosen
* * `icon` - a string, can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class
* * `shortcut` - keyCode which will trigger the action if the menu is open (for example `113` for rename, which equals F2)
* * `shortcut_label` - shortcut label (like for example `F2` for rename)
*
* @name $.jstree.defaults.contextmenu.items
* @plugin contextmenu
*/
items : function (o, cb) { // Could be an object directly
return {
"create" : {
"separator_before" : false,
"separator_after" : true,
"_disabled" : false, //(this.check("create_node", data.reference, {}, "last")),
"label" : "Create",
"action" : function (data) {
var inst = $.jstree.reference(data.reference),
obj = inst.get_node(data.reference);
inst.create_node(obj, {}, "last", function (new_node) {
setTimeout(function () { inst.edit(new_node); },0);
});
}
},
"rename" : {
"separator_before" : false,
"separator_after" : false,
"_disabled" : false, //(this.check("rename_node", data.reference, this.get_parent(data.reference), "")),
"label" : "Rename",
/*
"shortcut" : 113,
"shortcut_label" : 'F2',
"icon" : "glyphicon glyphicon-leaf",
*/
"action" : function (data) {
var inst = $.jstree.reference(data.reference),
obj = inst.get_node(data.reference);
inst.edit(obj);
}
},
"remove" : {
"separator_before" : false,
"icon" : false,
"separator_after" : false,
"_disabled" : false, //(this.check("delete_node", data.reference, this.get_parent(data.reference), "")),
"label" : "Delete",
"action" : function (data) {
var inst = $.jstree.reference(data.reference),
obj = inst.get_node(data.reference);
if(inst.is_selected(obj)) {
inst.delete_node(inst.get_selected());
}
else {
inst.delete_node(obj);
}
}
},
"ccp" : {
"separator_before" : true,
"icon" : false,
"separator_after" : false,
"label" : "Edit",
"action" : false,
"submenu" : {
"cut" : {
"separator_before" : false,
"separator_after" : false,
"label" : "Cut",
"action" : function (data) {
var inst = $.jstree.reference(data.reference),
obj = inst.get_node(data.reference);
if(inst.is_selected(obj)) {
inst.cut(inst.get_selected());
}
else {
inst.cut(obj);
}
}
},
"copy" : {
"separator_before" : false,
"icon" : false,
"separator_after" : false,
"label" : "Copy",
"action" : function (data) {
var inst = $.jstree.reference(data.reference),
obj = inst.get_node(data.reference);
if(inst.is_selected(obj)) {
inst.copy(inst.get_selected());
}
else {
inst.copy(obj);
}
}
},
"paste" : {
"separator_before" : false,
"icon" : false,
"_disabled" : function (data) {
return !$.jstree.reference(data.reference).can_paste();
},
"separator_after" : false,
"label" : "Paste",
"action" : function (data) {
var inst = $.jstree.reference(data.reference),
obj = inst.get_node(data.reference);
inst.paste(obj);
}
}
}
}
};
}
};
$.jstree.plugins.contextmenu = function (options, parent) {
this.bind = function () {
parent.bind.call(this);
this.element
.on("contextmenu.jstree", ".jstree-anchor", $.proxy(function (e) {
e.preventDefault();
if(!this.is_loading(e.currentTarget)) {
this.show_contextmenu(e.currentTarget, e.pageX, e.pageY, e);
}
}, this))
.on("click.jstree", ".jstree-anchor", $.proxy(function (e) {
if(this._data.contextmenu.visible) {
$.vakata.context.hide();
}
}, this));
/*
if(!('oncontextmenu' in document.body) && ('ontouchstart' in document.body)) {
var el = null, tm = null;
this.element
.on("touchstart", ".jstree-anchor", function (e) {
el = e.currentTarget;
tm = +new Date();
$(document).one("touchend", function (e) {
e.target = document.elementFromPoint(e.originalEvent.targetTouches[0].pageX - window.pageXOffset, e.originalEvent.targetTouches[0].pageY - window.pageYOffset);
e.currentTarget = e.target;
tm = ((+(new Date())) - tm);
if(e.target === el && tm > 600 && tm < 1000) {
e.preventDefault();
$(el).trigger('contextmenu', e);
}
el = null;
tm = null;
});
});
}
*/
$(document).on("context_hide.vakata", $.proxy(function () { this._data.contextmenu.visible = false; }, this));
};
this.teardown = function () {
if(this._data.contextmenu.visible) {
$.vakata.context.hide();
}
parent.teardown.call(this);
};
/**
* prepare and show the context menu for a node
* @name show_contextmenu(obj [, x, y])
* @param {mixed} obj the node
* @param {Number} x the x-coordinate relative to the document to show the menu at
* @param {Number} y the y-coordinate relative to the document to show the menu at
* @param {Object} e the event if available that triggered the contextmenu
* @plugin contextmenu
* @trigger show_contextmenu.jstree
*/
this.show_contextmenu = function (obj, x, y, e) {
obj = this.get_node(obj);
if(!obj || obj.id === '#') { return false; }
var s = this.settings.contextmenu,
d = this.get_node(obj, true),
a = d.children(".jstree-anchor"),
o = false,
i = false;
if(s.show_at_node || x === undefined || y === undefined) {
o = a.offset();
x = o.left;
y = o.top + this._data.core.li_height;
}
if(this.settings.contextmenu.select_node && !this.is_selected(obj)) {
this.deselect_all();
this.select_node(obj, false, false, e);
}
i = s.items;
if($.isFunction(i)) {
i = i.call(this, obj, $.proxy(function (i) {
this._show_contextmenu(obj, x, y, i);
}, this));
}
if($.isPlainObject(i)) {
this._show_contextmenu(obj, x, y, i);
}
};
/**
* show the prepared context menu for a node
* @name _show_contextmenu(obj, x, y, i)
* @param {mixed} obj the node
* @param {Number} x the x-coordinate relative to the document to show the menu at
* @param {Number} y the y-coordinate relative to the document to show the menu at
* @param {Number} i the object of items to show
* @plugin contextmenu
* @trigger show_contextmenu.jstree
* @private
*/
this._show_contextmenu = function (obj, x, y, i) {
var d = this.get_node(obj, true),
a = d.children(".jstree-anchor");
$(document).one("context_show.vakata", $.proxy(function (e, data) {
var cls = 'jstree-contextmenu jstree-' + this.get_theme() + '-contextmenu';
$(data.element).addClass(cls);
}, this));
this._data.contextmenu.visible = true;
$.vakata.context.show(a, { 'x' : x, 'y' : y }, i);
/**
* triggered when the contextmenu is shown for a node
* @event
* @name show_contextmenu.jstree
* @param {Object} node the node
* @param {Number} x the x-coordinate of the menu relative to the document
* @param {Number} y the y-coordinate of the menu relative to the document
* @plugin contextmenu
*/
this.trigger('show_contextmenu', { "node" : obj, "x" : x, "y" : y });
};
};
// contextmenu helper
(function ($) {
var right_to_left = false,
vakata_context = {
element : false,
reference : false,
position_x : 0,
position_y : 0,
items : [],
html : "",
is_visible : false
};
$.vakata.context = {
settings : {
hide_onmouseleave : 0,
icons : true
},
_trigger : function (event_name) {
$(document).triggerHandler("context_" + event_name + ".vakata", {
"reference" : vakata_context.reference,
"element" : vakata_context.element,
"position" : {
"x" : vakata_context.position_x,
"y" : vakata_context.position_y
}
});
},
_execute : function (i) {
i = vakata_context.items[i];
return i && (!i._disabled || ($.isFunction(i._disabled) && !i._disabled({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }))) && i.action ? i.action.call(null, {
"item" : i,
"reference" : vakata_context.reference,
"element" : vakata_context.element,
"position" : {
"x" : vakata_context.position_x,
"y" : vakata_context.position_y
}
}) : false;
},
_parse : function (o, is_callback) {
if(!o) { return false; }
if(!is_callback) {
vakata_context.html = "";
vakata_context.items = [];
}
var str = "",
sep = false,
tmp;
if(is_callback) { str += "<"+"ul>"; }
$.each(o, function (i, val) {
if(!val) { return true; }
vakata_context.items.push(val);
if(!sep && val.separator_before) {
str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + ">&#160;<"+"/a><"+"/li>";
}
sep = false;
str += "<"+"li class='" + (val._class || "") + (val._disabled === true || ($.isFunction(val._disabled) && val._disabled({ "item" : val, "reference" : vakata_context.reference, "element" : vakata_context.element })) ? " vakata-contextmenu-disabled " : "") + "' "+(val.shortcut?" data-shortcut='"+val.shortcut+"' ":'')+">";
str += "<"+"a href='#' rel='" + (vakata_context.items.length - 1) + "'>";
if($.vakata.context.settings.icons) {
str += "<"+"i ";
if(val.icon) {
if(val.icon.indexOf("/") !== -1 || val.icon.indexOf(".") !== -1) { str += " style='background:url(\"" + val.icon + "\") center center no-repeat' "; }
else { str += " class='" + val.icon + "' "; }
}
str += "><"+"/i><"+"span class='vakata-contextmenu-sep'>&#160;<"+"/span>";
}
str += val.label + (val.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+val.shortcut+'">'+ (val.shortcut_label || '') +'</span>':'') + "<"+"/a>";
if(val.submenu) {
tmp = $.vakata.context._parse(val.submenu, true);
if(tmp) { str += tmp; }
}
str += "<"+"/li>";
if(val.separator_after) {
str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + ">&#160;<"+"/a><"+"/li>";
sep = true;
}
});
str = str.replace(/<li class\='vakata-context-separator'\><\/li\>$/,"");
if(is_callback) { str += "</ul>"; }
/**
* triggered on the document when the contextmenu is parsed (HTML is built)
* @event
* @plugin contextmenu
* @name context_parse.vakata
* @param {jQuery} reference the element that was right clicked
* @param {jQuery} element the DOM element of the menu itself
* @param {Object} position the x & y coordinates of the menu
*/
if(!is_callback) { vakata_context.html = str; $.vakata.context._trigger("parse"); }
return str.length > 10 ? str : false;
},
_show_submenu : function (o) {
o = $(o);
if(!o.length || !o.children("ul").length) { return; }
var e = o.children("ul"),
x = o.offset().left + o.outerWidth(),
y = o.offset().top,
w = e.width(),
h = e.height(),
dw = $(window).width() + $(window).scrollLeft(),
dh = $(window).height() + $(window).scrollTop();
// може да се спести е една проверка - дали няма някой от класовете вече нагоре
if(right_to_left) {
o[x - (w + 10 + o.outerWidth()) < 0 ? "addClass" : "removeClass"]("vakata-context-left");
}
else {
o[x + w + 10 > dw ? "addClass" : "removeClass"]("vakata-context-right");
}
if(y + h + 10 > dh) {
e.css("bottom","-1px");
}
e.show();
},
show : function (reference, position, data) {
var o, e, x, y, w, h, dw, dh, cond = true;
if(vakata_context.element && vakata_context.element.length) {
vakata_context.element.width('');
}
switch(cond) {
case (!position && !reference):
return false;
case (!!position && !!reference):
vakata_context.reference = reference;
vakata_context.position_x = position.x;
vakata_context.position_y = position.y;
break;
case (!position && !!reference):
vakata_context.reference = reference;
o = reference.offset();
vakata_context.position_x = o.left + reference.outerHeight();
vakata_context.position_y = o.top;
break;
case (!!position && !reference):
vakata_context.position_x = position.x;
vakata_context.position_y = position.y;
break;
}
if(!!reference && !data && $(reference).data('vakata_contextmenu')) {
data = $(reference).data('vakata_contextmenu');
}
if($.vakata.context._parse(data)) {
vakata_context.element.html(vakata_context.html);
}
if(vakata_context.items.length) {
e = vakata_context.element;
x = vakata_context.position_x;
y = vakata_context.position_y;
w = e.width();
h = e.height();
dw = $(window).width() + $(window).scrollLeft();
dh = $(window).height() + $(window).scrollTop();
if(right_to_left) {
x -= e.outerWidth();
if(x < $(window).scrollLeft() + 20) {
x = $(window).scrollLeft() + 20;
}
}
if(x + w + 20 > dw) {
x = dw - (w + 20);
}
if(y + h + 20 > dh) {
y = dh - (h + 20);
}
vakata_context.element
.css({ "left" : x, "top" : y })
.show()
.find('a:eq(0)').focus().parent().addClass("vakata-context-hover");
vakata_context.is_visible = true;
/**
* triggered on the document when the contextmenu is shown
* @event
* @plugin contextmenu
* @name context_show.vakata
* @param {jQuery} reference the element that was right clicked
* @param {jQuery} element the DOM element of the menu itself
* @param {Object} position the x & y coordinates of the menu
*/
$.vakata.context._trigger("show");
}
},
hide : function () {
if(vakata_context.is_visible) {
vakata_context.element.hide().find("ul").hide().end().find(':focus').blur();
vakata_context.is_visible = false;
/**
* triggered on the document when the contextmenu is hidden
* @event
* @plugin contextmenu
* @name context_hide.vakata
* @param {jQuery} reference the element that was right clicked
* @param {jQuery} element the DOM element of the menu itself
* @param {Object} position the x & y coordinates of the menu
*/
$.vakata.context._trigger("hide");
}
}
};
$(function () {
right_to_left = $("body").css("direction") === "rtl";
var to = false;
vakata_context.element = $("<ul class='vakata-context'></ul>");
vakata_context.element
.on("mouseenter", "li", function (e) {
e.stopImmediatePropagation();
if($.contains(this, e.relatedTarget)) {
// премахнато заради delegate mouseleave по-долу
// $(this).find(".vakata-context-hover").removeClass("vakata-context-hover");
return;
}
if(to) { clearTimeout(to); }
vakata_context.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end();
$(this)
.siblings().find("ul").hide().end().end()
.parentsUntil(".vakata-context", "li").addBack().addClass("vakata-context-hover");
$.vakata.context._show_submenu(this);
})
// тестово - дали не натоварва?
.on("mouseleave", "li", function (e) {
if($.contains(this, e.relatedTarget)) { return; }
$(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover");
})
.on("mouseleave", function (e) {
$(this).find(".vakata-context-hover").removeClass("vakata-context-hover");
if($.vakata.context.settings.hide_onmouseleave) {
to = setTimeout(
(function (t) {
return function () { $.vakata.context.hide(); };
}(this)), $.vakata.context.settings.hide_onmouseleave);
}
})
.on("click", "a", function (e) {
e.preventDefault();
})
.on("mouseup", "a", function (e) {
if(!$(this).blur().parent().hasClass("vakata-context-disabled") && $.vakata.context._execute($(this).attr("rel")) !== false) {
$.vakata.context.hide();
}
})
.on('keydown', 'a', function (e) {
var o = null;
switch(e.which) {
case 13:
case 32:
e.type = "mouseup";
e.preventDefault();
$(e.currentTarget).trigger(e);
break;
case 37:
if(vakata_context.is_visible) {
vakata_context.element.find(".vakata-context-hover").last().parents("li:eq(0)").find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children('a').focus();
e.stopImmediatePropagation();
e.preventDefault();
}
break;
case 38:
if(vakata_context.is_visible) {
o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first();
if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last(); }
o.addClass("vakata-context-hover").children('a').focus();
e.stopImmediatePropagation();
e.preventDefault();
}
break;
case 39:
if(vakata_context.is_visible) {
vakata_context.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children('a').focus();
e.stopImmediatePropagation();
e.preventDefault();
}
break;
case 40:
if(vakata_context.is_visible) {
o = vakata_context.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first();
if(!o.length) { o = vakata_context.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first(); }
o.addClass("vakata-context-hover").children('a').focus();
e.stopImmediatePropagation();
e.preventDefault();
}
break;
case 27:
$.vakata.context.hide();
e.preventDefault();
break;
default:
//console.log(e.which);
break;
}
})
.on('keydown', function (e) {
e.preventDefault();
var a = vakata_context.element.find('.vakata-contextmenu-shortcut-' + e.which).parent();
if(a.parent().not('.vakata-context-disabled')) {
a.mouseup();
}
})
.appendTo("body");
$(document)
.on("mousedown", function (e) {
if(vakata_context.is_visible && !$.contains(vakata_context.element[0], e.target)) { $.vakata.context.hide(); }
})
.on("context_show.vakata", function (e, data) {
vakata_context.element.find("li:has(ul)").children("a").addClass("vakata-context-parent");
if(right_to_left) {
vakata_context.element.addClass("vakata-context-rtl").css("direction", "rtl");
}
// also apply a RTL class?
vakata_context.element.find("ul").hide().end();
});
});
}($));
// $.jstree.defaults.plugins.push("contextmenu");
}));

View File

@@ -0,0 +1,479 @@
/**
* ### Drag'n'drop plugin
*
* Enables dragging and dropping of nodes in the tree, resulting in a move or copy operations.
*/
/*globals jQuery, define, exports, require, document */
(function (factory) {
"use strict";
if (typeof define === 'function' && define.amd) {
define('jstree.dnd', ['jquery','jstree'], factory);
}
else if(typeof exports === 'object') {
factory(require('jquery'), require('jstree'));
}
else {
factory(jQuery, jQuery.jstree);
}
}(function ($, jstree, undefined) {
"use strict";
if($.jstree.plugins.dnd) { return; }
/**
* stores all defaults for the drag'n'drop plugin
* @name $.jstree.defaults.dnd
* @plugin dnd
*/
$.jstree.defaults.dnd = {
/**
* a boolean indicating if a copy should be possible while dragging (by pressint the meta key or Ctrl). Defaults to `true`.
* @name $.jstree.defaults.dnd.copy
* @plugin dnd
*/
copy : true,
/**
* a number indicating how long a node should remain hovered while dragging to be opened. Defaults to `500`.
* @name $.jstree.defaults.dnd.open_timeout
* @plugin dnd
*/
open_timeout : 500,
/**
* a function invoked each time a node is about to be dragged, invoked in the tree's scope and receives the node as an argument - return `false` to prevent dragging
* @name $.jstree.defaults.dnd.is_draggable
* @plugin dnd
*/
is_draggable : true,
/**
* a boolean indicating if checks should constantly be made while the user is dragging the node (as opposed to checking only on drop), default is `true`
* @name $.jstree.defaults.dnd.check_while_dragging
* @plugin dnd
*/
check_while_dragging : true
};
// TODO: now check works by checking for each node individually, how about max_children, unique, etc?
// TODO: drop somewhere else - maybe demo only?
$.jstree.plugins.dnd = function (options, parent) {
this.bind = function () {
parent.bind.call(this);
this.element
.on('mousedown touchstart', '.jstree-anchor', $.proxy(function (e) {
var obj = this.get_node(e.target),
mlt = this.is_selected(obj) ? this.get_selected().length : 1;
if(obj && obj.id && obj.id !== "#" && (e.which === 1 || e.type === "touchstart") &&
(this.settings.dnd.is_draggable === true || ($.isFunction(this.settings.dnd.is_draggable) && this.settings.dnd.is_draggable.call(this, obj)))
) {
this.element.trigger('mousedown.jstree');
return $.vakata.dnd.start(e, { 'jstree' : true, 'origin' : this, 'obj' : this.get_node(obj,true), 'nodes' : mlt > 1 ? this.get_selected() : [obj.id] }, '<div id="jstree-dnd" class="jstree-' + this.get_theme() + '"><i class="jstree-icon jstree-er"></i>' + (mlt > 1 ? mlt + ' ' + this.get_string('nodes') : this.get_text(e.currentTarget, true)) + '<ins class="jstree-copy" style="display:none;">+</ins></div>');
}
}, this));
};
};
$(function() {
// bind only once for all instances
var lastmv = false,
laster = false,
opento = false,
marker = $('<div id="jstree-marker">&#160;</div>').hide().appendTo('body');
$(document)
.bind('dnd_start.vakata', function (e, data) {
lastmv = false;
})
.bind('dnd_move.vakata', function (e, data) {
if(opento) { clearTimeout(opento); }
if(!data.data.jstree) { return; }
// if we are hovering the marker image do nothing (can happen on "inside" drags)
if(data.event.target.id && data.event.target.id === 'jstree-marker') {
return;
}
var ins = $.jstree.reference(data.event.target),
ref = false,
off = false,
rel = false,
l, t, h, p, i, o, ok, t1, t2, op, ps, pr;
// if we are over an instance
if(ins && ins._data && ins._data.dnd) {
marker.attr('class', 'jstree-' + ins.get_theme());
data.helper
.children().attr('class', 'jstree-' + ins.get_theme())
.find('.jstree-copy:eq(0)')[ data.data.origin && data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey) ? 'show' : 'hide' ]();
// if are hovering the container itself add a new root node
if( (data.event.target === ins.element[0] || data.event.target === ins.get_container_ul()[0]) && ins.get_container_ul().children().length === 0) {
ok = true;
for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) {
ok = ok && ins.check( (data.data.origin && data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey) ? "copy_node" : "move_node"), (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), '#', 'last');
if(!ok) { break; }
}
if(ok) {
lastmv = { 'ins' : ins, 'par' : '#', 'pos' : 'last' };
marker.hide();
data.helper.find('.jstree-icon:eq(0)').removeClass('jstree-er').addClass('jstree-ok');
return;
}
}
else {
// if we are hovering a tree node
ref = $(data.event.target).closest('a');
if(ref && ref.length && ref.parent().is('.jstree-closed, .jstree-open, .jstree-leaf')) {
off = ref.offset();
rel = data.event.pageY - off.top;
h = ref.height();
if(rel < h / 3) {
o = ['b', 'i', 'a'];
}
else if(rel > h - h / 3) {
o = ['a', 'i', 'b'];
}
else {
o = rel > h / 2 ? ['i', 'a', 'b'] : ['i', 'b', 'a'];
}
$.each(o, function (j, v) {
switch(v) {
case 'b':
l = off.left - 6;
t = off.top - 5;
p = ins.get_parent(ref);
i = ref.parent().index();
break;
case 'i':
l = off.left - 2;
t = off.top - 5 + h / 2 + 1;
p = ref.parent();
i = 0;
break;
case 'a':
l = off.left - 6;
t = off.top - 5 + h;
p = ins.get_parent(ref);
i = ref.parent().index() + 1;
break;
}
/*!
// TODO: moving inside, but the node is not yet loaded?
// the check will work anyway, as when moving the node will be loaded first and checked again
if(v === 'i' && !ins.is_loaded(p)) { }
*/
ok = true;
for(t1 = 0, t2 = data.data.nodes.length; t1 < t2; t1++) {
op = data.data.origin && data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey) ? "copy_node" : "move_node";
ps = i;
if(op === "move_node" && v === 'a' && (data.data.origin && data.data.origin === ins) && p === ins.get_parent(data.data.nodes[t1])) {
pr = ins.get_node(p);
if(ps > $.inArray(data.data.nodes[t1], pr.children)) {
ps -= 1;
}
}
ok = ok && ( (ins && ins.settings && ins.settings.dnd && ins.settings.dnd.check_while_dragging === false) || ins.check(op, (data.data.origin && data.data.origin !== ins ? data.data.origin.get_node(data.data.nodes[t1]) : data.data.nodes[t1]), p, ps) );
if(!ok) {
if(ins && ins.last_error) { laster = ins.last_error(); }
break;
}
}
if(ok) {
if(v === 'i' && ref.parent().is('.jstree-closed') && ins.settings.dnd.open_timeout) {
opento = setTimeout((function (x, z) { return function () { x.open_node(z); }; }(ins, ref)), ins.settings.dnd.open_timeout);
}
lastmv = { 'ins' : ins, 'par' : p, 'pos' : i };
marker.css({ 'left' : l + 'px', 'top' : t + 'px' }).show();
data.helper.find('.jstree-icon:eq(0)').removeClass('jstree-er').addClass('jstree-ok');
laster = {};
o = true;
return false;
}
});
if(o === true) { return; }
}
}
}
lastmv = false;
data.helper.find('.jstree-icon').removeClass('jstree-ok').addClass('jstree-er');
marker.hide();
})
.bind('dnd_scroll.vakata', function (e, data) {
if(!data.data.jstree) { return; }
marker.hide();
lastmv = false;
data.helper.find('.jstree-icon:eq(0)').removeClass('jstree-ok').addClass('jstree-er');
})
.bind('dnd_stop.vakata', function (e, data) {
if(opento) { clearTimeout(opento); }
if(!data.data.jstree) { return; }
marker.hide();
var i, j, nodes = [];
if(lastmv) {
for(i = 0, j = data.data.nodes.length; i < j; i++) {
nodes[i] = data.data.origin ? data.data.origin.get_node(data.data.nodes[i]) : data.data.nodes[i];
}
lastmv.ins[ data.data.origin && data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey) ? 'copy_node' : 'move_node' ](nodes, lastmv.par, lastmv.pos);
}
else {
i = $(data.event.target).closest('.jstree');
if(i.length && laster && laster.error && laster.error === 'check') {
i = i.jstree(true);
if(i) {
i.settings.core.error.call(this, laster);
}
}
}
})
.bind('keyup keydown', function (e, data) {
data = $.vakata.dnd._get();
if(data.data && data.data.jstree) {
data.helper.find('.jstree-copy:eq(0)')[ data.data.origin && data.data.origin.settings.dnd.copy && (e.metaKey || e.ctrlKey) ? 'show' : 'hide' ]();
}
});
});
// helpers
(function ($) {
$.fn.vakata_reverse = [].reverse;
// private variable
var vakata_dnd = {
element : false,
is_down : false,
is_drag : false,
helper : false,
helper_w: 0,
data : false,
init_x : 0,
init_y : 0,
scroll_l: 0,
scroll_t: 0,
scroll_e: false,
scroll_i: false
};
$.vakata.dnd = {
settings : {
scroll_speed : 10,
scroll_proximity : 20,
helper_left : 5,
helper_top : 10,
threshold : 5
},
_trigger : function (event_name, e) {
var data = $.vakata.dnd._get();
data.event = e;
$(document).triggerHandler("dnd_" + event_name + ".vakata", data);
},
_get : function () {
return {
"data" : vakata_dnd.data,
"element" : vakata_dnd.element,
"helper" : vakata_dnd.helper
};
},
_clean : function () {
if(vakata_dnd.helper) { vakata_dnd.helper.remove(); }
if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; }
vakata_dnd = {
element : false,
is_down : false,
is_drag : false,
helper : false,
helper_w: 0,
data : false,
init_x : 0,
init_y : 0,
scroll_l: 0,
scroll_t: 0,
scroll_e: false,
scroll_i: false
};
$(document).off("mousemove touchmove", $.vakata.dnd.drag);
$(document).off("mouseup touchend", $.vakata.dnd.stop);
},
_scroll : function (init_only) {
if(!vakata_dnd.scroll_e || (!vakata_dnd.scroll_l && !vakata_dnd.scroll_t)) {
if(vakata_dnd.scroll_i) { clearInterval(vakata_dnd.scroll_i); vakata_dnd.scroll_i = false; }
return false;
}
if(!vakata_dnd.scroll_i) {
vakata_dnd.scroll_i = setInterval($.vakata.dnd._scroll, 100);
return false;
}
if(init_only === true) { return false; }
var i = vakata_dnd.scroll_e.scrollTop(),
j = vakata_dnd.scroll_e.scrollLeft();
vakata_dnd.scroll_e.scrollTop(i + vakata_dnd.scroll_t * $.vakata.dnd.settings.scroll_speed);
vakata_dnd.scroll_e.scrollLeft(j + vakata_dnd.scroll_l * $.vakata.dnd.settings.scroll_speed);
if(i !== vakata_dnd.scroll_e.scrollTop() || j !== vakata_dnd.scroll_e.scrollLeft()) {
/**
* triggered on the document when a drag causes an element to scroll
* @event
* @plugin dnd
* @name dnd_scroll.vakata
* @param {Mixed} data any data supplied with the call to $.vakata.dnd.start
* @param {DOM} element the DOM element being dragged
* @param {jQuery} helper the helper shown next to the mouse
* @param {jQuery} event the element that is scrolling
*/
$.vakata.dnd._trigger("scroll", vakata_dnd.scroll_e);
}
},
start : function (e, data, html) {
if(e.type === "touchstart" && e.originalEvent && e.originalEvent.targetTouches && e.originalEvent.targetTouches[0]) {
e.pageX = e.originalEvent.targetTouches[0].pageX;
e.pageY = e.originalEvent.targetTouches[0].pageY;
e.target = document.elementFromPoint(e.originalEvent.targetTouches[0].pageX - window.pageXOffset, e.originalEvent.targetTouches[0].pageY - window.pageYOffset);
}
if(vakata_dnd.is_drag) { $.vakata.dnd.stop({}); }
try {
e.currentTarget.unselectable = "on";
e.currentTarget.onselectstart = function() { return false; };
if(e.currentTarget.style) { e.currentTarget.style.MozUserSelect = "none"; }
} catch(ignore) { }
vakata_dnd.init_x = e.pageX;
vakata_dnd.init_y = e.pageY;
vakata_dnd.data = data;
vakata_dnd.is_down = true;
vakata_dnd.element = e.currentTarget;
if(html !== false) {
vakata_dnd.helper = $("<div id='vakata-dnd'></div>").html(html).css({
"display" : "block",
"margin" : "0",
"padding" : "0",
"position" : "absolute",
"top" : "-2000px",
"lineHeight" : "16px",
"zIndex" : "10000"
});
}
$(document).bind("mousemove touchmove", $.vakata.dnd.drag);
$(document).bind("mouseup touchend", $.vakata.dnd.stop);
return false;
},
drag : function (e) {
if(e.type === "touchmove" && e.originalEvent && e.originalEvent.targetTouches && e.originalEvent.targetTouches[0]) {
e.pageX = e.originalEvent.targetTouches[0].pageX;
e.pageY = e.originalEvent.targetTouches[0].pageY;
e.target = document.elementFromPoint(e.originalEvent.targetTouches[0].pageX - window.pageXOffset, e.originalEvent.targetTouches[0].pageY - window.pageYOffset);
}
if(!vakata_dnd.is_down) { return; }
if(!vakata_dnd.is_drag) {
if(
Math.abs(e.pageX - vakata_dnd.init_x) > $.vakata.dnd.settings.threshold ||
Math.abs(e.pageY - vakata_dnd.init_y) > $.vakata.dnd.settings.threshold
) {
if(vakata_dnd.helper) {
vakata_dnd.helper.appendTo("body");
vakata_dnd.helper_w = vakata_dnd.helper.outerWidth();
}
vakata_dnd.is_drag = true;
/**
* triggered on the document when a drag starts
* @event
* @plugin dnd
* @name dnd_start.vakata
* @param {Mixed} data any data supplied with the call to $.vakata.dnd.start
* @param {DOM} element the DOM element being dragged
* @param {jQuery} helper the helper shown next to the mouse
* @param {Object} event the event that caused the start (probably mousemove)
*/
$.vakata.dnd._trigger("start", e);
}
else { return; }
}
var d = false, w = false,
dh = false, wh = false,
dw = false, ww = false,
dt = false, dl = false,
ht = false, hl = false;
vakata_dnd.scroll_t = 0;
vakata_dnd.scroll_l = 0;
vakata_dnd.scroll_e = false;
$(e.target)
.parentsUntil("body").addBack().vakata_reverse()
.filter(function () {
return (/^auto|scroll$/).test($(this).css("overflow")) &&
(this.scrollHeight > this.offsetHeight || this.scrollWidth > this.offsetWidth);
})
.each(function () {
var t = $(this), o = t.offset();
if(this.scrollHeight > this.offsetHeight) {
if(o.top + t.height() - e.pageY < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; }
if(e.pageY - o.top < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; }
}
if(this.scrollWidth > this.offsetWidth) {
if(o.left + t.width() - e.pageX < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; }
if(e.pageX - o.left < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; }
}
if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) {
vakata_dnd.scroll_e = $(this);
return false;
}
});
if(!vakata_dnd.scroll_e) {
d = $(document); w = $(window);
dh = d.height(); wh = w.height();
dw = d.width(); ww = w.width();
dt = d.scrollTop(); dl = d.scrollLeft();
if(dh > wh && e.pageY - dt < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = -1; }
if(dh > wh && wh - (e.pageY - dt) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_t = 1; }
if(dw > ww && e.pageX - dl < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = -1; }
if(dw > ww && ww - (e.pageX - dl) < $.vakata.dnd.settings.scroll_proximity) { vakata_dnd.scroll_l = 1; }
if(vakata_dnd.scroll_t || vakata_dnd.scroll_l) {
vakata_dnd.scroll_e = d;
}
}
if(vakata_dnd.scroll_e) { $.vakata.dnd._scroll(true); }
if(vakata_dnd.helper) {
ht = parseInt(e.pageY + $.vakata.dnd.settings.helper_top, 10);
hl = parseInt(e.pageX + $.vakata.dnd.settings.helper_left, 10);
if(dh && ht + 25 > dh) { ht = dh - 50; }
if(dw && hl + vakata_dnd.helper_w > dw) { hl = dw - (vakata_dnd.helper_w + 2); }
vakata_dnd.helper.css({
left : hl + "px",
top : ht + "px"
});
}
/**
* triggered on the document when a drag is in progress
* @event
* @plugin dnd
* @name dnd_move.vakata
* @param {Mixed} data any data supplied with the call to $.vakata.dnd.start
* @param {DOM} element the DOM element being dragged
* @param {jQuery} helper the helper shown next to the mouse
* @param {Object} event the event that caused this to trigger (most likely mousemove)
*/
$.vakata.dnd._trigger("move", e);
},
stop : function (e) {
if(e.type === "touchend" && e.originalEvent && e.originalEvent.targetTouches && e.originalEvent.targetTouches[0]) {
e.pageX = e.originalEvent.targetTouches[0].pageX;
e.pageY = e.originalEvent.targetTouches[0].pageY;
e.target = document.elementFromPoint(e.originalEvent.targetTouches[0].pageX - window.pageXOffset, e.originalEvent.targetTouches[0].pageY - window.pageYOffset);
}
if(vakata_dnd.is_drag) {
/**
* triggered on the document when a drag stops (the dragged element is dropped)
* @event
* @plugin dnd
* @name dnd_stop.vakata
* @param {Mixed} data any data supplied with the call to $.vakata.dnd.start
* @param {DOM} element the DOM element being dragged
* @param {jQuery} helper the helper shown next to the mouse
* @param {Object} event the event that caused the stop
*/
$.vakata.dnd._trigger("stop", e);
}
$.vakata.dnd._clean();
}
};
}(jQuery));
// include the dnd plugin by default
// $.jstree.defaults.plugins.push("dnd");
}));

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,363 @@
/**
* ### Search plugin
*
* Adds search functionality to jsTree.
*/
/*globals jQuery, define, exports, require, document */
(function (factory) {
"use strict";
if (typeof define === 'function' && define.amd) {
define('jstree.search', ['jquery','jstree'], factory);
}
else if(typeof exports === 'object') {
factory(require('jquery'), require('jstree'));
}
else {
factory(jQuery, jQuery.jstree);
}
}(function ($, jstree, undefined) {
"use strict";
if($.jstree.plugins.search) { return; }
/**
* stores all defaults for the search plugin
* @name $.jstree.defaults.search
* @plugin search
*/
$.jstree.defaults.search = {
/**
* a jQuery-like AJAX config, which jstree uses if a server should be queried for results.
*
* A `str` (which is the search string) parameter will be added with the request. The expected result is a JSON array with nodes that need to be opened so that matching nodes will be revealed.
* Leave this setting as `false` to not query the server.
* @name $.jstree.defaults.search.ajax
* @plugin search
*/
ajax : false,
/**
* Indicates if the search should be fuzzy or not (should `chnd3` match `child node 3`). Default is `true`.
* @name $.jstree.defaults.search.fuzzy
* @plugin search
*/
fuzzy : true,
/**
* Indicates if the search should be case sensitive. Default is `false`.
* @name $.jstree.defaults.search.case_sensitive
* @plugin search
*/
case_sensitive : false,
/**
* Indicates if the tree should be filtered to show only matching nodes (keep in mind this can be a heavy on large trees in old browsers). Default is `false`.
* @name $.jstree.defaults.search.show_only_matches
* @plugin search
*/
show_only_matches : false,
/**
* Indicates if all nodes opened to reveal the search result, should be closed when the search is cleared or a new search is performed. Default is `true`.
* @name $.jstree.defaults.search.close_opened_onclear
* @plugin search
*/
close_opened_onclear : true
};
$.jstree.plugins.search = function (options, parent) {
this.bind = function () {
parent.bind.call(this);
this._data.search.str = "";
this._data.search.dom = $();
this._data.search.res = [];
this._data.search.opn = [];
this._data.search.sln = null;
if(this.settings.search.show_only_matches) {
this.element
.on("search.jstree", function (e, data) {
if(data.nodes.length) {
$(this).find("li").hide().filter('.jstree-last').filter(function() { return this.nextSibling; }).removeClass('jstree-last');
data.nodes.parentsUntil(".jstree").addBack().show()
.filter("ul").each(function () { $(this).children("li:visible").eq(-1).addClass("jstree-last"); });
}
})
.on("clear_search.jstree", function (e, data) {
if(data.nodes.length) {
$(this).find("li").css("display","").filter('.jstree-last').filter(function() { return this.nextSibling; }).removeClass('jstree-last');
}
});
}
};
/**
* used to search the tree nodes for a given string
* @name search(str [, skip_async])
* @param {String} str the search string
* @param {Boolean} skip_async if set to true server will not be queried even if configured
* @plugin search
* @trigger search.jstree
*/
this.search = function (str, skip_async) {
if(str === false || $.trim(str) === "") {
return this.clear_search();
}
var s = this.settings.search,
a = s.ajax ? $.extend({}, s.ajax) : false,
f = null,
r = [],
p = [], i, j;
if(this._data.search.res.length) {
this.clear_search();
}
if(!skip_async && a !== false) {
if(!a.data) { a.data = {}; }
a.data.str = str;
return $.ajax(a)
.fail($.proxy(function () {
this._data.core.last_error = { 'error' : 'ajax', 'plugin' : 'search', 'id' : 'search_01', 'reason' : 'Could not load search parents', 'data' : JSON.stringify(a) };
this.settings.core.error.call(this, this._data.core.last_error);
}, this))
.done($.proxy(function (d) {
if(d && d.d) { d = d.d; }
this._data.search.sln = !$.isArray(d) ? [] : d;
this._search_load(str);
}, this));
}
this._data.search.str = str;
this._data.search.dom = $();
this._data.search.res = [];
this._data.search.opn = [];
f = new $.vakata.search(str, true, { caseSensitive : s.case_sensitive, fuzzy : s.fuzzy });
$.each(this._model.data, function (i, v) {
if(v.text && f.search(v.text).isMatch) {
r.push(i);
p = p.concat(v.parents);
}
});
if(r.length) {
p = $.vakata.array_unique(p);
this._search_open(p);
for(i = 0, j = r.length; i < j; i++) {
f = this.get_node(r[i], true);
if(f) {
this._data.search.dom = this._data.search.dom.add(f);
}
}
this._data.search.res = r;
this._data.search.dom.children(".jstree-anchor").addClass('jstree-search');
}
/**
* triggered after search is complete
* @event
* @name search.jstree
* @param {jQuery} nodes a jQuery collection of matching nodes
* @param {String} str the search string
* @param {Array} res a collection of objects represeing the matching nodes
* @plugin search
*/
this.trigger('search', { nodes : this._data.search.dom, str : str, res : this._data.search.res });
};
/**
* used to clear the last search (removes classes and shows all nodes if filtering is on)
* @name clear_search()
* @plugin search
* @trigger clear_search.jstree
*/
this.clear_search = function () {
this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search");
if(this.settings.search.close_opened_onclear) {
this.close_node(this._data.search.opn, 0);
}
/**
* triggered after search is complete
* @event
* @name clear_search.jstree
* @param {jQuery} nodes a jQuery collection of matching nodes (the result from the last search)
* @param {String} str the search string (the last search string)
* @param {Array} res a collection of objects represeing the matching nodes (the result from the last search)
* @plugin search
*/
this.trigger('clear_search', { 'nodes' : this._data.search.dom, str : this._data.search.str, res : this._data.search.res });
this._data.search.str = "";
this._data.search.res = [];
this._data.search.opn = [];
this._data.search.dom = $();
};
/**
* opens nodes that need to be opened to reveal the search results. Used only internally.
* @private
* @name _search_open(d)
* @param {Array} d an array of node IDs
* @plugin search
*/
this._search_open = function (d) {
var t = this;
$.each(d.concat([]), function (i, v) {
v = document.getElementById(v);
if(v) {
if(t.is_closed(v)) {
t._data.search.opn.push(v.id);
t.open_node(v, function () { t._search_open(d); }, 0);
}
}
});
};
/**
* loads nodes that need to be opened to reveal the search results. Used only internally.
* @private
* @name _search_load(d, str)
* @param {String} str the search string
* @plugin search
*/
this._search_load = function (str) {
var res = true,
t = this,
m = t._model.data;
if($.isArray(this._data.search.sln)) {
if(!this._data.search.sln.length) {
this._data.search.sln = null;
this.search(str, true);
}
else {
$.each(this._data.search.sln, function (i, v) {
if(m[v]) {
$.vakata.array_remove_item(t._data.search.sln, v);
if(!m[v].state.loaded) {
t.load_node(v, function (o, s) { if(s) { t._search_load(str); } });
res = false;
}
}
});
if(res) {
this._data.search.sln = [];
this._search_load(str);
}
}
}
};
};
// helpers
(function ($) {
// from http://kiro.me/projects/fuse.html
$.vakata.search = function(pattern, txt, options) {
options = options || {};
if(options.fuzzy !== false) {
options.fuzzy = true;
}
pattern = options.caseSensitive ? pattern : pattern.toLowerCase();
var MATCH_LOCATION = options.location || 0,
MATCH_DISTANCE = options.distance || 100,
MATCH_THRESHOLD = options.threshold || 0.6,
patternLen = pattern.length,
matchmask, pattern_alphabet, match_bitapScore, search;
if(patternLen > 32) {
options.fuzzy = false;
}
if(options.fuzzy) {
matchmask = 1 << (patternLen - 1);
pattern_alphabet = (function () {
var mask = {},
i = 0;
for (i = 0; i < patternLen; i++) {
mask[pattern.charAt(i)] = 0;
}
for (i = 0; i < patternLen; i++) {
mask[pattern.charAt(i)] |= 1 << (patternLen - i - 1);
}
return mask;
}());
match_bitapScore = function (e, x) {
var accuracy = e / patternLen,
proximity = Math.abs(MATCH_LOCATION - x);
if(!MATCH_DISTANCE) {
return proximity ? 1.0 : accuracy;
}
return accuracy + (proximity / MATCH_DISTANCE);
};
}
search = function (text) {
text = options.caseSensitive ? text : text.toLowerCase();
if(pattern === text || text.indexOf(pattern) !== -1) {
return {
isMatch: true,
score: 0
};
}
if(!options.fuzzy) {
return {
isMatch: false,
score: 1
};
}
var i, j,
textLen = text.length,
scoreThreshold = MATCH_THRESHOLD,
bestLoc = text.indexOf(pattern, MATCH_LOCATION),
binMin, binMid,
binMax = patternLen + textLen,
lastRd, start, finish, rd, charMatch,
score = 1,
locations = [];
if (bestLoc !== -1) {
scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold);
bestLoc = text.lastIndexOf(pattern, MATCH_LOCATION + patternLen);
if (bestLoc !== -1) {
scoreThreshold = Math.min(match_bitapScore(0, bestLoc), scoreThreshold);
}
}
bestLoc = -1;
for (i = 0; i < patternLen; i++) {
binMin = 0;
binMid = binMax;
while (binMin < binMid) {
if (match_bitapScore(i, MATCH_LOCATION + binMid) <= scoreThreshold) {
binMin = binMid;
} else {
binMax = binMid;
}
binMid = Math.floor((binMax - binMin) / 2 + binMin);
}
binMax = binMid;
start = Math.max(1, MATCH_LOCATION - binMid + 1);
finish = Math.min(MATCH_LOCATION + binMid, textLen) + patternLen;
rd = new Array(finish + 2);
rd[finish + 1] = (1 << i) - 1;
for (j = finish; j >= start; j--) {
charMatch = pattern_alphabet[text.charAt(j - 1)];
if (i === 0) {
rd[j] = ((rd[j + 1] << 1) | 1) & charMatch;
} else {
rd[j] = ((rd[j + 1] << 1) | 1) & charMatch | (((lastRd[j + 1] | lastRd[j]) << 1) | 1) | lastRd[j + 1];
}
if (rd[j] & matchmask) {
score = match_bitapScore(i, j - 1);
if (score <= scoreThreshold) {
scoreThreshold = score;
bestLoc = j - 1;
locations.push(bestLoc);
if (bestLoc > MATCH_LOCATION) {
start = Math.max(1, 2 * MATCH_LOCATION - bestLoc);
} else {
break;
}
}
}
}
if (match_bitapScore(i + 1, MATCH_LOCATION) > scoreThreshold) {
break;
}
lastRd = rd;
}
return {
isMatch: bestLoc >= 0,
score: score
};
};
return txt === true ? { 'search' : search } : search(txt);
};
}(jQuery));
// include the search plugin by default
// $.jstree.defaults.plugins.push("search");
}));

View File

@@ -0,0 +1,74 @@
/**
* ### Sort plugin
*
* Autmatically sorts all siblings in the tree according to a sorting function.
*/
/*globals jQuery, define, exports, require */
(function (factory) {
"use strict";
if (typeof define === 'function' && define.amd) {
define('jstree.sort', ['jquery','jstree'], factory);
}
else if(typeof exports === 'object') {
factory(require('jquery'), require('jstree'));
}
else {
factory(jQuery, jQuery.jstree);
}
}(function ($, jstree, undefined) {
"use strict";
if($.jstree.plugins.sort) { return; }
/**
* the settings function used to sort the nodes.
* It is executed in the tree's context, accepts two nodes as arguments and should return `1` or `-1`.
* @name $.jstree.defaults.sort
* @plugin sort
*/
$.jstree.defaults.sort = function (a, b) {
//return this.get_type(a) === this.get_type(b) ? (this.get_text(a) > this.get_text(b) ? 1 : -1) : this.get_type(a) >= this.get_type(b);
return this.get_text(a) > this.get_text(b) ? 1 : -1;
};
$.jstree.plugins.sort = function (options, parent) {
this.bind = function () {
parent.bind.call(this);
this.element
.on("model.jstree", $.proxy(function (e, data) {
this.sort(data.parent, true);
}, this))
.on("rename_node.jstree create_node.jstree", $.proxy(function (e, data) {
this.sort(data.parent || data.node.parent, false);
this.redraw_node(data.parent || data.node.parent, true);
}, this))
.on("move_node.jstree copy_node.jstree", $.proxy(function (e, data) {
this.sort(data.parent, false);
this.redraw_node(data.parent, true);
}, this));
};
/**
* used to sort a node's children
* @private
* @name sort(obj [, deep])
* @param {mixed} obj the node
* @param {Boolean} deep if set to `true` nodes are sorted recursively.
* @plugin sort
* @trigger search.jstree
*/
this.sort = function (obj, deep) {
var i, j;
obj = this.get_node(obj);
if(obj && obj.children && obj.children.length) {
obj.children.sort($.proxy(this.settings.sort, this));
if(deep) {
for(i = 0, j = obj.children_d.length; i < j; i++) {
this.sort(obj.children_d[i], false);
}
}
}
};
};
// include the sort plugin by default
// $.jstree.defaults.plugins.push("sort");
}));

View File

@@ -0,0 +1,118 @@
/**
* ### State plugin
*
* Saves the state of the tree (selected nodes, opened nodes) on the user's computer using available options (localStorage, cookies, etc)
*/
/*globals jQuery, define, exports, require */
(function (factory) {
"use strict";
if (typeof define === 'function' && define.amd) {
define('jstree.state', ['jquery','jstree'], factory);
}
else if(typeof exports === 'object') {
factory(require('jquery'), require('jstree'));
}
else {
factory(jQuery, jQuery.jstree);
}
}(function ($, jstree, undefined) {
"use strict";
if($.jstree.plugins.state) { return; }
var to = false;
/**
* stores all defaults for the state plugin
* @name $.jstree.defaults.state
* @plugin state
*/
$.jstree.defaults.state = {
/**
* A string for the key to use when saving the current tree (change if using multiple trees in your project). Defaults to `jstree`.
* @name $.jstree.defaults.state.key
* @plugin state
*/
key : 'jstree',
/**
* A space separated list of events that trigger a state save. Defaults to `changed.jstree open_node.jstree close_node.jstree`.
* @name $.jstree.defaults.state.events
* @plugin state
*/
events : 'changed.jstree open_node.jstree close_node.jstree',
/**
* Time in milliseconds after which the state will expire. Defaults to 'false' meaning - no expire.
* @name $.jstree.defaults.state.ttl
* @plugin state
*/
ttl : false,
/**
* A function that will be executed prior to restoring state with one argument - the state object. Can be used to clear unwanted parts of the state.
* @name $.jstree.defaults.state.filter
* @plugin state
*/
filter : false
};
$.jstree.plugins.state = function (options, parent) {
this.bind = function () {
parent.bind.call(this);
var bind = $.proxy(function () {
this.element.on(this.settings.state.events, $.proxy(function () {
if(to) { clearTimeout(to); }
to = setTimeout($.proxy(function () { this.save_state(); }, this), 100);
}, this));
}, this);
this.element
.on("ready.jstree", $.proxy(function (e, data) {
this.element.one("restore_state.jstree", bind);
if(!this.restore_state()) { bind(); }
}, this));
};
/**
* save the state
* @name save_state()
* @plugin state
*/
this.save_state = function () {
var st = { 'state' : this.get_state(), 'ttl' : this.settings.state.ttl, 'sec' : +(new Date()) };
$.vakata.storage.set(this.settings.state.key, JSON.stringify(st));
};
/**
* restore the state from the user's computer
* @name restore_state()
* @plugin state
*/
this.restore_state = function () {
var k = $.vakata.storage.get(this.settings.state.key);
if(!!k) { try { k = JSON.parse(k); } catch(ex) { return false; } }
if(!!k && k.ttl && k.sec && +(new Date()) - k.sec > k.ttl) { return false; }
if(!!k && k.state) { k = k.state; }
if(!!k && $.isFunction(this.settings.state.filter)) { k = this.settings.state.filter.call(this, k); }
if(!!k) {
this.element.one("set_state.jstree", function (e, data) { data.instance.trigger('restore_state', { 'state' : $.extend(true, {}, k) }); });
this.set_state(k);
return true;
}
return false;
};
/**
* clear the state on the user's computer
* @name clear_state()
* @plugin state
*/
this.clear_state = function () {
return $.vakata.storage.del(this.settings.state.key);
};
};
(function ($, undefined) {
$.vakata.storage = {
// simply specifying the functions in FF throws an error
set : function (key, val) { return window.localStorage.setItem(key, val); },
get : function (key) { return window.localStorage.getItem(key); },
del : function (key) { return window.localStorage.removeItem(key); }
};
}(jQuery));
// include the state plugin by default
// $.jstree.defaults.plugins.push("state");
}));

View File

@@ -0,0 +1,225 @@
/**
* ### Types plugin
*
* Makes it possible to add predefined types for groups of nodes, which make it possible to easily control nesting rules and icon for each group.
*/
/*globals jQuery, define, exports, require */
(function (factory) {
"use strict";
if (typeof define === 'function' && define.amd) {
define('jstree.types', ['jquery','jstree'], factory);
}
else if(typeof exports === 'object') {
factory(require('jquery'), require('jstree'));
}
else {
factory(jQuery, jQuery.jstree);
}
}(function ($, jstree, undefined) {
"use strict";
if($.jstree.plugins.types) { return; }
/**
* An object storing all types as key value pairs, where the key is the type name and the value is an object that could contain following keys (all optional).
*
* * `max_children` the maximum number of immediate children this node type can have. Do not specify or set to `-1` for unlimited.
* * `max_depth` the maximum number of nesting this node type can have. A value of `1` would mean that the node can have children, but no grandchildren. Do not specify or set to `-1` for unlimited.
* * `valid_children` an array of node type strings, that nodes of this type can have as children. Do not specify or set to `-1` for no limits.
* * `icon` a string - can be a path to an icon or a className, if using an image that is in the current directory use a `./` prefix, otherwise it will be detected as a class. Omit to use the default icon from your theme.
*
* There are two predefined types:
*
* * `#` represents the root of the tree, for example `max_children` would control the maximum number of root nodes.
* * `default` represents the default node - any settings here will be applied to all nodes that do not have a type specified.
*
* @name $.jstree.defaults.types
* @plugin types
*/
$.jstree.defaults.types = {
'#' : {},
'default' : {}
};
$.jstree.plugins.types = function (options, parent) {
this.init = function (el, options) {
var i, j;
if(options && options.types && options.types['default']) {
for(i in options.types) {
if(i !== "default" && i !== "#" && options.types.hasOwnProperty(i)) {
for(j in options.types['default']) {
if(options.types['default'].hasOwnProperty(j) && options.types[i][j] === undefined) {
options.types[i][j] = options.types['default'][j];
}
}
}
}
}
parent.init.call(this, el, options);
this._model.data['#'].type = '#';
};
this.bind = function () {
parent.bind.call(this);
this.element
.on('model.jstree', $.proxy(function (e, data) {
var m = this._model.data,
dpc = data.nodes,
t = this.settings.types,
i, j, c = 'default';
for(i = 0, j = dpc.length; i < j; i++) {
c = 'default';
if(m[dpc[i]].original && m[dpc[i]].original.type && t[m[dpc[i]].original.type]) {
c = m[dpc[i]].original.type;
}
if(m[dpc[i]].data && m[dpc[i]].data.jstree && m[dpc[i]].data.jstree.type && t[m[dpc[i]].data.jstree.type]) {
c = m[dpc[i]].data.jstree.type;
}
m[dpc[i]].type = c;
if(m[dpc[i]].icon === true && t[c].icon !== undefined) {
m[dpc[i]].icon = t[c].icon;
}
}
}, this));
};
this.get_json = function (obj, options, flat) {
var i, j,
m = this._model.data,
opt = options ? $.extend(true, {}, options, {no_id:false}) : {},
tmp = parent.get_json.call(this, obj, opt, flat);
if(tmp === false) { return false; }
if($.isArray(tmp)) {
for(i = 0, j = tmp.length; i < j; i++) {
tmp[i].type = tmp[i].id && m[tmp[i].id] && m[tmp[i].id].type ? m[tmp[i].id].type : "default";
if(options && options.no_id) {
delete tmp[i].id;
if(tmp[i].li_attr && tmp[i].li_attr.id) {
delete tmp[i].li_attr.id;
}
}
}
}
else {
tmp.type = tmp.id && m[tmp.id] && m[tmp.id].type ? m[tmp.id].type : "default";
if(options && options.no_id) {
tmp = this._delete_ids(tmp);
}
}
return tmp;
};
this._delete_ids = function (tmp) {
if($.isArray(tmp)) {
for(var i = 0, j = tmp.length; i < j; i++) {
tmp[i] = this._delete_ids(tmp[i]);
}
return tmp;
}
delete tmp.id;
if(tmp.li_attr && tmp.li_attr.id) {
delete tmp.li_attr.id;
}
if(tmp.children && $.isArray(tmp.children)) {
tmp.children = this._delete_ids(tmp.children);
}
return tmp;
};
this.check = function (chk, obj, par, pos) {
if(parent.check.call(this, chk, obj, par, pos) === false) { return false; }
obj = obj && obj.id ? obj : this.get_node(obj);
par = par && par.id ? par : this.get_node(par);
var m = obj && obj.id ? $.jstree.reference(obj.id) : null, tmp, d, i, j;
m = m && m._model && m._model.data ? m._model.data : null;
switch(chk) {
case "create_node":
case "move_node":
case "copy_node":
if(chk !== 'move_node' || $.inArray(obj.id, par.children) === -1) {
tmp = this.get_rules(par);
if(tmp.max_children !== undefined && tmp.max_children !== -1 && tmp.max_children === par.children.length) {
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_01', 'reason' : 'max_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
return false;
}
if(tmp.valid_children !== undefined && tmp.valid_children !== -1 && $.inArray(obj.type, tmp.valid_children) === -1) {
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_02', 'reason' : 'valid_children prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
return false;
}
if(m && obj.children_d && obj.parents) {
d = 0;
for(i = 0, j = obj.children_d.length; i < j; i++) {
d = Math.max(d, m[obj.children_d[i]].parents.length);
}
d = d - obj.parents.length + 1;
}
if(d <= 0 || d === undefined) { d = 1; }
do {
if(tmp.max_depth !== undefined && tmp.max_depth !== -1 && tmp.max_depth < d) {
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'types', 'id' : 'types_03', 'reason' : 'max_depth prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
return false;
}
par = this.get_node(par.parent);
tmp = this.get_rules(par);
d++;
} while(par);
}
break;
}
return true;
};
/**
* used to retrieve the type settings object for a node
* @name get_rules(obj)
* @param {mixed} obj the node to find the rules for
* @return {Object}
* @plugin types
*/
this.get_rules = function (obj) {
obj = this.get_node(obj);
if(!obj) { return false; }
var tmp = this.get_type(obj, true);
if(tmp.max_depth === undefined) { tmp.max_depth = -1; }
if(tmp.max_children === undefined) { tmp.max_children = -1; }
if(tmp.valid_children === undefined) { tmp.valid_children = -1; }
return tmp;
};
/**
* used to retrieve the type string or settings object for a node
* @name get_type(obj [, rules])
* @param {mixed} obj the node to find the rules for
* @param {Boolean} rules if set to `true` instead of a string the settings object will be returned
* @return {String|Object}
* @plugin types
*/
this.get_type = function (obj, rules) {
obj = this.get_node(obj);
return (!obj) ? false : ( rules ? $.extend({ 'type' : obj.type }, this.settings.types[obj.type]) : obj.type);
};
/**
* used to change a node's type
* @name set_type(obj, type)
* @param {mixed} obj the node to change
* @param {String} type the new type
* @plugin types
*/
this.set_type = function (obj, type) {
var t, t1, t2, old_type, old_icon;
if($.isArray(obj)) {
obj = obj.slice();
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
this.set_type(obj[t1], type);
}
return true;
}
t = this.settings.types;
obj = this.get_node(obj);
if(!t[type] || !obj) { return false; }
old_type = obj.type;
old_icon = this.get_icon(obj);
obj.type = type;
if(old_icon === true || (t[old_type] && t[old_type].icon && old_icon === t[old_type].icon)) {
this.set_icon(obj, t[type].icon !== undefined ? t[type].icon : true);
}
return true;
};
};
// include the types plugin by default
// $.jstree.defaults.plugins.push("types");
}));

View File

@@ -0,0 +1,58 @@
/**
* ### Unique plugin
*
* Enforces that no nodes with the same name can coexist as siblings.
*/
/*globals jQuery, define, exports, require */
(function (factory) {
"use strict";
if (typeof define === 'function' && define.amd) {
define('jstree.unique', ['jquery','jstree'], factory);
}
else if(typeof exports === 'object') {
factory(require('jquery'), require('jstree'));
}
else {
factory(jQuery, jQuery.jstree);
}
}(function ($, jstree, undefined) {
"use strict";
if($.jstree.plugins.unique) { return; }
$.jstree.plugins.unique = function (options, parent) {
this.check = function (chk, obj, par, pos) {
if(parent.check.call(this, chk, obj, par, pos) === false) { return false; }
obj = obj && obj.id ? obj : this.get_node(obj);
par = par && par.id ? par : this.get_node(par);
if(!par || !par.children) { return true; }
var n = chk === "rename_node" ? pos : obj.text,
c = [],
m = this._model.data, i, j;
for(i = 0, j = par.children.length; i < j; i++) {
c.push(m[par.children[i]].text);
}
switch(chk) {
case "delete_node":
return true;
case "rename_node":
case "copy_node":
i = ($.inArray(n, c) === -1);
if(!i) {
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_01', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
}
return i;
case "move_node":
i = (obj.parent === par.id || $.inArray(n, c) === -1);
if(!i) {
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_01', 'reason' : 'Child with name ' + n + ' already exists. Preventing: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
}
return i;
}
return true;
};
};
// include the unique plugin by default
// $.jstree.defaults.plugins.push("unique");
}));

View File

@@ -0,0 +1,102 @@
/**
* ### Wholerow plugin
*
* Makes each node appear block level. Making selection easier. May cause slow down for large trees in old browsers.
*/
/*globals jQuery, define, exports, require */
(function (factory) {
"use strict";
if (typeof define === 'function' && define.amd) {
define('jstree.wholerow', ['jquery','jstree'], factory);
}
else if(typeof exports === 'object') {
factory(require('jquery'), require('jstree'));
}
else {
factory(jQuery, jQuery.jstree);
}
}(function ($, jstree, undefined) {
"use strict";
if($.jstree.plugins.wholerow) { return; }
var div = document.createElement('DIV');
div.setAttribute('unselectable','on');
div.className = 'jstree-wholerow';
div.innerHTML = '&#160;';
$.jstree.plugins.wholerow = function (options, parent) {
this.bind = function () {
parent.bind.call(this);
this.element
.on('loading', $.proxy(function () {
div.style.height = this._data.core.li_height + 'px';
}, this))
.on('ready.jstree set_state.jstree', $.proxy(function () {
this.hide_dots();
}, this))
.on("ready.jstree", $.proxy(function () {
this.get_container_ul().addClass('jstree-wholerow-ul');
}, this))
.on("deselect_all.jstree", $.proxy(function (e, data) {
this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked');
}, this))
.on("changed.jstree", $.proxy(function (e, data) {
this.element.find('.jstree-wholerow-clicked').removeClass('jstree-wholerow-clicked');
var tmp = false, i, j;
for(i = 0, j = data.selected.length; i < j; i++) {
tmp = this.get_node(data.selected[i], true);
if(tmp && tmp.length) {
tmp.children('.jstree-wholerow').addClass('jstree-wholerow-clicked');
}
}
}, this))
.on("open_node.jstree", $.proxy(function (e, data) {
this.get_node(data.node, true).find('.jstree-clicked').parent().children('.jstree-wholerow').addClass('jstree-wholerow-clicked');
}, this))
.on("hover_node.jstree dehover_node.jstree", $.proxy(function (e, data) {
this.get_node(data.node, true).children('.jstree-wholerow')[e.type === "hover_node"?"addClass":"removeClass"]('jstree-wholerow-hovered');
}, this))
.on("contextmenu.jstree", ".jstree-wholerow", $.proxy(function (e) {
e.preventDefault();
$(e.currentTarget).closest("li").children("a:eq(0)").trigger('contextmenu',e);
}, this))
.on("click.jstree", ".jstree-wholerow", function (e) {
e.stopImmediatePropagation();
var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey });
$(e.currentTarget).closest("li").children("a:eq(0)").trigger(tmp).focus();
})
.on("click.jstree", ".jstree-leaf > .jstree-ocl", $.proxy(function (e) {
e.stopImmediatePropagation();
var tmp = $.Event('click', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey });
$(e.currentTarget).closest("li").children("a:eq(0)").trigger(tmp).focus();
}, this))
.on("mouseover.jstree", ".jstree-wholerow, .jstree-icon", $.proxy(function (e) {
e.stopImmediatePropagation();
this.hover_node(e.currentTarget);
return false;
}, this))
.on("mouseleave.jstree", ".jstree-node", $.proxy(function (e) {
this.dehover_node(e.currentTarget);
}, this));
};
this.teardown = function () {
if(this.settings.wholerow) {
this.element.find(".jstree-wholerow").remove();
}
parent.teardown.call(this);
};
this.redraw_node = function(obj, deep, callback) {
obj = parent.redraw_node.call(this, obj, deep, callback);
if(obj) {
var tmp = div.cloneNode(true);
//tmp.style.height = this._data.core.li_height + 'px';
if($.inArray(obj.id, this._data.core.selected) !== -1) { tmp.className += ' jstree-wholerow-clicked'; }
obj.insertBefore(tmp, obj.childNodes[0]);
}
return obj;
};
};
// include the wholerow plugin by default
// $.jstree.defaults.plugins.push("wholerow");
}));

View File

@@ -0,0 +1,43 @@
/* global jQuery */
// disable all events
(function ($, undefined) {
"use strict";
$.jstree.plugins.trigger = function (options, parent) {
this.init = function (el, options) {
// do not forget parent
parent.init.call(this, el, options);
this._data.trigger.disabled = false;
};
this.trigger = function (ev, data) {
if(!this._data.trigger.disabled) {
parent.trigger.call(this, ev, data);
}
};
this.disable_events = function () { this._data.trigger.disabled = true; };
this.enable_events = function () { this._data.trigger.disabled = false; };
};
})(jQuery);
// no hover
(function ($, undefined) {
"use strict";
$.jstree.plugins.nohover = function () {
this.hover_node = $.noop;
};
})(jQuery);
// conditional select
(function ($, undefined) {
"use strict";
$.jstree.defaults.conditionalselect = function () { return true; };
$.jstree.plugins.conditionalselect = function (options, parent) {
// own function
this.select_node = function (obj, supress_event, prevent_open) {
if(this.settings.conditionalselect.call(this, this.get_node(obj))) {
parent.select_node.call(this, obj, supress_event, prevent_open);
}
};
};
})(jQuery);

View File

@@ -0,0 +1 @@
}));

View File

@@ -0,0 +1,93 @@
/*global jQuery */
// wrap in IIFE and pass jQuery as $
(function ($, undefined) {
"use strict";
// some private plugin stuff if needed
var private_var = null;
// extending the defaults
$.jstree.defaults.sample = {
sample_option : 'sample_val'
};
// the actual plugin code
$.jstree.plugins.sample = function (options, parent) {
// own function
this.sample_function = function (arg) {
// you can chain this method if needed and available
if(parent.sample_function) { parent.sample_function.call(this, arg); }
};
// *SPECIAL* FUNCTIONS
this.init = function (el, options) {
// do not forget parent
parent.init.call(this, el, options);
};
// bind events if needed
this.bind = function () {
// call parent function first
parent.bind.call(this);
// do(stuff);
};
// unbind events if needed (all in jquery namespace are taken care of by the core)
this.unbind = function () {
// do(stuff);
// call parent function last
parent.unbind.call(this);
};
this.teardown = function () {
// do not forget parent
parent.teardown.call(this);
};
// state management - get and restore
this.get_state = function () {
// always get state from parent first
var state = parent.get_state.call(this);
// add own stuff to state
state.sample = { 'var' : 'val' };
return state;
};
this.set_state = function (state, callback) {
// only process your part if parent returns true
// there will be multiple times with false
if(parent.set_state.call(this, state, callback)) {
// check the key you set above
if(state.sample) {
// do(stuff); // like calling this.sample_function(state.sample.var);
// remove your part of the state, call again and RETURN FALSE, the next cycle will be TRUE
delete state.sample;
this.set_state(state, callback);
return false;
}
// return true if your state is gone (cleared in the previous step)
return true;
}
// parent was false - return false too
return false;
};
// node transportation
this.get_json = function (obj, options, flat) {
// get the node from the parent
var tmp = parent.get_json.call(this, obj, options, flat), i, j;
if($.isArray(tmp)) {
for(i = 0, j = tmp.length; i < j; i++) {
tmp[i].sample = 'value';
}
}
else {
tmp.sample = 'value';
}
// return the original / modified node
return tmp;
};
};
// attach to document ready if needed
$(function () {
// do(stuff);
});
// you can include the sample plugin in all instances by default
$.jstree.defaults.plugins.push("sample");
})(jQuery);

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -0,0 +1,85 @@
// base jstree
.jstree-node, .jstree-children, .jstree-container-ul { display:block; margin:0; padding:0; list-style-type:none; list-style-image:none; }
.jstree-node { white-space:nowrap; }
.jstree-anchor { display:inline-block; color:black; white-space:nowrap; padding:0 4px 0 1px; margin:0; vertical-align:top; }
.jstree-anchor:focus { outline:0; }
.jstree-anchor, .jstree-anchor:link, .jstree-anchor:visited, .jstree-anchor:hover, .jstree-anchor:active { text-decoration:none; color:inherit; }
.jstree-icon { display:inline-block; text-decoration:none; margin:0; padding:0; vertical-align:top; text-align:center; }
.jstree-icon:empty { display:inline-block; text-decoration:none; margin:0; padding:0; vertical-align:top; text-align:center; }
.jstree-ocl { cursor:pointer; }
.jstree .jstree-open > .jstree-children { display:block; }
.jstree .jstree-closed > .jstree-children,
.jstree .jstree-leaf > .jstree-children { display:none; }
.jstree-anchor > .jstree-themeicon { margin-right:2px; }
.jstree-no-icons .jstree-themeicon,
.jstree-anchor > .jstree-themeicon-hidden { display:none; }
// base jstree rtl
.jstree-rtl {
.jstree-anchor { padding:0 1px 0 4px; }
.jstree-anchor > .jstree-themeicon { margin-left:2px; margin-right:0; }
.jstree-node { margin-left:0; }
.jstree-container-ul > .jstree-node { margin-right:0; }
}
// base jstree wholerow
.jstree-wholerow-ul {
position:relative;
display:inline-block;
min-width:100%;
.jstree-anchor, .jstree-icon { position:relative; }
.jstree-wholerow { width:100%; cursor:pointer; position:absolute; left:0; -webkit-user-select:none; -moz-user-select:none; -ms-user-select:none; user-select:none; }
}
// base contextmenu
.vakata-context {
display:none;
&, ul { margin:0; padding:2px; position:absolute; background:#f5f5f5; border:1px solid #979797; -moz-box-shadow:5px 5px 4px -4px #666666; -webkit-box-shadow:2px 2px 2px #999999; box-shadow:2px 2px 2px #999999; }
ul { list-style:none; left:100%; margin-top:-2.7em; margin-left:-4px; }
.vakata-context-right ul { left:auto; right:100%; margin-left:auto; margin-right:-4px; }
li {
list-style:none; display:inline;
> a {
display:block; padding:0 2em 0 2em; text-decoration:none; width:auto; color:black; white-space:nowrap; line-height:2.4em; -moz-text-shadow:1px 1px 0 white; -webkit-text-shadow:1px 1px 0 white; text-shadow:1px 1px 0 white; -moz-border-radius:1px; -webkit-border-radius:1px; border-radius:1px;
&:hover { position:relative; background-color:#e8eff7; -moz-box-shadow:0 0 2px #0a6aa1; -webkit-box-shadow:0 0 2px #0a6aa1; box-shadow:0 0 2px #0a6aa1; }
&.vakata-context-parent { background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw=="); background-position:right center; background-repeat:no-repeat; }
}
> a:focus { outline:0; }
}
.vakata-context-hover > a { position:relative; background-color:#e8eff7; -moz-box-shadow:0 0 2px #0a6aa1; -webkit-box-shadow:0 0 2px #0a6aa1; box-shadow:0 0 2px #0a6aa1; }
.vakata-context-separator > {
a, a:hover { background:white; border:0; border-top:1px solid #e2e3e3; height:1px; min-height:1px; max-height:1px; padding:0; margin:0 0 0 2.4em; border-left:1px solid #e0e0e0; -moz-text-shadow:0 0 0 transparent; -webkit-text-shadow:0 0 0 transparent; text-shadow:0 0 0 transparent; -moz-box-shadow:0 0 0 transparent; -webkit-box-shadow:0 0 0 transparent; box-shadow:0 0 0 transparent; -moz-border-radius:0; -webkit-border-radius:0; border-radius:0; }
}
.vakata-contextmenu-disabled {
a, a:hover { color:silver; background-color:transparent; border:0; box-shadow:0 0 0; }
}
li > a {
> i { text-decoration:none; display:inline-block; width:2.4em; height:2.4em; background:transparent; margin:0 0 0 -2em; vertical-align:top; text-align:center; line-height:2.4em; }
> i:empty { width:2.4em; line-height:2.4em; }
.vakata-contextmenu-sep { display:inline-block; width:1px; height:2.4em; background:white; margin:0 0.5em 0 0; border-left:1px solid #e2e3e3; }
}
.vakata-contextmenu-shortcut { font-size:0.8em; color:silver; opacity:0.5; display:none; }
}
.vakata-context-rtl {
ul { left:auto; right:100%; margin-left:auto; margin-right:-4px; }
li > a.vakata-context-parent { background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7"); background-position:left center; background-repeat:no-repeat; }
.vakata-context-separator > a { margin:0 2.4em 0 0; border-left:0; border-right:1px solid #e2e3e3;}
.vakata-context-left ul { right:auto; left:100%; margin-left:-4px; margin-right:auto; }
li > a {
> i { margin:0 -2em 0 0; }
.vakata-contextmenu-sep { margin:0 0 0 0.5em; border-left-color:white; background:#e2e3e3; }
}
}
// base drag'n'drop
#jstree-marker { position: absolute; top:0; left:0; margin:0; padding:0; border-right:0; border-top:5px solid transparent; border-bottom:5px solid transparent; border-left:5px solid; width:0; height:0; font-size:0; line-height:0; }
#jstree-dnd {
line-height:16px;
margin:0;
padding:4px;
.jstree-icon,
.jstree-copy { display:inline-block; text-decoration:none; margin:0 2px 0 0; padding:0; width:16px; height:16px; }
.jstree-ok { background:green; }
.jstree-er { background:red; }
.jstree-copy { margin:0 2px 0 2px; }
}

View File

@@ -0,0 +1,916 @@
/* jsTree default theme */
.jstree-node,
.jstree-children,
.jstree-container-ul {
display: block;
margin: 0;
padding: 0;
list-style-type: none;
list-style-image: none;
}
.jstree-node {
white-space: nowrap;
}
.jstree-anchor {
display: inline-block;
color: black;
white-space: nowrap;
padding: 0 4px 0 1px;
margin: 0;
vertical-align: top;
}
.jstree-anchor:focus {
outline: 0;
}
.jstree-anchor,
.jstree-anchor:link,
.jstree-anchor:visited,
.jstree-anchor:hover,
.jstree-anchor:active {
text-decoration: none;
color: inherit;
}
.jstree-icon {
display: inline-block;
text-decoration: none;
margin: 0;
padding: 0;
vertical-align: top;
text-align: center;
}
.jstree-icon:empty {
display: inline-block;
text-decoration: none;
margin: 0;
padding: 0;
vertical-align: top;
text-align: center;
}
.jstree-ocl {
cursor: pointer;
}
.jstree .jstree-open > .jstree-children {
display: block;
}
.jstree .jstree-closed > .jstree-children,
.jstree .jstree-leaf > .jstree-children {
display: none;
}
.jstree-anchor > .jstree-themeicon {
margin-right: 2px;
}
.jstree-no-icons .jstree-themeicon,
.jstree-anchor > .jstree-themeicon-hidden {
display: none;
}
.jstree-rtl .jstree-anchor {
padding: 0 1px 0 4px;
}
.jstree-rtl .jstree-anchor > .jstree-themeicon {
margin-left: 2px;
margin-right: 0;
}
.jstree-rtl .jstree-node {
margin-left: 0;
}
.jstree-rtl .jstree-container-ul > .jstree-node {
margin-right: 0;
}
.jstree-wholerow-ul {
position: relative;
display: inline-block;
min-width: 100%;
}
.jstree-wholerow-ul .jstree-anchor,
.jstree-wholerow-ul .jstree-icon {
position: relative;
}
.jstree-wholerow-ul .jstree-wholerow {
width: 100%;
cursor: pointer;
position: absolute;
left: 0;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.vakata-context {
display: none;
}
.vakata-context,
.vakata-context ul {
margin: 0;
padding: 2px;
position: absolute;
background: #f5f5f5;
border: 1px solid #979797;
-moz-box-shadow: 5px 5px 4px -4px #666666;
-webkit-box-shadow: 2px 2px 2px #999999;
box-shadow: 2px 2px 2px #999999;
}
.vakata-context ul {
list-style: none;
left: 100%;
margin-top: -2.7em;
margin-left: -4px;
}
.vakata-context .vakata-context-right ul {
left: auto;
right: 100%;
margin-left: auto;
margin-right: -4px;
}
.vakata-context li {
list-style: none;
display: inline;
}
.vakata-context li > a {
display: block;
padding: 0 2em 0 2em;
text-decoration: none;
width: auto;
color: black;
white-space: nowrap;
line-height: 2.4em;
-moz-text-shadow: 1px 1px 0 white;
-webkit-text-shadow: 1px 1px 0 white;
text-shadow: 1px 1px 0 white;
-moz-border-radius: 1px;
-webkit-border-radius: 1px;
border-radius: 1px;
}
.vakata-context li > a:hover {
position: relative;
background-color: #e8eff7;
-moz-box-shadow: 0 0 2px #0a6aa1;
-webkit-box-shadow: 0 0 2px #0a6aa1;
box-shadow: 0 0 2px #0a6aa1;
}
.vakata-context li > a.vakata-context-parent {
background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==");
background-position: right center;
background-repeat: no-repeat;
}
.vakata-context li > a:focus {
outline: 0;
}
.vakata-context .vakata-context-hover > a {
position: relative;
background-color: #e8eff7;
-moz-box-shadow: 0 0 2px #0a6aa1;
-webkit-box-shadow: 0 0 2px #0a6aa1;
box-shadow: 0 0 2px #0a6aa1;
}
.vakata-context .vakata-context-separator a,
.vakata-context .vakata-context-separator a:hover {
background: white;
border: 0;
border-top: 1px solid #e2e3e3;
height: 1px;
min-height: 1px;
max-height: 1px;
padding: 0;
margin: 0 0 0 2.4em;
border-left: 1px solid #e0e0e0;
-moz-text-shadow: 0 0 0 transparent;
-webkit-text-shadow: 0 0 0 transparent;
text-shadow: 0 0 0 transparent;
-moz-box-shadow: 0 0 0 transparent;
-webkit-box-shadow: 0 0 0 transparent;
box-shadow: 0 0 0 transparent;
-moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
}
.vakata-context .vakata-contextmenu-disabled a,
.vakata-context .vakata-contextmenu-disabled a:hover {
color: silver;
background-color: transparent;
border: 0;
box-shadow: 0 0 0;
}
.vakata-context li > a > i {
text-decoration: none;
display: inline-block;
width: 2.4em;
height: 2.4em;
background: transparent;
margin: 0 0 0 -2em;
vertical-align: top;
text-align: center;
line-height: 2.4em;
}
.vakata-context li > a > i:empty {
width: 2.4em;
line-height: 2.4em;
}
.vakata-context li > a .vakata-contextmenu-sep {
display: inline-block;
width: 1px;
height: 2.4em;
background: white;
margin: 0 0.5em 0 0;
border-left: 1px solid #e2e3e3;
}
.vakata-context .vakata-contextmenu-shortcut {
font-size: 0.8em;
color: silver;
opacity: 0.5;
display: none;
}
.vakata-context-rtl ul {
left: auto;
right: 100%;
margin-left: auto;
margin-right: -4px;
}
.vakata-context-rtl li > a.vakata-context-parent {
background-image: url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7");
background-position: left center;
background-repeat: no-repeat;
}
.vakata-context-rtl .vakata-context-separator > a {
margin: 0 2.4em 0 0;
border-left: 0;
border-right: 1px solid #e2e3e3;
}
.vakata-context-rtl .vakata-context-left ul {
right: auto;
left: 100%;
margin-left: -4px;
margin-right: auto;
}
.vakata-context-rtl li > a > i {
margin: 0 -2em 0 0;
}
.vakata-context-rtl li > a .vakata-contextmenu-sep {
margin: 0 0 0 0.5em;
border-left-color: white;
background: #e2e3e3;
}
#jstree-marker {
position: absolute;
top: 0;
left: 0;
margin: 0;
padding: 0;
border-right: 0;
border-top: 5px solid transparent;
border-bottom: 5px solid transparent;
border-left: 5px solid;
width: 0;
height: 0;
font-size: 0;
line-height: 0;
}
#jstree-dnd {
line-height: 16px;
margin: 0;
padding: 4px;
}
#jstree-dnd .jstree-icon,
#jstree-dnd .jstree-copy {
display: inline-block;
text-decoration: none;
margin: 0 2px 0 0;
padding: 0;
width: 16px;
height: 16px;
}
#jstree-dnd .jstree-ok {
background: green;
}
#jstree-dnd .jstree-er {
background: red;
}
#jstree-dnd .jstree-copy {
margin: 0 2px 0 2px;
}
.jstree-default .jstree-node,
.jstree-default .jstree-icon {
background-repeat: no-repeat;
background-color: transparent;
}
.jstree-default .jstree-anchor,
.jstree-default .jstree-wholerow {
transition: background-color 0.15s, box-shadow 0.15s;
}
.jstree-default .jstree-hovered {
background: #00A2D9;
border-radius: 2px;
box-shadow: inset 0 0 1px #ccc;
}
.jstree-default .jstree-clicked {
background: #00A2D9;
border-radius: 2px;
box-shadow: inset 0 0 1px #999;
}
.jstree-default .jstree-no-icons .jstree-anchor > .jstree-themeicon {
display: none;
}
.jstree-default .jstree-disabled {
background: transparent;
color: #666;
}
.jstree-default .jstree-disabled.jstree-hovered {
background: transparent;
box-shadow: none;
}
.jstree-default .jstree-disabled.jstree-clicked {
background: #efefef;
}
.jstree-default .jstree-disabled > .jstree-icon {
opacity: 0.8;
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale");
/* Firefox 10+ */
filter: gray;
/* IE6-9 */
-webkit-filter: grayscale(100%);
/* Chrome 19+ & Safari 6+ */
}
.jstree-default .jstree-search {
font-style: italic;
color: #8b0000;
font-weight: bold;
}
.jstree-default .jstree-no-checkboxes .jstree-checkbox {
display: none !important;
}
.jstree-default.jstree-checkbox-no-clicked .jstree-clicked {
background: transparent;
box-shadow: none;
}
.jstree-default.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered {
background: #e7f4f9;
}
.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked {
background: transparent;
}
.jstree-default.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered {
background: #e7f4f9;
}
#jstree-dnd.jstree-default .jstree-ok,
#jstree-dnd.jstree-default .jstree-er {
background-image: url("32px.png");
background-repeat: no-repeat;
background-color: transparent;
}
#jstree-dnd.jstree-default i {
background: transparent;
width: 16px;
height: 16px;
}
#jstree-dnd.jstree-default .jstree-ok {
background-position: -9px -71px;
}
#jstree-dnd.jstree-default .jstree-er {
background-position: -39px -71px;
}
.jstree-default > .jstree-striped {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat;
}
.jstree-default > .jstree-wholerow-ul .jstree-hovered,
.jstree-default > .jstree-wholerow-ul .jstree-clicked {
background: transparent;
box-shadow: none;
border-radius: 0;
}
.jstree-default .jstree-wholerow {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.jstree-default .jstree-wholerow-hovered {
background: #e7f4f9;
}
.jstree-default .jstree-wholerow-clicked {
background: #beebff;
background: -moz-linear-gradient(top, #beebff 0%, #a8e4ff 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #beebff), color-stop(100%, #a8e4ff));
background: -webkit-linear-gradient(top, #beebff 0%, #a8e4ff 100%);
background: -o-linear-gradient(top, #beebff 0%, #a8e4ff 100%);
background: -ms-linear-gradient(top, #beebff 0%, #a8e4ff 100%);
background: linear-gradient(to bottom, #beebff 0%, #a8e4ff 100%);
/*filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='@color1', endColorstr='@color2',GradientType=0 );*/
}
.jstree-default .jstree-node {
min-height: 24px;
line-height: 24px;
margin-left: 24px;
min-width: 24px;
}
.jstree-default .jstree-anchor {
line-height: 24px;
height: 24px;
}
.jstree-default .jstree-icon {
width: 24px;
height: 24px;
line-height: 24px;
}
.jstree-default .jstree-icon:empty {
width: 24px;
height: 24px;
line-height: 24px;
}
.jstree-default.jstree-rtl .jstree-node {
margin-right: 24px;
}
.jstree-default .jstree-wholerow {
height: 24px;
}
.jstree-default .jstree-node,
.jstree-default .jstree-icon {
background-image: url("32px.png");
}
.jstree-default .jstree-node {
background-position: -292px -4px;
background-repeat: repeat-y;
}
.jstree-default .jstree-last {
background: transparent;
}
.jstree-default .jstree-open > .jstree-ocl {
background-position: -132px -4px;
}
.jstree-default .jstree-closed > .jstree-ocl {
background-position: -100px -4px;
}
.jstree-default .jstree-leaf > .jstree-ocl {
background-position: -68px -4px;
}
.jstree-default .jstree-anchor > .jstree-themeicon {
background-position: -260px -4px;
}
.jstree-default > .jstree-no-dots .jstree-node,
.jstree-default > .jstree-no-dots .jstree-leaf > .jstree-ocl {
background: transparent;
}
.jstree-default > .jstree-no-dots .jstree-open > .jstree-ocl {
background-position: -36px -4px;
}
.jstree-default > .jstree-no-dots .jstree-closed > .jstree-ocl {
background-position: -4px -4px;
}
.jstree-default .jstree-disabled {
background: transparent;
}
.jstree-default .jstree-disabled.jstree-hovered {
background: transparent;
}
.jstree-default .jstree-disabled.jstree-clicked {
background: #efefef;
}
.jstree-default .jstree-checkbox {
background-position: -164px -4px;
}
.jstree-default .jstree-checkbox:hover {
background-position: -164px -36px;
}
.jstree-default .jstree-clicked > .jstree-checkbox {
background-position: -228px -4px;
}
.jstree-default .jstree-clicked > .jstree-checkbox:hover {
background-position: -228px -36px;
}
.jstree-default .jstree-anchor > .jstree-undetermined {
background-position: -196px -4px;
}
.jstree-default .jstree-anchor > .jstree-undetermined:hover {
background-position: -196px -36px;
}
.jstree-default > .jstree-striped {
background-size: auto 48px;
}
.jstree-default.jstree-rtl .jstree-node {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
background-position: 100% 1px;
background-repeat: repeat-y;
}
.jstree-default.jstree-rtl .jstree-last {
background: transparent;
}
.jstree-default.jstree-rtl .jstree-open > .jstree-ocl {
background-position: -132px -36px;
}
.jstree-default.jstree-rtl .jstree-closed > .jstree-ocl {
background-position: -100px -36px;
}
.jstree-default.jstree-rtl .jstree-leaf > .jstree-ocl {
background-position: -68px -36px;
}
.jstree-default.jstree-rtl > .jstree-no-dots .jstree-node,
.jstree-default.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {
background: transparent;
}
.jstree-default.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {
background-position: -36px -36px;
}
.jstree-default.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {
background-position: -4px -36px;
}
.jstree-default .jstree-themeicon-custom {
background-color: transparent;
background-image: none;
}
.jstree-default > .jstree-container-ul .jstree-loading > .jstree-ocl {
background: url("throbber.gif") center center no-repeat;
}
.jstree-default.jstree-rtl .jstree-node {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
}
.jstree-default.jstree-rtl .jstree-last {
background: transparent;
}
.jstree-default-small .jstree-node {
min-height: 18px;
line-height: 18px;
margin-left: 18px;
min-width: 18px;
}
.jstree-default-small .jstree-anchor {
line-height: 18px;
height: 18px;
}
.jstree-default-small .jstree-icon {
width: 18px;
height: 18px;
line-height: 18px;
}
.jstree-default-small .jstree-icon:empty {
width: 18px;
height: 18px;
line-height: 18px;
}
.jstree-default-small.jstree-rtl .jstree-node {
margin-right: 18px;
}
.jstree-default-small .jstree-wholerow {
height: 18px;
}
.jstree-default-small .jstree-node,
.jstree-default-small .jstree-icon {
background-image: url("32px.png");
}
.jstree-default-small .jstree-node {
background-position: -295px -7px;
background-repeat: repeat-y;
}
.jstree-default-small .jstree-last {
background: transparent;
}
.jstree-default-small .jstree-open > .jstree-ocl {
background-position: -135px -7px;
}
.jstree-default-small .jstree-closed > .jstree-ocl {
background-position: -103px -7px;
}
.jstree-default-small .jstree-leaf > .jstree-ocl {
background-position: -71px -7px;
}
.jstree-default-small .jstree-anchor > .jstree-themeicon {
background-position: -263px -7px;
}
.jstree-default-small > .jstree-no-dots .jstree-node,
.jstree-default-small > .jstree-no-dots .jstree-leaf > .jstree-ocl {
background: transparent;
}
.jstree-default-small > .jstree-no-dots .jstree-open > .jstree-ocl {
background-position: -39px -7px;
}
.jstree-default-small > .jstree-no-dots .jstree-closed > .jstree-ocl {
background-position: -7px -7px;
}
.jstree-default-small .jstree-disabled {
background: transparent;
}
.jstree-default-small .jstree-disabled.jstree-hovered {
background: transparent;
}
.jstree-default-small .jstree-disabled.jstree-clicked {
background: #efefef;
}
.jstree-default-small .jstree-checkbox {
background-position: -167px -7px;
}
.jstree-default-small .jstree-checkbox:hover {
background-position: -167px -39px;
}
.jstree-default-small .jstree-clicked > .jstree-checkbox {
background-position: -231px -7px;
}
.jstree-default-small .jstree-clicked > .jstree-checkbox:hover {
background-position: -231px -39px;
}
.jstree-default-small .jstree-anchor > .jstree-undetermined {
background-position: -199px -7px;
}
.jstree-default-small .jstree-anchor > .jstree-undetermined:hover {
background-position: -199px -39px;
}
.jstree-default-small > .jstree-striped {
background-size: auto 36px;
}
.jstree-default-small.jstree-rtl .jstree-node {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
background-position: 100% 1px;
background-repeat: repeat-y;
}
.jstree-default-small.jstree-rtl .jstree-last {
background: transparent;
}
.jstree-default-small.jstree-rtl .jstree-open > .jstree-ocl {
background-position: -135px -39px;
}
.jstree-default-small.jstree-rtl .jstree-closed > .jstree-ocl {
background-position: -103px -39px;
}
.jstree-default-small.jstree-rtl .jstree-leaf > .jstree-ocl {
background-position: -71px -39px;
}
.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-node,
.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {
background: transparent;
}
.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {
background-position: -39px -39px;
}
.jstree-default-small.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {
background-position: -7px -39px;
}
.jstree-default-small .jstree-themeicon-custom {
background-color: transparent;
background-image: none;
}
.jstree-default-small > .jstree-container-ul .jstree-loading > .jstree-ocl {
background: url("throbber.gif") center center no-repeat;
}
.jstree-default-small.jstree-rtl .jstree-node {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==");
}
.jstree-default-small.jstree-rtl .jstree-last {
background: transparent;
}
.jstree-default-large .jstree-node {
min-height: 32px;
line-height: 32px;
margin-left: 32px;
min-width: 32px;
}
.jstree-default-large .jstree-anchor {
line-height: 32px;
height: 32px;
}
.jstree-default-large .jstree-icon {
width: 32px;
height: 32px;
line-height: 32px;
}
.jstree-default-large .jstree-icon:empty {
width: 32px;
height: 32px;
line-height: 32px;
}
.jstree-default-large.jstree-rtl .jstree-node {
margin-right: 32px;
}
.jstree-default-large .jstree-wholerow {
height: 32px;
}
.jstree-default-large .jstree-node,
.jstree-default-large .jstree-icon {
background-image: url("32px.png");
}
.jstree-default-large .jstree-node {
background-position: -288px 0px;
background-repeat: repeat-y;
}
.jstree-default-large .jstree-last {
background: transparent;
}
.jstree-default-large .jstree-open > .jstree-ocl {
background-position: -128px 0px;
}
.jstree-default-large .jstree-closed > .jstree-ocl {
background-position: -96px 0px;
}
.jstree-default-large .jstree-leaf > .jstree-ocl {
background-position: -64px 0px;
}
.jstree-default-large .jstree-anchor > .jstree-themeicon {
background-position: -256px 0px;
}
.jstree-default-large > .jstree-no-dots .jstree-node,
.jstree-default-large > .jstree-no-dots .jstree-leaf > .jstree-ocl {
background: transparent;
}
.jstree-default-large > .jstree-no-dots .jstree-open > .jstree-ocl {
background-position: -32px 0px;
}
.jstree-default-large > .jstree-no-dots .jstree-closed > .jstree-ocl {
background-position: 0px 0px;
}
.jstree-default-large .jstree-disabled {
background: transparent;
}
.jstree-default-large .jstree-disabled.jstree-hovered {
background: transparent;
}
.jstree-default-large .jstree-disabled.jstree-clicked {
background: #efefef;
}
.jstree-default-large .jstree-checkbox {
background-position: -160px 0px;
}
.jstree-default-large .jstree-checkbox:hover {
background-position: -160px -32px;
}
.jstree-default-large .jstree-clicked > .jstree-checkbox {
background-position: -224px 0px;
}
.jstree-default-large .jstree-clicked > .jstree-checkbox:hover {
background-position: -224px -32px;
}
.jstree-default-large .jstree-anchor > .jstree-undetermined {
background-position: -192px 0px;
}
.jstree-default-large .jstree-anchor > .jstree-undetermined:hover {
background-position: -192px -32px;
}
.jstree-default-large > .jstree-striped {
background-size: auto 64px;
}
.jstree-default-large.jstree-rtl .jstree-node {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");
background-position: 100% 1px;
background-repeat: repeat-y;
}
.jstree-default-large.jstree-rtl .jstree-last {
background: transparent;
}
.jstree-default-large.jstree-rtl .jstree-open > .jstree-ocl {
background-position: -128px -32px;
}
.jstree-default-large.jstree-rtl .jstree-closed > .jstree-ocl {
background-position: -96px -32px;
}
.jstree-default-large.jstree-rtl .jstree-leaf > .jstree-ocl {
background-position: -64px -32px;
}
.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-node,
.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl {
background: transparent;
}
.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl {
background-position: -32px -32px;
}
.jstree-default-large.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl {
background-position: 0px -32px;
}
.jstree-default-large .jstree-themeicon-custom {
background-color: transparent;
background-image: none;
}
.jstree-default-large > .jstree-container-ul .jstree-loading > .jstree-ocl {
background: url("throbber.gif") center center no-repeat;
}
.jstree-default-large.jstree-rtl .jstree-node {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==");
}
.jstree-default-large.jstree-rtl .jstree-last {
background: transparent;
}
@media (max-width: 768px) {
.jstree-default-responsive {
/*
.jstree-open > .jstree-ocl,
.jstree-closed > .jstree-ocl { border-radius:20px; background-color:white; }
*/
}
.jstree-default-responsive .jstree-icon {
background-image: url("40px.png");
}
.jstree-default-responsive .jstree-node,
.jstree-default-responsive .jstree-leaf > .jstree-ocl {
background: transparent;
}
.jstree-default-responsive .jstree-node {
min-height: 40px;
line-height: 40px;
margin-left: 40px;
min-width: 40px;
white-space: nowrap;
}
.jstree-default-responsive .jstree-anchor {
line-height: 40px;
height: 40px;
}
.jstree-default-responsive .jstree-icon,
.jstree-default-responsive .jstree-icon:empty {
width: 40px;
height: 40px;
line-height: 40px;
}
.jstree-default-responsive > .jstree-container-ul > .jstree-node {
margin-left: 0;
}
.jstree-default-responsive.jstree-rtl .jstree-node {
margin-left: 0;
margin-right: 40px;
}
.jstree-default-responsive.jstree-rtl .jstree-container-ul > .jstree-node {
margin-right: 0;
}
.jstree-default-responsive .jstree-ocl,
.jstree-default-responsive .jstree-themeicon,
.jstree-default-responsive .jstree-checkbox {
background-size: 120px 200px;
}
.jstree-default-responsive .jstree-leaf > .jstree-ocl {
background: transparent;
}
.jstree-default-responsive .jstree-open > .jstree-ocl {
background-position: 0 0px !important;
}
.jstree-default-responsive .jstree-closed > .jstree-ocl {
background-position: 0 -40px !important;
}
.jstree-default-responsive.jstree-rtl .jstree-closed > .jstree-ocl {
background-position: -40px 0px !important;
}
.jstree-default-responsive .jstree-anchor > .jstree-themeicon {
background-position: -40px -40px;
}
.jstree-default-responsive .jstree-checkbox,
.jstree-default-responsive .jstree-checkbox:hover {
background-position: -40px -80px;
}
.jstree-default-responsive .jstree-clicked > .jstree-checkbox,
.jstree-default-responsive .jstree-clicked > .jstree-checkbox:hover {
background-position: 0 -80px;
}
.jstree-default-responsive .jstree-anchor > .jstree-undetermined,
.jstree-default-responsive .jstree-anchor > .jstree-undetermined:hover {
background-position: 0 -120px;
}
.jstree-default-responsive .jstree-anchor {
font-weight: bold;
font-size: 1.1em;
text-shadow: 1px 1px white;
}
.jstree-default-responsive > .jstree-striped {
background: transparent;
}
.jstree-default-responsive .jstree-wholerow {
border-top: 1px solid rgba(255, 255, 255, 0.7);
border-bottom: 1px solid rgba(64, 64, 64, 0.2);
background: #ebebeb;
height: 40px;
}
.jstree-default-responsive .jstree-wholerow-hovered {
background: #e7f4f9;
}
.jstree-default-responsive .jstree-wholerow-clicked {
background: #beebff;
}
.jstree-default-responsive .jstree-children .jstree-last > .jstree-wholerow {
box-shadow: inset 0 -6px 3px -5px #666666;
}
.jstree-default-responsive .jstree-children .jstree-open > .jstree-wholerow {
box-shadow: inset 0 6px 3px -5px #666666;
border-top: 0;
}
.jstree-default-responsive .jstree-children .jstree-open + .jstree-open {
box-shadow: none;
}
.jstree-default-responsive .jstree-node,
.jstree-default-responsive .jstree-icon,
.jstree-default-responsive .jstree-node > .jstree-ocl,
.jstree-default-responsive .jstree-themeicon,
.jstree-default-responsive .jstree-checkbox {
background-image: url("40px.png");
background-size: 120px 200px;
}
.jstree-default-responsive .jstree-node {
background-position: -80px 0;
background-repeat: repeat-y;
}
.jstree-default-responsive .jstree-last {
background: transparent;
}
.jstree-default-responsive .jstree-leaf > .jstree-ocl {
background-position: -40px -120px;
}
.jstree-default-responsive .jstree-last > .jstree-ocl {
background-position: -40px -160px;
}
.jstree-default-responsive .jstree-themeicon-custom {
background-color: transparent;
background-image: none;
}
}
.jstree-default > .jstree-container-ul > .jstree-node {
margin-left: 0;
margin-right: 0;
}

View File

@@ -0,0 +1,221 @@
/* jsTree default theme */
@import "base.less";
@clicked-color: #e7f4f9;
.gradient(@color1; @color2) {
background:@color1;
background: -moz-linear-gradient(top, @color1 0%, @color2 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,@color1), color-stop(100%,@color2));
background: -webkit-linear-gradient(top, @color1 0%,@color2 100%);
background: -o-linear-gradient(top, @color1 0%,@color2 100%);
background: -ms-linear-gradient(top, @color1 0%,@color2 100%);
background: linear-gradient(to bottom, @color1 0%,@color2 100%);
/*filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='@color1', endColorstr='@color2',GradientType=0 );*/
}
.jstree-theme (@base-height, @image, @image-height) {
@correction: (@image-height - @base-height) / 2;
.jstree-node { min-height:@base-height; line-height:@base-height; margin-left:@base-height; min-width:@base-height; }
.jstree-anchor { line-height:@base-height; height:@base-height; }
.jstree-icon { width:@base-height; height:@base-height; line-height:@base-height; }
.jstree-icon:empty { width:@base-height; height:@base-height; line-height:@base-height; }
&.jstree-rtl .jstree-node { margin-right:@base-height; }
.jstree-wholerow { height:@base-height; }
.jstree-node,
.jstree-icon { background-image:url("@{image}"); }
.jstree-node { background-position:-(@image-height * 9 + @correction) -@correction; background-repeat:repeat-y; }
.jstree-last { background:transparent; }
.jstree-open > .jstree-ocl { background-position:-(@image-height * 4 + @correction) -@correction; }
.jstree-closed > .jstree-ocl { background-position:-(@image-height * 3 + @correction) -@correction; }
.jstree-leaf > .jstree-ocl { background-position:-(@image-height * 2 + @correction) -@correction; }
.jstree-anchor > .jstree-themeicon { background-position:-(@image-height * 8 + @correction) -@correction; }
> .jstree-no-dots {
.jstree-node,
.jstree-leaf > .jstree-ocl { background:transparent; }
.jstree-open > .jstree-ocl { background-position:-(@image-height * 1 + @correction) -@correction; }
.jstree-closed > .jstree-ocl { background-position:-@correction -@correction; }
}
.jstree-disabled {
background:transparent;
&.jstree-hovered {
background:transparent;
}
&.jstree-clicked {
background:#efefef;
}
}
.jstree-checkbox {
background-position:-(@image-height * 5 + @correction) -@correction;
&:hover { background-position:-(@image-height * 5 + @correction) -(@image-height * 1 + @correction); }
}
.jstree-clicked {
> .jstree-checkbox {
background-position:-(@image-height * 7 + @correction) -@correction;
&:hover { background-position:-(@image-height * 7 + @correction) -(@image-height * 1 + @correction); }
}
}
.jstree-anchor {
> .jstree-undetermined {
background-position:-(@image-height * 6 + @correction) -@correction;
&:hover {
background-position:-(@image-height * 6 + @correction) -(@image-height * 1 + @correction);
}
}
}
> .jstree-striped { background-size:auto (@base-height * 2); }
&.jstree-rtl {
.jstree-node { background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); background-position: 100% 1px; background-repeat:repeat-y; }
.jstree-last { background:transparent; }
.jstree-open > .jstree-ocl { background-position:-(@image-height * 4 + @correction) -(@image-height * 1 + @correction); }
.jstree-closed > .jstree-ocl { background-position:-(@image-height * 3 + @correction) -(@image-height * 1 + @correction); }
.jstree-leaf > .jstree-ocl { background-position:-(@image-height * 2 + @correction) -(@image-height * 1 + @correction); }
> .jstree-no-dots {
.jstree-node,
.jstree-leaf > .jstree-ocl { background:transparent; }
.jstree-open > .jstree-ocl { background-position:-(@image-height * 1 + @correction) -(@image-height * 1 + @correction); }
.jstree-closed > .jstree-ocl { background-position:-@correction -(@image-height * 1 + @correction); }
}
}
.jstree-themeicon-custom { background-color:transparent; background-image:none; }
> .jstree-container-ul .jstree-loading > .jstree-ocl { background:url("throbber.gif") center center no-repeat; }
}
.jstree-default {
.jstree-node,
.jstree-icon { background-repeat:no-repeat; background-color:transparent; }
.jstree-anchor,
.jstree-wholerow { transition:background-color 0.15s, box-shadow 0.15s; }
.jstree-hovered { background:@clicked-color; border-radius:2px; box-shadow:inset 0 0 1px #ccc; }
.jstree-clicked { background:#beebff; border-radius:2px; box-shadow:inset 0 0 1px #999; }
.jstree-no-icons .jstree-anchor > .jstree-themeicon { display:none; }
.jstree-disabled {
background:transparent; color:#666;
&.jstree-hovered { background:transparent; box-shadow:none; }
&.jstree-clicked { background:#efefef; }
> .jstree-icon { opacity:0.8; filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'jstree-grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#jstree-grayscale"); /* Firefox 10+ */ filter: gray; /* IE6-9 */ -webkit-filter: grayscale(100%); /* Chrome 19+ & Safari 6+ */ }
}
// search
.jstree-search { font-style:italic; color:#8b0000; font-weight:bold; }
// checkboxes
.jstree-no-checkboxes .jstree-checkbox { display:none !important; }
&.jstree-checkbox-no-clicked {
.jstree-clicked {
background:transparent;
box-shadow:none;
&.jstree-hovered { background:@clicked-color; }
}
> .jstree-wholerow-ul .jstree-wholerow-clicked {
background:transparent;
&.jstree-wholerow-hovered { background:@clicked-color; }
}
}
// drag'n'drop
#jstree-dnd& {
.jstree-ok,
.jstree-er { background-image:url("32px.png"); background-repeat:no-repeat; background-color:transparent; }
i { background:transparent; width:16px; height:16px; }
.jstree-ok { background-position: -9px -71px; }
.jstree-er { background-position: -39px -71px; }
}
// stripes
> .jstree-striped { background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat; }
// wholerow
> .jstree-wholerow-ul .jstree-hovered,
> .jstree-wholerow-ul .jstree-clicked { background:transparent; box-shadow:none; border-radius:0; }
.jstree-wholerow { -moz-box-sizing:border-box; -webkit-box-sizing:border-box; box-sizing:border-box; }
.jstree-wholerow-hovered { background:@clicked-color; }
.jstree-wholerow-clicked { .gradient(#beebff, #a8e4ff); }
}
// theme variants
.jstree-default {
.jstree-theme(24px, "32px.png", 32px);
&.jstree-rtl .jstree-node { background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg=="); }
&.jstree-rtl .jstree-last { background:transparent; }
}
.jstree-default-small {
.jstree-theme(18px, "32px.png", 32px);
&.jstree-rtl .jstree-node { background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg=="); }
&.jstree-rtl .jstree-last { background:transparent; }
}
.jstree-default-large {
.jstree-theme(32px, "32px.png", 32px);
&.jstree-rtl .jstree-node { background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg=="); }
&.jstree-rtl .jstree-last { background:transparent; }
}
// mobile theme attempt
.jstree-default-responsive {
@base-height: 40px;
@media (max-width: 768px) {
// background image
.jstree-icon { background-image:url("@{base-height}.png"); }
.jstree-node,
.jstree-leaf > .jstree-ocl { background:transparent; }
.jstree-node { min-height:@base-height; line-height:@base-height; margin-left:@base-height; min-width:@base-height; white-space:nowrap; }
.jstree-anchor { line-height:@base-height; height:@base-height; }
.jstree-icon, .jstree-icon:empty { width:@base-height; height:@base-height; line-height:@base-height; }
> .jstree-container-ul > .jstree-node { margin-left:0; }
&.jstree-rtl .jstree-node { margin-left:0; margin-right:@base-height; }
&.jstree-rtl .jstree-container-ul > .jstree-node { margin-right:0; }
.jstree-ocl,
.jstree-themeicon,
.jstree-checkbox { background-size:(@base-height * 3) (@base-height * 5); }
.jstree-leaf > .jstree-ocl { background:transparent; }
.jstree-open > .jstree-ocl { background-position:0 0px !important; }
.jstree-closed > .jstree-ocl { background-position:0 -(@base-height * 1) !important; }
&.jstree-rtl .jstree-closed > .jstree-ocl { background-position:-(@base-height * 1) 0px !important; }
.jstree-anchor > .jstree-themeicon { background-position:-(@base-height * 1) -(@base-height * 1); }
.jstree-checkbox, .jstree-checkbox:hover { background-position:-(@base-height * 1) -(@base-height * 2); }
.jstree-clicked > .jstree-checkbox, .jstree-clicked > .jstree-checkbox:hover { background-position:0 -(@base-height * 2); }
.jstree-anchor > .jstree-undetermined, .jstree-anchor > .jstree-undetermined:hover { background-position:0 -(@base-height * 3); }
.jstree-anchor { font-weight:bold; font-size:1.1em; text-shadow:1px 1px white; }
> .jstree-striped { background:transparent; }
.jstree-wholerow { border-top:1px solid rgba(255,255,255,0.7); border-bottom:1px solid rgba(64,64,64,0.2); background:#ebebeb; height:@base-height; }
.jstree-wholerow-hovered { background:@clicked-color; }
.jstree-wholerow-clicked { background:#beebff; }
// thanks to PHOTONUI
.jstree-children .jstree-last > .jstree-wholerow { box-shadow: inset 0 -6px 3px -5px #666; }
.jstree-children .jstree-open > .jstree-wholerow { box-shadow: inset 0 6px 3px -5px #666; border-top:0; }
.jstree-children .jstree-open + .jstree-open { box-shadow:none; }
// experiment
.jstree-node,
.jstree-icon,
.jstree-node > .jstree-ocl,
.jstree-themeicon,
.jstree-checkbox { background-image:url("@{base-height}.png"); background-size:(@base-height * 3) (@base-height * 5); }
.jstree-node { background-position:-(@base-height * 2) 0; background-repeat:repeat-y; }
.jstree-last { background:transparent; }
.jstree-leaf > .jstree-ocl { background-position:-(@base-height * 1) -(@base-height * 3); }
.jstree-last > .jstree-ocl { background-position:-(@base-height * 1) -(@base-height * 4); }
/*
.jstree-open > .jstree-ocl,
.jstree-closed > .jstree-ocl { border-radius:20px; background-color:white; }
*/
.jstree-themeicon-custom { background-color:transparent; background-image:none; }
}
}
.jstree-default > .jstree-container-ul > .jstree-node { margin-left:0; margin-right:0; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB