You've already forked AstralRinth
forked from didirus/AstralRinth
Fix typescript for OverflowMenu (#3139)
* Fix typescript for OverflowMenu * Revert Discover content dropdown change to non-hoverable OverflowMenu * Lint
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
<template #menu>
|
<template #menu>
|
||||||
<template v-for="(option, index) in options.filter((x) => x.shown === undefined || x.shown)">
|
<template v-for="(option, index) in options.filter((x) => x.shown === undefined || x.shown)">
|
||||||
<div
|
<div
|
||||||
v-if="option.divider"
|
v-if="isDivider(option)"
|
||||||
:key="`divider-${index}`"
|
:key="`divider-${index}`"
|
||||||
class="h-px mx-3 my-2 bg-button-bg"
|
class="h-px mx-3 my-2 bg-button-bg"
|
||||||
></div>
|
></div>
|
||||||
@@ -25,15 +25,15 @@
|
|||||||
:v-close-popper="!option.remainOnClick"
|
:v-close-popper="!option.remainOnClick"
|
||||||
:action="
|
:action="
|
||||||
option.action
|
option.action
|
||||||
? (event) => {
|
? (event: MouseEvent) => {
|
||||||
option.action(event)
|
option.action?.(event)
|
||||||
if (!option.remainOnClick) {
|
if (!option.remainOnClick) {
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
: null
|
: undefined
|
||||||
"
|
"
|
||||||
:link="option.link ? option.link : null"
|
:link="option.link ? option.link : undefined"
|
||||||
:external="option.external ? option.external : false"
|
:external="option.external ? option.external : false"
|
||||||
:disabled="option.disabled"
|
:disabled="option.disabled"
|
||||||
@click="
|
@click="
|
||||||
@@ -67,7 +67,7 @@ interface Divider extends BaseOption {
|
|||||||
|
|
||||||
interface Item extends BaseOption {
|
interface Item extends BaseOption {
|
||||||
id: string
|
id: string
|
||||||
action?: () => void
|
action?: (event?: MouseEvent) => void
|
||||||
link?: string
|
link?: string
|
||||||
external?: boolean
|
external?: boolean
|
||||||
color?:
|
color?:
|
||||||
@@ -99,8 +99,8 @@ withDefaults(
|
|||||||
{
|
{
|
||||||
options: () => [],
|
options: () => [],
|
||||||
disabled: false,
|
disabled: false,
|
||||||
dropdownId: null,
|
dropdownId: undefined,
|
||||||
tooltip: null,
|
tooltip: undefined,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -118,6 +118,10 @@ const open = () => {
|
|||||||
dropdown.value?.show()
|
dropdown.value?.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isDivider(option: BaseOption): option is Divider {
|
||||||
|
return 'divider' in option
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({ open, close })
|
defineExpose({ open, close })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user