2
0
mirror of https://github.com/frappe/books.git synced 2024-11-14 01:14:03 +00:00

fix(ui): transition on quick edit display

This commit is contained in:
18alantom 2022-11-04 19:38:29 +05:30
parent 892ca87fe1
commit 88f601511d
4 changed files with 38 additions and 27 deletions

View File

@ -150,7 +150,7 @@
" "
@click="$emit('toggle-sidebar')" @click="$emit('toggle-sidebar')"
> >
<feather-icon name="chevrons-left" class="w-5 h-5" /> <feather-icon name="chevrons-left" class="w-4 h-4" />
</button> </button>
</div> </div>
</template> </template>

View File

@ -3,8 +3,7 @@
<Transition name="sidebar"> <Transition name="sidebar">
<Sidebar <Sidebar
v-show="sidebar" v-show="sidebar"
class="flex-shrink-0 border-r whitespace-nowrap" class="flex-shrink-0 border-r whitespace-nowrap w-sidebar"
:class="sidebar ? 'w-sidebar' : ''"
@change-db-file="$emit('change-db-file')" @change-db-file="$emit('change-db-file')"
@toggle-sidebar="sidebar = !sidebar" @toggle-sidebar="sidebar = !sidebar"
/> />
@ -17,17 +16,18 @@
</keep-alive> </keep-alive>
</router-view> </router-view>
<div class="flex" v-if="showQuickEdit"> <router-view name="edit" v-slot="{ Component, route }">
<router-view name="edit" v-slot="{ Component }"> <Transition name="quickedit">
<keep-alive> <keep-alive>
<component <div v-if="route?.query?.edit">
:is="Component" <component
class="w-quick-edit flex-1" :is="Component"
:key="$route.query.schemaName + $route.query.name" :key="route.query.schemaName + route.query.name"
/> />
</div>
</keep-alive> </keep-alive>
</router-view> </Transition>
</div> </router-view>
</div> </div>
<!-- Show Sidebar Button --> <!-- Show Sidebar Button -->
@ -43,18 +43,17 @@
p-1 p-1
m-4 m-4
opacity-0 opacity-0
hover:opacity-100 hover:opacity-100 hover:shadow-md
hover:shadow-md
" "
@click="sidebar = !sidebar" @click="sidebar = !sidebar"
> >
<feather-icon name="chevrons-right" class="w-5 h-5" /> <feather-icon name="chevrons-right" class="w-4 h-4" />
</button> </button>
</div> </div>
</template> </template>
<script> <script>
import { computed } from '@vue/reactivity'; import { computed } from '@vue/reactivity';
import Sidebar from '../components/Sidebar'; import Sidebar from '../components/Sidebar.vue';
export default { export default {
name: 'Desk', name: 'Desk',
emits: ['change-db-file'], emits: ['change-db-file'],
@ -67,15 +66,6 @@ export default {
components: { components: {
Sidebar, Sidebar,
}, },
computed: {
showQuickEdit() {
return (
this.$route.query.edit &&
this.$route.query.schemaName &&
this.$route.query.name
);
},
},
}; };
</script> </script>
@ -83,12 +73,14 @@ export default {
.sidebar-enter-from, .sidebar-enter-from,
.sidebar-leave-to { .sidebar-leave-to {
opacity: 0; opacity: 0;
transform: translateX(calc(-1 * var(--w-sidebar)));
width: 0px; width: 0px;
} }
.sidebar-enter-to, .sidebar-enter-to,
.sidebar-leave-from { .sidebar-leave-from {
opacity: 1; opacity: 1;
transform: translateX(0px);
width: var(--w-sidebar); width: var(--w-sidebar);
} }
@ -96,4 +88,23 @@ export default {
.sidebar-leave-active { .sidebar-leave-active {
transition: all 250ms ease-out; transition: all 250ms ease-out;
} }
.quickedit-enter-from,
.quickedit-leave-to {
transform: translateX(var(--w-quick-edit));
width: 0px;
opacity: 0;
}
.quickedit-enter-to,
.quickedit-leave-from {
transform: translateX(0px);
width: var(--w-quick-edit);
opacity: 1;
}
.quickedit-enter-active,
.quickedit-leave-active {
transition: all 250ms ease-out;
}
</style> </style>

View File

@ -1,6 +1,6 @@
<template> <template>
<div <div
class="border-l h-full overflow-auto" class="border-l h-full overflow-auto w-quick-edit"
:class="white ? 'bg-white' : 'bg-gray-25'" :class="white ? 'bg-white' : 'bg-gray-25'"
> >
<!-- Quick edit Tool bar --> <!-- Quick edit Tool bar -->

View File

@ -74,7 +74,7 @@ export async function openQuickEdit({
router[method]({ router[method]({
query: { query: {
edit: 1, edit: '1',
schemaName, schemaName,
name, name,
showFields, showFields,