fix tabel transition

This commit is contained in:
Geriano
2022-07-31 11:41:43 +07:00
parent dd3a9be30f
commit 3280bbffae
3 changed files with 66 additions and 91 deletions

View File

@@ -14,7 +14,7 @@ const { url, sticky } = defineProps({
}) })
const paginator = ref({}) const paginator = ref({})
const processing = ref(true) const processing = ref(false)
const last = ref(null) const last = ref(null)
const config = useForm({ const config = useForm({
page: 1, page: 1,

View File

@@ -136,13 +136,9 @@ onUnmounted(() => window.removeEventListener('keydown', esc))
</template> </template>
<template #tbody="{ data, processing, empty, refresh }"> <template #tbody="{ data, processing, empty, refresh }">
<TransitionGroup <TransitionGroup enterActiveClass="transition-all duration-200" leaveActiveClass="transition-all duration-200" enterFromClass="opacity-0 -scale-y-100" leaveToClass="opacity-0 -scale-y-100">
enterActiveClass="transition-all duration-300"
leaveActiveClass="transition-all duration-100"
enterFromClass="opacity-0"
leaveToClass="opacity-0">
<template v-if="empty"> <template v-if="empty">
<tr v-if="empty"> <tr>
<td class="text-5xl text-center p-4" colspan="1000"> <td class="text-5xl text-center p-4" colspan="1000">
<p class="lowercase first-letter:capitalize font-semibold">there are no data available</p> <p class="lowercase first-letter:capitalize font-semibold">there are no data available</p>
</td> </td>
@@ -150,13 +146,7 @@ onUnmounted(() => window.removeEventListener('keydown', esc))
</template> </template>
<template v-else> <template v-else>
<template v-if="processing"> <tr v-for="(role, i) in data" :key="i" class="dark:hover:bg-gray-600 transition-all duration-300" :class="processing && 'bg-gray-800'">
<tr v-for="i in Array(1).fill(0)" :key="i">
</tr>
</template>
<template v-else>
<tr v-for="(role, i) in data" :key="i" class="dark:hover:bg-gray-600 transition-all duration-300">
<td class="px-2 py-1 border dark:border-gray-800 text-center">{{ i + 1 }}</td> <td class="px-2 py-1 border dark:border-gray-800 text-center">{{ i + 1 }}</td>
<td class="px-2 py-1 border dark:border-gray-800 uppercase">{{ role.name }}</td> <td class="px-2 py-1 border dark:border-gray-800 uppercase">{{ role.name }}</td>
<td class="px-2 py-1 border dark:border-gray-800"> <td class="px-2 py-1 border dark:border-gray-800">
@@ -185,7 +175,6 @@ onUnmounted(() => window.removeEventListener('keydown', esc))
</td> </td>
</tr> </tr>
</template> </template>
</template>
</TransitionGroup> </TransitionGroup>
</template> </template>
</Builder> </Builder>

View File

@@ -175,11 +175,7 @@ onUnmounted(() => window.removeEventListener('keydown', esc))
</template> </template>
<template #tbody="{ data, processing, empty }"> <template #tbody="{ data, processing, empty }">
<transition-group <TransitionGroup enterActiveClass="transition-all duration-200" leaveActiveClass="transition-all duration-200" enterFromClass="opacity-0 -scale-y-100" leaveToClass="opacity-0 -scale-y-100">
enterActiveClass="transition-all duration-100"
leaveActiveClass="transition-all duration-50"
enterFromClass="opacity-0 -scale-y-100"
leaveToClass="opacity-0 -scale-y-100">
<template v-if="empty"> <template v-if="empty">
<tr v-if="empty"> <tr v-if="empty">
<td class="text-5xl text-center p-4" colspan="1000"> <td class="text-5xl text-center p-4" colspan="1000">
@@ -189,16 +185,7 @@ onUnmounted(() => window.removeEventListener('keydown', esc))
</template> </template>
<template v-else> <template v-else>
<template v-if="processing"> <tr v-for="(user, i) in data" :key="i" class="dark:hover:bg-gray-600 transition-all duration-300" :class="processing && 'bg-gray-800'">
<tr v-for="i in Array(5).fill(0)" :key="i" class="border dark:border-gray-800">
<td class="text-5xl text-center p-2" colspan="1000">
<div class="lowercase first-letter:capitalize font-semibold dark:bg-gray-800 animate-pulse p-5 rounded-md"></div>
</td>
</tr>
</template>
<template v-else>
<tr v-for="(user, i) in data" :key="i" class="dark:hover:bg-gray-600 transition-all duration-300">
<td class="px-2 py-1 border dark:border-gray-800 text-center">{{ i + 1 }}</td> <td class="px-2 py-1 border dark:border-gray-800 text-center">{{ i + 1 }}</td>
<td class="px-2 py-1 border dark:border-gray-800 uppercase">{{ user.name }}</td> <td class="px-2 py-1 border dark:border-gray-800 uppercase">{{ user.name }}</td>
<td class="px-2 py-1 border dark:border-gray-800 uppercase">{{ user.username }}</td> <td class="px-2 py-1 border dark:border-gray-800 uppercase">{{ user.username }}</td>
@@ -243,8 +230,7 @@ onUnmounted(() => window.removeEventListener('keydown', esc))
</td> </td>
</tr> </tr>
</template> </template>
</template> </TransitionGroup>
</transition-group>
</template> </template>
</Builder> </Builder>
</div> </div>