fix(#15): Fix several UI bugs

This commit is contained in:
2025-11-20 17:46:41 +01:00
parent 176c3630b9
commit 1bf34f350c
7 changed files with 70 additions and 58 deletions

View File

@@ -1,7 +1,7 @@
<template>
<template v-for="(formElement, index) in props.modelValue" :key="formElement.id">
<div class="flex py-3 lg:py-4">
<div class="group flex-auto">
<div class="group flex py-3 lg:py-4">
<div class="flex-auto">
<p v-if="formElement.title" class="font-semibold">{{ formElement.title }}</p>
<p v-if="formElement.description" class="text-dimmed pb-3">{{ formElement.description }}</p>
<component
@@ -17,8 +17,17 @@
:comments="comments?.[formElement.id]"
/>
</div>
<div>
<UDropdownMenu :items="getDropdownItems(formElement.id, index)" :content="{ align: 'end' }">
<div
:class="[
'transition-opacity duration-200',
openDropdownId === formElement.id ? 'opacity-100' : 'opacity-0 group-hover:opacity-100'
]"
>
<UDropdownMenu
:items="getDropdownItems(formElement.id, index)"
:content="{ align: 'end' }"
@update:open="(isOpen) => handleDropdownToggle(formElement.id, isOpen)"
>
<UButton icon="i-lucide-ellipsis-vertical" color="neutral" variant="ghost" />
</UDropdownMenu>
</div>
@@ -55,7 +64,13 @@ if (props.applicationFormId) {
await loadComments(props.applicationFormId)
}
const route = useRoute()
const activeFormElement = ref('')
const openDropdownId = ref<string | null>(null)
function handleDropdownToggle(formElementId: string, isOpen: boolean) {
openDropdownId.value = isOpen ? formElementId : null
}
function getResolvedComponent(formElement: FormElementDto) {
switch (formElement.type) {
@@ -77,20 +92,23 @@ function getResolvedComponent(formElement: FormElementDto) {
}
function getDropdownItems(formElementId: string, formElementPosition: number): DropdownMenuItem[] {
return [
[
{
label: 'Comments',
icon: 'i-lucide-message-square-more',
onClick: () => toggleComments(formElementId)
},
{
label: 'Add input field below',
icon: 'i-lucide-list-plus',
onClick: () => emit('add:input-form', formElementPosition)
}
]
]
const items = []
if (route.path !== '/create') {
items.push({
label: 'Comments',
icon: 'i-lucide-message-square-more',
onClick: () => toggleComments(formElementId)
})
}
items.push({
label: 'Add input field below',
icon: 'i-lucide-list-plus',
onClick: () => emit('add:input-form', formElementPosition)
})
return [items]
}
function updateFormOptions(formOptions: FormOptionDto[], formElementIndex: number) {

View File

@@ -37,16 +37,17 @@
v-if="stepper?.hasNext"
trailing-icon="i-lucide-arrow-right"
:disabled="!stepper?.hasNext"
size="lg"
@click="handleNavigate('forward')"
>
Next
</UButton>
<div v-if="!stepper?.hasNext" class="flex flex-wrap items-center gap-1.5">
<UButton trailing-icon="i-lucide-save" :disabled="disabled" variant="outline" @click="emit('save')">
<UButton trailing-icon="i-lucide-save" :disabled="disabled" variant="outline" size="lg" @click="emit('save')">
Save
</UButton>
<UButton trailing-icon="i-lucide-send-horizontal" :disabled="disabled" @click="emit('submit')">
<UButton trailing-icon="i-lucide-send-horizontal" :disabled="disabled" size="lg" @click="emit('submit')">
Submit
</UButton>
</div>

View File

@@ -1,6 +1,6 @@
<template>
<UFormField :label="label">
<UInput v-model="modelValue" />
<UInput v-model="modelValue" class="w-full" />
</UFormField>
</template>