mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #2967 from hanc2006/master
Fixed remove item when depth=0 and wrong gutter calc treeList widget
This commit is contained in:
commit
08e73d9d7d
@ -312,7 +312,7 @@
|
||||
}
|
||||
if (child.depth !== parent.depth+1) {
|
||||
child.depth = parent.depth+1;
|
||||
var labelPaddingWidth = ((child.gutter?child.gutter.width()+2:0)+(child.depth*20));
|
||||
var labelPaddingWidth = ((child.gutter ? child.gutter[0].offsetWidth + 2 : 0) + (child.depth * 20));
|
||||
child.treeList.labelPadding.width(labelPaddingWidth+'px');
|
||||
if (child.element) {
|
||||
$(child.element).css({
|
||||
@ -348,6 +348,16 @@
|
||||
that._selected.delete(item);
|
||||
delete item.treeList;
|
||||
delete that._items[item.id];
|
||||
if(item.depth === 0) {
|
||||
for(var key in that._items) {
|
||||
var child = that._items[key];
|
||||
if(child.parent && child.parent.id === item.id) {
|
||||
delete that._items[key].treeList;
|
||||
delete that._items[key];
|
||||
}
|
||||
}
|
||||
that._data = that._data.filter(function(data) { return data.id !== item.id})
|
||||
}
|
||||
}
|
||||
item.treeList.insertChildAt = function(newItem,position,select) {
|
||||
newItem.parent = item;
|
||||
@ -480,7 +490,10 @@
|
||||
if (item.treeList.container) {
|
||||
$(item.element).remove();
|
||||
$(element).appendTo(item.treeList.label);
|
||||
var labelPaddingWidth = (item.gutter?item.gutter.width()+2:0)+(item.depth*20);
|
||||
// using the JQuery Object, the gutter width will
|
||||
// be wrong when the element is reattached the second time
|
||||
var labelPaddingWidth = (item.gutter ? item.gutter[0].offsetWidth + 2 : 0) + (item.depth * 20);
|
||||
|
||||
$(element).css({
|
||||
width: "calc(100% - "+(labelPaddingWidth+20+(item.icon?20:0))+"px)"
|
||||
})
|
||||
@ -516,7 +529,7 @@
|
||||
}).appendTo(label)
|
||||
|
||||
}
|
||||
var labelPaddingWidth = (item.gutter?item.gutter.width()+2:0)+(depth*20);
|
||||
var labelPaddingWidth = (item.gutter ? item.gutter[0].offsetWidth + 2 : 0) + (depth * 20)
|
||||
item.treeList.labelPadding = $('<span>').css({
|
||||
display: "inline-block",
|
||||
width: labelPaddingWidth+'px'
|
||||
|
Loading…
Reference in New Issue
Block a user