in desktop/src/@batch-flask/ui/abstract-list/abstract-list-base.ts [456:483]
public openContextMenu(target?: any) {
if (!this.commands && !this.config.sorting) { return; }
let selection = this.selection;
// If we right clicked on an non selected item it will just make this the context menu selection
if (target && !selection.has(target.id)) {
selection = new ListSelection({ keys: [target.id] });
}
let obs;
if (this.commands) {
obs = this.commands.contextMenuFromSelection(selection);
} else {
obs = of(new ContextMenu([]));
}
obs.subscribe((menu) => {
if (!menu) { return; }
if (this.config.sorting) {
if (this.commands) {
menu.addItem(new ContextMenuSeparator());
}
menu.addItem(this._createSortByMenu());
}
this.contextmenuService.openMenu(menu);
});
}