More changes related to getting tree to handle actions on its leaves

- Fix action system selection vs tree
This commit is contained in:
nathan 2024-10-07 13:31:28 -06:00
parent f772bf69cd
commit 1c06e6864d
2 changed files with 16 additions and 3 deletions

View File

@ -18,7 +18,7 @@ import {FindActionTarget} from "../etemplate/FindActionTarget";
export const EXPAND_FOLDER_ON_DRAG_DROP_TIMEOUT = 1000
export class EgwDragDropShoelaceTree extends egwActionObjectInterface{
node: SlTreeItem;
id: string;
tree: Et2Tree;

View File

@ -1277,12 +1277,25 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement) implements Fin
if(!action)
{
// NOTE: FLAT object structure under the tree ActionObject to avoid nested selection
action = this.widget_object.addObject(target.id, this.widget_object.iface);
action = this.widget_object.addObject(target.id, this.widget_object.iface)
action.setSelected = (set) =>
{
target.selected = set;
this.widget_object.updateSelectedChildren(action, set);
}
action.getSelected = () => target.selected;
// Required to get dropped accepted, but also re-binds
action.updateActionLinks(this._get_action_links(this.actions));
}
// This is just the action system, which we override
this.widget_object.setAllSelected(false);
// This will affect action system & DOM, but not our internal value
this.widget_object.children.forEach(c =>
{
c.setSelected(false)
})
this.widget_object.iface.stateChangeContext = action;
action.setSelected(true);
return {target: target, action: action};