2023-01-08 16:59:35 +01:00
|
|
|
// type ContextMenu = (
|
|
|
|
// | {
|
|
|
|
// type: 'group'
|
|
|
|
// key: string
|
|
|
|
// items: ContextMenuItem[]
|
|
|
|
// }
|
|
|
|
// | {
|
|
|
|
// type: 'sub'
|
|
|
|
// key: string
|
|
|
|
// trigger: {
|
|
|
|
// key: string
|
|
|
|
// props: {
|
|
|
|
// disabled: boolean
|
|
|
|
// destructive: boolean
|
|
|
|
// hidden: boolean
|
|
|
|
// }
|
|
|
|
// title: string
|
|
|
|
// icon?: string
|
|
|
|
// }
|
|
|
|
// items: ContextMenuItem[]
|
|
|
|
// }
|
|
|
|
// )[]
|
|
|
|
|
|
|
|
type ContextMenu = (ContextMenuItem | ContextMenuSub)[][]
|
|
|
|
|
|
|
|
type ContextMenuItem = {
|
|
|
|
type: 'item'
|
2022-12-03 01:08:38 +01:00
|
|
|
key: string
|
2023-01-08 16:59:35 +01:00
|
|
|
props: {
|
|
|
|
onSelect: () => void
|
|
|
|
disabled: boolean
|
|
|
|
destructive: boolean
|
|
|
|
hidden: boolean
|
|
|
|
}
|
2022-12-03 01:08:38 +01:00
|
|
|
title: string
|
2023-01-08 16:59:35 +01:00
|
|
|
icon?: string
|
|
|
|
}
|
|
|
|
|
|
|
|
type ContextMenuSub = {
|
|
|
|
type: 'sub'
|
|
|
|
key: string
|
|
|
|
trigger: {
|
|
|
|
key: string
|
|
|
|
props: {
|
|
|
|
disabled: boolean
|
|
|
|
destructive: boolean
|
|
|
|
hidden: boolean
|
|
|
|
}
|
|
|
|
title: string
|
|
|
|
icon?: string
|
|
|
|
}
|
|
|
|
items: Omit<ContextMenuItem, 'type'>[]
|
2022-12-03 01:08:38 +01:00
|
|
|
}
|