Skip to content

Commit

Permalink
fix: fix grown last card during dnd
Browse files Browse the repository at this point in the history
  • Loading branch information
shocota committed Jan 23, 2023
1 parent b6cb6c3 commit e10b8e9
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 49 deletions.
92 changes: 44 additions & 48 deletions src/components/paginateUnit.vue
Original file line number Diff line number Diff line change
@@ -1,53 +1,52 @@
<template>
<draggable
class="paginate-unit"
:list="items"
item-key="id"
:data-group="fieldValue"
group="items"
@end="handleDragEnd"
<paginate-unit-load-observer
v-model:is-in-viewport="isInViewPort"
:collection="fieldValue"
>
<template #item="{ element }">
<section
class="card drag-handle"
:data-item-id="element.id"
@click="() => handleCardClick(element)"
>
<header>
<div v-if="layoutOptions?.iconTemplate" class="card-icon">
<draggable
class="paginate-unit"
:list="items"
item-key="id"
:data-group="fieldValue"
group="items"
@end="handleDragEnd"
>
<template #item="{ element }">
<section
class="card drag-handle"
:data-item-id="element.id"
@click="() => handleCardClick(element)"
>
<header>
<div v-if="layoutOptions?.iconTemplate" class="card-icon">
<render-template
class="card-icon-inner"
:template="layoutOptions.iconTemplate"
:collection="collectionKey"
:item="element"
/>
</div>
<render-template
class="card-icon-inner"
:template="layoutOptions.iconTemplate"
v-if="layoutOptions?.headerTemplate"
class="card-title"
:template="layoutOptions.headerTemplate"
:collection="collectionKey"
:item="element"
/>
</div>
<render-template
v-if="layoutOptions?.headerTemplate"
class="card-title"
:template="layoutOptions.headerTemplate"
:collection="collectionKey"
:item="element"
/>
<span v-else class="card-title muted">--</span>
</header>
<main v-if="layoutOptions?.cardContentTemplate">
<render-template
:template="layoutOptions.cardContentTemplate"
:collection="collectionKey"
:item="element"
/>
</main>
</section>
</template>
<template #footer>
<paginate-unit-load-observer
v-model:is-in-viewport="isInViewPort"
:collection="fieldValue"
/>
</template>
</draggable>
<span v-else class="card-title muted">--</span>
</header>
<main v-if="layoutOptions?.cardContentTemplate">
<render-template
:template="layoutOptions.cardContentTemplate"
:collection="collectionKey"
:item="element"
/>
</main>
</section>
</template>
</draggable>
</paginate-unit-load-observer>
</template>
<script lang="ts">
Expand Down Expand Up @@ -195,10 +194,6 @@ export default defineComponent({
align-items: stretch;
}
.paginate-unit > *:last-child {
flex-grow: 1;
}
.card {
display: flex;
flex-flow: column nowrap;
Expand Down Expand Up @@ -240,6 +235,7 @@ header > .card-title {
-webkit-line-clamp: 2;
overflow: hidden;
}
header > .card-title.muted {
color: var(--foreground-subdued);
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/paginateUnitLoadObserver.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<template>
<div ref="loader"></div>
<div ref="loader">
<slot></slot>
</div>
</template>

<script lang="ts">
Expand Down

0 comments on commit e10b8e9

Please sign in to comment.