fix: added multi action button
(cherry picked from commit 3b432a0209689fbb8f92a6401816d88add8c0e5c)
This commit is contained in:
parent
f9e7035585
commit
61ba3bd7f9
1
frontend/components.d.ts
vendored
1
frontend/components.d.ts
vendored
@ -150,6 +150,7 @@ declare module 'vue' {
|
||||
MobileLayout: typeof import('./src/components/Layouts/MobileLayout.vue')['default']
|
||||
MobileSidebar: typeof import('./src/components/Mobile/MobileSidebar.vue')['default']
|
||||
MoneyIcon: typeof import('./src/components/Icons/MoneyIcon.vue')['default']
|
||||
MultiActionButton: typeof import('./src/components/MultiActionButton.vue')['default']
|
||||
MultipleAvatar: typeof import('./src/components/MultipleAvatar.vue')['default']
|
||||
MultiSelectEmailInput: typeof import('./src/components/Controls/MultiSelectEmailInput.vue')['default']
|
||||
MuteIcon: typeof import('./src/components/Icons/MuteIcon.vue')['default']
|
||||
|
||||
61
frontend/src/components/MultiActionButton.vue
Normal file
61
frontend/src/components/MultiActionButton.vue
Normal file
@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<div class="flex items-center">
|
||||
<Button
|
||||
variant="solid"
|
||||
class="border-0 rounded-br-none rounded-tr-none"
|
||||
:label="activeButton.label"
|
||||
:size="$attrs.size"
|
||||
:class="$attrs.class"
|
||||
@click="() => activeButton.onClick()"
|
||||
>
|
||||
<template #prefix>
|
||||
<component
|
||||
v-if="activeButton.icon"
|
||||
:is="activeButton.icon"
|
||||
class="h-4 w-4"
|
||||
/>
|
||||
</template>
|
||||
</Button>
|
||||
<Dropdown
|
||||
:options="parsedOptions"
|
||||
size="sm"
|
||||
class="flex-1 [&>div>div>div]:w-full"
|
||||
placement="right"
|
||||
>
|
||||
<template v-slot="{ togglePopover }">
|
||||
<Button
|
||||
variant="solid"
|
||||
@click="togglePopover"
|
||||
icon="chevron-down"
|
||||
class="!w-6 justify-start rounded-bl-none rounded-tl-none border-0 pr-0 text-xs"
|
||||
/>
|
||||
</template>
|
||||
</Dropdown>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { Dropdown } from 'frappe-ui'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
options: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
})
|
||||
|
||||
const activeButton = ref(props.options?.[0] || {})
|
||||
|
||||
const parsedOptions = computed(() => {
|
||||
return (
|
||||
props.options?.map((option) => {
|
||||
return {
|
||||
label: option.label,
|
||||
onClick: () => {
|
||||
activeButton.value = option
|
||||
},
|
||||
}
|
||||
}) || []
|
||||
)
|
||||
})
|
||||
</script>
|
||||
Loading…
x
Reference in New Issue
Block a user