mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-30 11:47:55 +01:00
chore(Dropdown): add Item type
This commit is contained in:
@@ -47,7 +47,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, ref, computed, onMounted } from 'vue'
|
import { defineComponent, ref, computed, onMounted } from 'vue'
|
||||||
import type { PropType } from 'vue'
|
import type { PropType } from 'vue'
|
||||||
import type { RouteLocationRaw } from 'vue-router'
|
|
||||||
import { Menu as HMenu, MenuButton as HMenuButton, MenuItems as HMenuItems, MenuItem as HMenuItem } from '@headlessui/vue'
|
import { Menu as HMenu, MenuButton as HMenuButton, MenuItems as HMenuItems, MenuItem as HMenuItem } from '@headlessui/vue'
|
||||||
import { defu } from 'defu'
|
import { defu } from 'defu'
|
||||||
import { omit } from 'lodash-es'
|
import { omit } from 'lodash-es'
|
||||||
@@ -56,7 +55,7 @@ import UAvatar from '../elements/Avatar.vue'
|
|||||||
import UKbd from '../elements/Kbd.vue'
|
import UKbd from '../elements/Kbd.vue'
|
||||||
import ULinkCustom from '../elements/LinkCustom.vue'
|
import ULinkCustom from '../elements/LinkCustom.vue'
|
||||||
import { usePopper } from '../../composables/usePopper'
|
import { usePopper } from '../../composables/usePopper'
|
||||||
import type { Avatar } from '../../types/avatar'
|
import type { Item } from '../../types/dropdown'
|
||||||
import type { PopperOptions } from '../../types'
|
import type { PopperOptions } from '../../types'
|
||||||
import { useAppConfig } from '#imports'
|
import { useAppConfig } from '#imports'
|
||||||
// TODO: Remove
|
// TODO: Remove
|
||||||
@@ -78,18 +77,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
items: {
|
items: {
|
||||||
type: Array as PropType<{
|
type: Array as PropType<Item[][]>,
|
||||||
to?: string | RouteLocationRaw
|
|
||||||
exact?: boolean
|
|
||||||
label: string
|
|
||||||
slot?: string
|
|
||||||
icon?: string
|
|
||||||
iconClass?: string
|
|
||||||
avatar?: Partial<Avatar>
|
|
||||||
shortcuts?: string[]
|
|
||||||
disabled?: boolean
|
|
||||||
click?: Function
|
|
||||||
}[][]>,
|
|
||||||
default: () => []
|
default: () => []
|
||||||
},
|
},
|
||||||
mode: {
|
mode: {
|
||||||
|
|||||||
15
src/runtime/types/dropdown.d.ts
vendored
Normal file
15
src/runtime/types/dropdown.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import type { RouteLocationRaw } from 'vue-router'
|
||||||
|
import type { Avatar } from './avatar'
|
||||||
|
|
||||||
|
export interface Item {
|
||||||
|
to?: string | RouteLocationRaw
|
||||||
|
exact?: boolean
|
||||||
|
label: string
|
||||||
|
slot?: string
|
||||||
|
icon?: string
|
||||||
|
iconClass?: string
|
||||||
|
avatar?: Partial<Avatar>
|
||||||
|
shortcuts?: string[]
|
||||||
|
disabled?: boolean
|
||||||
|
click?: Function
|
||||||
|
}
|
||||||
1
src/runtime/types/index.d.ts
vendored
1
src/runtime/types/index.d.ts
vendored
@@ -2,6 +2,7 @@ export * from './avatar'
|
|||||||
export * from './button'
|
export * from './button'
|
||||||
export * from './clipboard'
|
export * from './clipboard'
|
||||||
export * from './command-palette'
|
export * from './command-palette'
|
||||||
|
export * from './dropdown'
|
||||||
export * from './notification'
|
export * from './notification'
|
||||||
export * from './popper'
|
export * from './popper'
|
||||||
export * from './vertical-navigation'
|
export * from './vertical-navigation'
|
||||||
|
|||||||
Reference in New Issue
Block a user