Bind extra context menu items on TreeExplorerNode interface (#886)

This commit is contained in:
Chenlei Hu
2024-09-19 14:51:07 +09:00
committed by GitHub
parent b6dbe8f07b
commit a57c958058
4 changed files with 46 additions and 40 deletions

View File

@@ -1,3 +1,5 @@
import type { MenuItem } from 'primevue/menuitem'
export interface TreeExplorerNode<T = any> {
key: string
label: string
@@ -28,6 +30,10 @@ export interface TreeExplorerNode<T = any> {
handleClick?: (node: TreeExplorerNode<T>, event: MouseEvent) => void
// Function to handle errors
handleError?: (error: Error) => void
// Extra context menu items
contextMenuItems?:
| MenuItem[]
| ((targetNode: RenderedTreeExplorerNode) => MenuItem[])
}
export interface RenderedTreeExplorerNode<T = any> extends TreeExplorerNode<T> {