Skip to content

Commit

Permalink
Merge branch 'designerfields-drag-icon' into 'main'
Browse files Browse the repository at this point in the history
Add drag icon to design field editors

See merge request reportcreator/reportcreator!353
  • Loading branch information
MWedl committed Nov 27, 2023
2 parents ed837e2 + 8596c10 commit 8d6b903
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
20 changes: 17 additions & 3 deletions frontend/src/pages/designs/[projectTypeId]/findingfields.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<draggable
v-model="findingFields"
item-key="id"
:group="{name: 'findingFields', put: ['predefinedFindingFields']}"
:group="{name: 'findingFields', put: ['findingFields', 'predefinedFindingFields']}"
@add="addPredefinedField"
:disabled="readonly"
>
Expand All @@ -31,6 +31,9 @@
link
:ripple="false"
>
<template #prepend>
<v-icon icon="mdi-drag-horizontal" />
</template>
<template #default>
<v-list-item-title class="text-body-2">{{ f.id }}</v-list-item-title>
</template>
Expand All @@ -49,7 +52,7 @@
</draggable>

<v-divider />
<v-list-group value="predefinedFields">
<v-list-group value="predefinedFields" fluid>
<template #activator="{ props: listGroupProps }">
<v-list-item title="Predefined Fields" v-bind="listGroupProps" />
</template>
Expand All @@ -64,7 +67,12 @@
class="draggable-item"
:ripple="false"
>
<v-list-item-title class="text-body-2">{{ f.id }}</v-list-item-title>
<template #prepend>
<v-icon icon="mdi-drag" />
</template>
<template #default>
<v-list-item-title class="text-body-2">{{ f.id }}</v-list-item-title>
</template>
</v-list-item>
</template>
</draggable>
Expand Down Expand Up @@ -206,4 +214,10 @@ function deleteField(fieldId: string) {
.draggable-item {
cursor: grab;
}
:deep(.v-list-item__prepend) {
.v-list-item__spacer {
width: 0.5em;
}
}
</style>
16 changes: 15 additions & 1 deletion frontend/src/pages/designs/[projectTypeId]/reportfields.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
link
class="draggable-handle"
>
<template #prepend>
<v-icon icon="mdi-drag-horizontal" />
</template>
<template #append>
<btn-delete
v-if="s.fields.length === 0"
Expand All @@ -52,7 +55,12 @@
>
<template #item="{ element: f}">
<v-list-item :value="f" class="draggable-handle" :ripple="false" link>
<v-list-item-title class="text-body-2">{{ f.id }}</v-list-item-title>
<template #prepend>
<v-icon icon="mdi-drag-horizontal" />
</template>
<template #default>
<v-list-item-title class="text-body-2">{{ f.id }}</v-list-item-title>
</template>
<template #append>
<btn-delete
v-if="f.origin !== FieldOrigin.CORE"
Expand Down Expand Up @@ -297,4 +305,10 @@ function deleteSection(section: ReportSectionDefinitionWithFieldDefinition) {
.draggable-handle {
cursor: grab;
}
:deep(.v-list-item__prepend) {
.v-list-item__spacer {
width: 0.5em;
}
}
</style>

0 comments on commit 8d6b903

Please sign in to comment.