UNPKG

v-tree-vue

Version:

A light-weight library for management of hierachical content. Most solutions I found did not offer the depth of flexibility I needed with the tree. I decided to solve my problem and also give back to the Vue community. Feel free to log issues, I will jump

25 lines (20 loc) 744 B
import { TreeViewItem } from "@/businessLogic/contracts/types"; const contextMenuLookUp: {[type: string]: MenuItem[] } = {} export interface MenuItem { label: string, icon?: string, isDisabled?: boolean; command: (item: TreeViewItem) => Promise<void>; } export interface ContextMenuConfiguration { registerMenuItems(type: string, menuItems: MenuItem[]): void; getMenuItems(type: string): MenuItem[]; } export const contextMenuConfig : ContextMenuConfiguration = { registerMenuItems(type: string, menuItems: MenuItem[]) { contextMenuLookUp[type.toString()] = menuItems; }, getMenuItems(type: string): MenuItem[] { return contextMenuLookUp[type.toString()]; } }