mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-21 13:23:14 +01:00
* fix: change Content-Disposition to inline for proper document display in attachments * feat: overhaul how dialog system works, add delete to image dialog and add button to open image dialog on edit page * chore: remove unneeded console log * fix: ensure cleanup of dialog callbacks on unmount in BarcodeModal, CreateModal, and ImageDialog components
28 lines
937 B
Vue
28 lines
937 B
Vue
<script lang="ts" setup>
|
|
import type { DrawerRootEmits, DrawerRootProps } from "vaul-vue";
|
|
import { useForwardPropsEmits } from "reka-ui";
|
|
import { DrawerRoot } from "vaul-vue";
|
|
import { DialogID, useDialog } from "@/components/ui/dialog-provider/utils";
|
|
|
|
const props = withDefaults(defineProps<DrawerRootProps & { dialogId: string }>(), {
|
|
shouldScaleBackground: true,
|
|
}) as DrawerRootProps & { dialogId: DialogID };
|
|
|
|
const emits = defineEmits<DrawerRootEmits>();
|
|
|
|
const { closeDialog, activeDialog } = useDialog();
|
|
|
|
const isOpen = computed(() => activeDialog.value !== null && activeDialog.value === props.dialogId);
|
|
const onOpenChange = (open: boolean) => {
|
|
if (!open) closeDialog(props.dialogId as any);
|
|
};
|
|
|
|
const forwarded = useForwardPropsEmits(props, emits);
|
|
</script>
|
|
|
|
<template>
|
|
<DrawerRoot v-bind="forwarded" :open="isOpen" @update:open="onOpenChange">
|
|
<slot />
|
|
</DrawerRoot>
|
|
</template>
|