1
0
forked from test/crm

fix: added multi action button

(cherry picked from commit 3b432a0209689fbb8f92a6401816d88add8c0e5c)
This commit is contained in:
Shariq Ansari 2025-04-07 13:58:58 +05:30 committed by Mergify
parent f9e7035585
commit 61ba3bd7f9
2 changed files with 62 additions and 0 deletions

View File

@ -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']

View 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>