Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
vakata committed Jan 16, 2023
1 parent de3d859 commit dc759dd
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 35 deletions.
58 changes: 29 additions & 29 deletions dist/jstree.js
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@
}.bind(this))
.on('focus.jstree', '.jstree-anchor', function (e) {
var tmp = this.get_node(e.currentTarget);
if(tmp && tmp.id) {
if(tmp && (tmp.id !== undefined)) {
this._data.core.focused = tmp.id;
}
this.element.find('.jstree-hovered').not(e.currentTarget).trigger('mouseleave');
Expand Down Expand Up @@ -1041,7 +1041,7 @@
* @return {Object|jQuery}
*/
get_node : function (obj, as_dom) {
if(obj && obj.id) {
if(obj && (obj.id !== undefined)) {
obj = obj.id;
}
if (obj instanceof $ && obj.length && obj[0].id) {
Expand Down Expand Up @@ -1766,7 +1766,7 @@
tmp.state[i] = df[i];
}
}
if(d && d.id) { tmp.id = d.id.toString(); }
if(d && (d.id !== undefined)) { tmp.id = d.id.toString(); }
if(d && d.text) { tmp.text = d.text; }
if(d && d.data && d.data.jstree && d.data.jstree.icon) {
tmp.icon = d.data.jstree.icon;
Expand Down Expand Up @@ -1798,10 +1798,10 @@
}
}
}
if(tmp.li_attr.id && !tmp.id) {
if(tmp.li_attr.id && tmp.id === undefined) {
tmp.id = tmp.li_attr.id.toString();
}
if(!tmp.id) {
if(tmp.id === undefined) {
tmp.id = tid;
}
if(!tmp.li_attr.id) {
Expand Down Expand Up @@ -2286,7 +2286,7 @@
tmp.state[i] = df[i];
}
}
if(d && d.id) { tmp.id = d.id.toString(); }
if(d && (d.id !== undefined)) { tmp.id = d.id.toString(); }
if(d && d.text) { tmp.text = d.text; }
if(d && d.data && d.data.jstree && d.data.jstree.icon) {
tmp.icon = d.data.jstree.icon;
Expand Down Expand Up @@ -2318,10 +2318,10 @@
}
}
}
if(tmp.li_attr.id && !tmp.id) {
if(tmp.li_attr.id && tmp.id === undefined) {
tmp.id = tmp.li_attr.id.toString();
}
if(!tmp.id) {
if(tmp.id === undefined) {
tmp.id = tid;
}
if(!tmp.li_attr.id) {
Expand Down Expand Up @@ -3917,7 +3917,7 @@
break;
}
if(pos > par.children.length) { pos = par.children.length; }
if(!node.id) { node.id = true; }
if(node.id === undefined) { node.id = true; }
if(!this.check("create_node", node, par, pos)) {
this.settings.core.error.call(this, this._data.core.last_error);
return false;
Expand Down Expand Up @@ -4155,7 +4155,7 @@
return true;
}
}
obj = obj && obj.id ? obj : this.get_node(obj);
obj = obj && (obj.id !== undefined) ? obj : this.get_node(obj);

if(!obj || obj.id === $.jstree.root) { return false; }

Expand Down Expand Up @@ -4328,7 +4328,7 @@
return true;
}
}
obj = obj && obj.id ? obj : this.get_node(obj);
obj = obj && (obj.id !== undefined) ? obj : this.get_node(obj);
if(!obj || obj.id === $.jstree.root) { return false; }

old_par = (obj.parent || $.jstree.root).toString();
Expand Down Expand Up @@ -4432,7 +4432,7 @@
var tmp = [], o, t1, t2;
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
o = this.get_node(obj[t1]);
if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); }
if(o && (o.id !== undefined) && o.id !== $.jstree.root) { tmp.push(o); }
}
if(!tmp.length) { return false; }
ccp_node = tmp;
Expand All @@ -4459,7 +4459,7 @@
var tmp = [], o, t1, t2;
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
o = this.get_node(obj[t1]);
if(o && o.id && o.id !== $.jstree.root) { tmp.push(o); }
if(o && (o.id !== undefined) && o.id !== $.jstree.root) { tmp.push(o); }
}
if(!tmp.length) { return false; }
ccp_node = tmp;
Expand Down Expand Up @@ -6836,7 +6836,7 @@
if(this.settings.core.force_text) {
txt = $.vakata.html.escape(txt);
}
if(obj && obj.id && obj.id !== $.jstree.root && (e.which === 1 || e.type === "touchstart" || e.type === "dragstart") &&
if(obj && (obj.id !== undefined) && obj.id !== $.jstree.root && (e.which === 1 || e.type === "touchstart" || e.type === "dragstart") &&
(this.settings.dnd.is_draggable === true || ($.vakata.is_function(this.settings.dnd.is_draggable) && this.settings.dnd.is_draggable.call(this, (mlt > 1 ? this.get_top_selected(true) : [obj]), e)))
) {
drg = { 'jstree' : true, 'origin' : this, 'obj' : this.get_node(obj,true), 'nodes' : mlt > 1 ? this.get_top_selected() : [obj.id] };
Expand Down Expand Up @@ -7639,7 +7639,7 @@
return this.clear_search();
}
inside = this.get_node(inside);
inside = inside && inside.id ? inside.id : null;
inside = inside && (inside.id !== undefined) ? inside.id : null;
str = str.toString();
var s = this.settings.search,
a = s.ajax ? s.ajax : false,
Expand Down Expand Up @@ -8214,7 +8214,7 @@
if(tmp === false) { return false; }
if($.vakata.is_array(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";
tmp[i].type = (tmp[i].id !== undefined) && 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) {
Expand All @@ -8227,7 +8227,7 @@
}
}
else {
tmp.type = tmp.id && m[tmp.id] && m[tmp.id].type ? m[tmp.id].type : "default";
tmp.type = (tmp.id !== undefined) && m[tmp.id] && m[tmp.id].type ? m[tmp.id].type : "default";
if(options && options.no_id) {
tmp = this._delete_ids(tmp);
}
Expand Down Expand Up @@ -8255,9 +8255,9 @@
};
this.check = function (chk, obj, par, pos, more) {
if(parent.check.call(this, chk, obj, par, pos, more) === 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 ? (more && more.origin ? more.origin : $.jstree.reference(obj.id)) : null, tmp, d, i, j;
obj = obj && (obj.id !== undefined) ? obj : this.get_node(obj);
par = par && (par.id !== undefined) ? par : this.get_node(par);
var m = obj && (obj.id !== undefined) ? (more && more.origin ? more.origin : $.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":
Expand All @@ -8266,11 +8266,11 @@
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 }) };
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 !== undefined) ? obj.id : false, 'par' : par && (par.id !== undefined) ? par.id : false }) };
return false;
}
if(tmp.valid_children !== undefined && tmp.valid_children !== -1 && $.inArray((obj.type || 'default'), 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 }) };
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 !== undefined) ? obj.id : false, 'par' : par && (par.id !== undefined) ? par.id : false }) };
return false;
}
if(m && obj.children_d && obj.parents) {
Expand All @@ -8283,7 +8283,7 @@
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 }) };
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 !== undefined) ? obj.id : false, 'par' : par && (par.id !== undefined) ? par.id : false }) };
return false;
}
par = this.get_node(par.parent);
Expand Down Expand Up @@ -8493,8 +8493,8 @@
$.jstree.plugins.unique = function (options, parent) {
this.check = function (chk, obj, par, pos, more) {
if(parent.check.call(this, chk, obj, par, pos, more) === false) { return false; }
obj = obj && obj.id ? obj : this.get_node(obj);
par = par && par.id ? par : this.get_node(par);
obj = obj && (obj.id !== undefined) ? obj : this.get_node(obj);
par = par && (par.id !== undefined) ? par : this.get_node(par);
if(!par || !par.children) { return true; }
var n = chk === "rename_node" ? pos : obj.text,
c = [],
Expand Down Expand Up @@ -8526,25 +8526,25 @@
}
i = ($.inArray(n, c) === -1 || (obj.text && t === 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 }) };
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 !== undefined) ? obj.id : false, 'par' : par && (par.id !== undefined) ? 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 }) };
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 !== undefined) ? obj.id : false, 'par' : par && (par.id !== undefined) ? 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_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 }) };
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 !== undefined) ? obj.id : false, 'par' : par && (par.id !== undefined) ? par.id : false }) };
}
return i;
case "move_node":
i = ( (obj.parent === par.id && (!more || !more.is_multi)) || $.inArray(n, c) === -1);
if(!i) {
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 }) };
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 !== undefined) ? obj.id : false, 'par' : par && (par.id !== undefined) ? par.id : false }) };
}
return i;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/jstree.min.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/jstree.js
Original file line number Diff line number Diff line change
Expand Up @@ -1798,10 +1798,10 @@
}
}
}
if(tmp.li_attr.id && !(tmp.id !== undefined)) {
if(tmp.li_attr.id && tmp.id === undefined) {
tmp.id = tmp.li_attr.id.toString();
}
if(!(tmp.id !== undefined)) {
if(tmp.id === undefined) {
tmp.id = tid;
}
if(!tmp.li_attr.id) {
Expand Down Expand Up @@ -2318,10 +2318,10 @@
}
}
}
if(tmp.li_attr.id && !(tmp.id !== undefined)) {
if(tmp.li_attr.id && tmp.id === undefined) {
tmp.id = tmp.li_attr.id.toString();
}
if(!(tmp.id !== undefined)) {
if(tmp.id === undefined) {
tmp.id = tid;
}
if(!tmp.li_attr.id) {
Expand Down Expand Up @@ -3917,7 +3917,7 @@
break;
}
if(pos > par.children.length) { pos = par.children.length; }
if(!(node.id !== undefined)) { node.id = true; }
if(node.id === undefined) { node.id = true; }
if(!this.check("create_node", node, par, pos)) {
this.settings.core.error.call(this, this._data.core.last_error);
return false;
Expand Down

0 comments on commit dc759dd

Please sign in to comment.