Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jstree

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jstree - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

2

bower.json
{
"name": "jstree",
"version": "3.0.0",
"version": "3.0.1",
"main" : [

@@ -5,0 +5,0 @@ "./dist/jstree.js",

@@ -5,3 +5,3 @@ {

"description": "jsTree is jquery plugin, that provides interactive trees.",
"version": "3.0.0",
"version": "3.0.1",
"license": "MIT",

@@ -8,0 +8,0 @@ "keywords": [

@@ -132,2 +132,18 @@ /*global module:false, require:false, __dirname:false*/

}
},
replace: {
files: {
src: ['dist/*.js', 'bower.json', 'component.json', 'jstree.jquery.json'],
overwrite: true,
replacements: [
{
from: '{{VERSION}}',
to: "<%= pkg.version %>"
},
{
from: /"version": "[^"]+"/g,
to: "\"version\": \"<%= pkg.version %>\""
},
]
}
}

@@ -144,2 +160,3 @@ });

grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-text-replace');

@@ -185,3 +202,3 @@ grunt.registerMultiTask('amd', 'Clean up AMD', function () {

// Default task.
grunt.registerTask('default', ['jshint:beforeconcat','concat','amd','jshint:afterconcat','copy:libs','uglify','less','imagemin','copy:docs','qunit','dox']);
grunt.registerTask('default', ['jshint:beforeconcat','concat','amd','jshint:afterconcat','copy:libs','uglify','less','imagemin','replace','copy:docs','qunit','dox']);
grunt.registerTask('js', ['concat','amd','uglify']);

@@ -188,0 +205,0 @@ grunt.registerTask('css', ['copy','less']);

@@ -5,3 +5,3 @@ {

"description": "Tree view for jQuery",
"version": "3.0.0",
"version": "3.0.1",
"homepage": "http://jstree.com",

@@ -8,0 +8,0 @@ "keywords": [

@@ -5,3 +5,3 @@ {

"description": "jQuery tree plugin",
"version": "3.0.0",
"version": "3.0.1",
"homepage": "http://jstree.com",

@@ -37,3 +37,4 @@ "author": {

"grunt-contrib-imagemin": "~0.4.0",
"grunt-contrib-qunit": "~v0.3.0"
"grunt-contrib-qunit": "~v0.3.0",
"grunt-text-replace": "~0.3.11"
},

@@ -44,11 +45,13 @@ "dependencies": {

"npmName": "jstree",
"npmFileMap": [{
"basePath": "/dist/",
"files": [
"jstree.min.js",
"themes/**/*.png",
"themes/**/*.gif",
"themes/**/*.min.css"
]
}]
"npmFileMap": [
{
"basePath": "/dist/",
"files": [
"jstree.min.js",
"themes/**/*.png",
"themes/**/*.gif",
"themes/**/*.min.css"
]
}
]
}

@@ -314,3 +314,3 @@ /**

// attempt for server side undetermined state
this.element.find('.jstree-closed').not(':has(ul)')
this.element.find('.jstree-closed').not(':has(.jstree-children)')
.each(function () {

@@ -342,3 +342,3 @@ var tmp = t.get_node(this), tmp2;

if(s && s.length) {
s.children('a').children('.jstree-checkbox').addClass('jstree-undetermined');
s.children('.jstree-anchor').children('.jstree-checkbox').addClass('jstree-undetermined');
}

@@ -351,4 +351,12 @@ }

if(obj) {
var tmp = obj.getElementsByTagName('A')[0];
tmp.insertBefore(_i.cloneNode(false), tmp.childNodes[0]);
var i, j, tmp = null;
for(i = 0, j = obj.childNodes.length; i < j; i++) {
if(obj.childNodes[i] && obj.childNodes[i].className && obj.childNodes[i].className.indexOf("jstree-anchor") !== -1) {
tmp = obj.childNodes[i];
break;
}
}
if(tmp) {
tmp.insertBefore(_i.cloneNode(false), tmp.childNodes[0]);
}
}

@@ -372,3 +380,3 @@ if(!is_callback && this.settings.checkbox.three_state) {

*/
this.show_checkboxes = function () { this._data.core.themes.checkboxes = true; this.element.children("ul").removeClass("jstree-no-checkboxes"); };
this.show_checkboxes = function () { this._data.core.themes.checkboxes = true; this.get_container_ul().removeClass("jstree-no-checkboxes"); };
/**

@@ -379,3 +387,3 @@ * hide the node checkbox icons

*/
this.hide_checkboxes = function () { this._data.core.themes.checkboxes = false; this.element.children("ul").addClass("jstree-no-checkboxes"); };
this.hide_checkboxes = function () { this._data.core.themes.checkboxes = false; this.get_container_ul().addClass("jstree-no-checkboxes"); };
/**

@@ -382,0 +390,0 @@ * toggle the node icons

@@ -237,4 +237,3 @@ /**

if(this.settings.contextmenu.select_node && !this.is_selected(obj)) {
this.deselect_all();
this.select_node(obj, false, false, e);
this.activate_node(obj, e);
}

@@ -241,0 +240,0 @@

@@ -58,3 +58,9 @@ /**

*/
always_copy : false
always_copy : false,
/**
* when dropping a node "inside", this setting indicates the position the node should go to - it can be an integer or a string: "first" (same as 0) or "last", default is `0`
* @name $.jstree.defaults.dnd.inside_pos
* @plugin dnd
*/
inside_pos : 0
};

@@ -105,3 +111,3 @@ // TODO: now check works by checking for each node individually, how about max_children, unique, etc?

rel = false,
l, t, h, p, i, o, ok, t1, t2, op, ps, pr;
l, t, h, p, i, o, ok, t1, t2, op, ps, pr, ip, tm;
// if we are over an instance

@@ -131,3 +137,3 @@ if(ins && ins._data && ins._data.dnd) {

// if we are hovering a tree node
ref = $(data.event.target).closest('a');
ref = $(data.event.target).closest('.jstree-anchor');
if(ref && ref.length && ref.parent().is('.jstree-closed, .jstree-open, .jstree-leaf')) {

@@ -155,6 +161,8 @@ off = ref.offset();

case 'i':
ip = ins.settings.dnd.inside_pos;
tm = ins.get_node(ref.parent());
l = off.left - 2;
t = off.top - 5 + h / 2 + 1;
p = ins.get_node(ref.parent()).id;
i = 0;
p = tm.id;
i = ip === 'first' ? 0 : (ip === 'last' ? tm.children.length : Math.min(ip, tm.children.length));
break;

@@ -193,3 +201,3 @@ case 'a':

}
lastmv = { 'ins' : ins, 'par' : p, 'pos' : i };
lastmv = { 'ins' : ins, 'par' : p, 'pos' : v === 'i' && ip === 'last' && i === 0 && !ins.is_loaded(tm) ? 'last' : i };
marker.css({ 'left' : l + 'px', 'top' : t + 'px' }).show();

@@ -196,0 +204,0 @@ data.helper.find('.jstree-icon:eq(0)').removeClass('jstree-er').addClass('jstree-ok');

@@ -82,24 +82,15 @@ /**

if(r && r.length) {
this._data.search.dom = $();
for(i = 0, j = r.length; i < j; i++) {
s = s.concat(this.get_node(r[i]).parents);
f = this.get_node(r[i], true);
if(f) {
this._data.search.dom = this._data.search.dom.add(f);
}
}
s = $.vakata.array_unique(s);
for(i = 0, j = s.length; i < j; i++) {
if(s[i] === "#") { continue; }
f = this.get_node(s[i], true);
if(f) {
o = o.add(f);
}
}
this._data.search.dom = $(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #')));
this._data.search.dom.children(".jstree-anchor").addClass('jstree-search');
if(this.settings.search.show_only_matches && this._data.search.res.length) {
this.element.find("li").hide().filter('.jstree-last').filter(function() { return this.nextSibling; }).removeClass('jstree-last');
for(i = 0, j = r.length; i < j; i++) {
s = s.concat(this.get_node(r[i]).parents);
}
s = $.vakata.array_remove_item($.vakata.array_unique(s),'#');
o = s.length ? $(this.element[0].querySelectorAll('#' + $.map(s, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #'))) : $();
this.element.find(".jstree-node").hide().filter('.jstree-last').filter(function() { return this.nextSibling; }).removeClass('jstree-last');
o = o.add(this._data.search.dom);
o.parentsUntil(".jstree").addBack().show()
.filter("ul").each(function () { $(this).children("li:visible").eq(-1).addClass("jstree-last"); });
.filter(".jstree-children").each(function () { $(this).children(".jstree-node:visible").eq(-1).addClass("jstree-last"); });
}

@@ -112,5 +103,5 @@ }

if(data.nodes.length) {
$(this).find("li").hide().filter('.jstree-last').filter(function() { return this.nextSibling; }).removeClass('jstree-last');
$(this).find(".jstree-node").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"); });
.filter(".jstree-children").each(function () { $(this).children(".jstree-node:visible").eq(-1).addClass("jstree-last"); });
}

@@ -120,3 +111,3 @@ })

if(data.nodes.length) {
$(this).find("li").css("display","").filter('.jstree-last').filter(function() { return this.nextSibling; }).removeClass('jstree-last');
$(this).find(".jstree-node").css("display","").filter('.jstree-last').filter(function() { return this.nextSibling; }).removeClass('jstree-last');
}

@@ -168,3 +159,3 @@ });

this.search(str, true);
});
}, true);
}, this));

@@ -189,8 +180,3 @@ }

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.dom = $(this.element[0].querySelectorAll('#' + $.map(r, function (v) { return "0123456789".indexOf(v[0]) !== -1 ? '\\3' + v[0] + ' ' + v.substr(1).replace($.jstree.idregex,'\\$&') : v.replace($.jstree.idregex,'\\$&'); }).join(', #')));
this._data.search.res = r;

@@ -197,0 +183,0 @@ this._data.search.dom.children(".jstree-anchor").addClass('jstree-search');

@@ -39,6 +39,17 @@ /**

case "rename_node":
i = ($.inArray(n, c) === -1 || (obj.text && obj.text === n));
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 "create_node":
i = ($.inArray(n, c) === -1);
if(!i) {
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_04', '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 "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 }) };
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_02', '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 }) };
}

@@ -49,3 +60,3 @@ return i;

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 }) };
this._data.core.last_error = { 'error' : 'check', 'plugin' : 'unique', 'id' : 'unique_03', '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 }) };
}

@@ -56,2 +67,30 @@ return i;

};
this.create_node = function (par, node, pos, callback, is_loaded) {
if(!node || node.text === undefined) {
if(par === null) {
par = "#";
}
par = this.get_node(par);
if(!par) {
return parent.create_node.call(this, par, node, pos, callback, is_loaded);
}
pos = pos === undefined ? "last" : pos;
if(!pos.toString().match(/^(before|after)$/) && !is_loaded && !this.is_loaded(par)) {
return parent.create_node.call(this, par, node, pos, callback, is_loaded);
}
if(!node) { node = {}; }
var tmp, n, dpc, i, j, m = this._model.data;
n = tmp = this.get_string('New node');
dpc = [];
for(i = 0, j = par.children.length; i < j; i++) {
dpc.push(m[par.children[i]].text);
}
i = 1;
while($.inArray(n, dpc) !== -1) {
n = tmp + ' (' + (++i) + ')';
}
node.text = n;
}
return parent.create_node.call(this, par, node, pos, callback, is_loaded);
};
};

@@ -58,0 +97,0 @@

@@ -32,9 +32,7 @@ /**

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 () {
.on("init.jstree loading.jstree ready.jstree", $.proxy(function () {
div.style.height = this._data.core.li_height + 'px';
this.get_container_ul().addClass('jstree-wholerow-ul');

@@ -64,3 +62,3 @@ }, this))

var tmp = $.Event('contextmenu', { metaKey : e.metaKey, ctrlKey : e.ctrlKey, altKey : e.altKey, shiftKey : e.shiftKey, pageX : e.pageX, pageY : e.pageY });
$(e.currentTarget).closest("li").children("a:eq(0)").trigger(tmp);
$(e.currentTarget).closest(".jstree-node").children(".jstree-anchor:eq(0)").trigger(tmp);
}, this))

@@ -70,3 +68,3 @@ .on("click.jstree", ".jstree-wholerow", function (e) {

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();
$(e.currentTarget).closest(".jstree-node").children(".jstree-anchor:eq(0)").trigger(tmp).focus();
})

@@ -76,3 +74,3 @@ .on("click.jstree", ".jstree-leaf > .jstree-ocl", $.proxy(function (e) {

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();
$(e.currentTarget).closest(".jstree-node").children(".jstree-anchor:eq(0)").trigger(tmp).focus();
}, this))

@@ -79,0 +77,0 @@ .on("mouseover.jstree", ".jstree-wholerow, .jstree-icon", $.proxy(function (e) {

@@ -68,2 +68,20 @@ /* global jQuery */

// allow search results expanding
(function ($, undefined) {
"use strict";
$.jstree.plugins.show_matches_children = function (options, parent) {
this.bind = function () {
parent.bind.call(this);
this.element
.on('search.jstree before_open.jstree', function (e, data) {
if(data.instance.settings.search && data.instance.settings.search.show_only_matches) {
data.instance._data.search.dom.find('.jstree-node')
.show().filter('.jstree-last').filter(function() { return this.nextSibling; }).removeClass('jstree-last')
.end().end().end().find(".jstree-children").each(function () { $(this).children(".jstree-node:visible").eq(-1).addClass("jstree-last"); });
}
});
};
};
})(jQuery);
// additional icon on node (outside of anchor)

@@ -70,0 +88,0 @@ (function ($, undefined) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc