tooot/src/components/contextMenu/index.d.ts

54 lines
958 B
TypeScript
Raw Normal View History

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-03-10 14:03:10 +01:00
icon?: any
2023-01-08 16:59:35 +01:00
}
type ContextMenuSub = {
type: 'sub'
key: string
trigger: {
key: string
props: {
disabled: boolean
destructive: boolean
hidden: boolean
}
title: string
2023-03-10 14:03:10 +01:00
icon?: any
2023-01-08 16:59:35 +01:00
}
items: Omit<ContextMenuItem, 'type'>[]
2022-12-03 01:08:38 +01:00
}