import { injectable } from '@cloudbeaver/core-di' ; import type { IMenuPanel } from '../IMenuPanel' ; import { ContextMenu } from './ContextMenu' ; import type { IContextMenuItem } from './IContextMenuItem' ; import type { IMenuContext } from './IMenuContext' ; @ injectable ( ) export class ContextMenuService { private static rootPanelId = 'contextRoot' ; private contextMenu = new ContextMenu ( ) ; constructor ( ) { this . contextMenu . addRootPanel ( ContextMenuService . rootPanelId ) ; } getRootMenuToken ( ) { return ContextMenuService . rootPanelId ; } addPanel ( panelId ) { this . contextMenu . addRootPanel ( panelId ) ; } addMenuItem < T > ( panelId , menuItem ) { this . contextMenu . addMenuItem ( panelId , menuItem ) ; } createContextMenu < T > ( context , panelId ? ) { return this . contextMenu . constructMenuWithContext ( panelId || ContextMenuService . rootPanelId , context ) ; } }