mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
Et2Tree: When drag + hover over a leaf, only open it if it actually has children
This commit is contained in:
parent
65f2eba403
commit
73a606f6ba
@ -55,13 +55,18 @@ export class EgwDragDropShoelaceTree extends egwActionObjectInterface{
|
||||
n.classList.remove("draggedOver", "drop-hover");
|
||||
});
|
||||
target.target.classList.add("draggedOver", "drop-hover");
|
||||
this.timeouts[target.target.id] = setTimeout(() =>
|
||||
|
||||
// Open nodes with children after a wait
|
||||
if(target.target.hasAttribute("lazy") || target.target.querySelector(target.target.nodeName))
|
||||
{
|
||||
if(target.target.classList.contains("draggedOver"))
|
||||
this.timeouts[target.target.id] = setTimeout(() =>
|
||||
{
|
||||
(<SlTreeItem>target.target).expanded = true
|
||||
}
|
||||
}, EXPAND_FOLDER_ON_DRAG_DROP_TIMEOUT)
|
||||
if(target.target.classList.contains("draggedOver"))
|
||||
{
|
||||
(<SlTreeItem>target.target).expanded = true
|
||||
}
|
||||
}, EXPAND_FOLDER_ON_DRAG_DROP_TIMEOUT)
|
||||
}
|
||||
}
|
||||
else if(egw_event == EGW_AI_DRAG_OUT)
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ import styles from "./Et2Tree.styles";
|
||||
|
||||
export type TreeItemData = SelectOption & {
|
||||
focused?: boolean;
|
||||
// Has children, but they may not be provided in item
|
||||
// Has children, but they may not be provided in children (lazy loaded)
|
||||
child: Boolean | 1,
|
||||
data?: Object,//{sieve:true,...} or {acl:true} or other
|
||||
//this is coming from SelectOption
|
||||
@ -981,8 +981,10 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement) implements Fin
|
||||
//fallback to try and set icon if everything else failed
|
||||
if (!img) img = selectOption.icon ?? selectOption.im0 ?? selectOption.im1 ?? selectOption.im2;
|
||||
|
||||
// lazy iff "child" is set and "item" is empty or item does not exist in the first place
|
||||
const lazy = (selectOption.item?.length === 0 && selectOption.child) || (selectOption.child && !selectOption.item)
|
||||
// lazy iff "child" is set and "children" is empty or children does not exist in the first place
|
||||
const lazy = typeof selectOption.item !== "undefined" ?
|
||||
(selectOption.item?.length === 0 && selectOption.child) || (selectOption.child && !selectOption.item) :
|
||||
(selectOption.children?.length == 0 && selectOption.child);
|
||||
const value = selectOption.value ?? selectOption.id;
|
||||
if(expandState && this.autoloading && lazy)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user