Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(QDrawer): add prop to disable mini animation #15670

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
106 changes: 106 additions & 0 deletions ui/dev/src/pages/layout/layout-drawer-mini.vue
@@ -0,0 +1,106 @@
<template>
<div class="q-layout-padding">
<q-toggle v-model="disableMiniAnimation">
Disable mini animation
</q-toggle>
<q-toggle v-model="miniToOverlay">
Mini to overlay
</q-toggle>

<q-layout view="hHh lpr fFf" container :style="containerStyle" class="q-mt-xl shadow-2">
<q-header class="bg-black">
<q-toolbar>
<q-btn flat @click="miniState = !miniState" round dense icon="menu" />
<q-toolbar-title>Header</q-toolbar-title>
</q-toolbar>
</q-header>

<q-drawer
side="left"
:model-value="true"
:mini="miniState"
:mini-to-overlay="miniToOverlay"
:width="200"
:disable-mini-animation="disableMiniAnimation"
:breakpoint="0"
bordered
>
<q-scroll-area class="fit" :horizontal-thumb-style="{ opacity: 0 }">
<q-list padding>
<q-item clickable v-ripple>
<q-item-section avatar>
<q-icon name="inbox" />
</q-item-section>

<q-item-section>
Inbox
</q-item-section>
</q-item>

<q-item active clickable v-ripple>
<q-item-section avatar>
<q-icon name="star" />
</q-item-section>

<q-item-section>
Star
</q-item-section>
</q-item>

<q-item clickable v-ripple>
<q-item-section avatar>
<q-icon name="send" />
</q-item-section>

<q-item-section>
Send
</q-item-section>
</q-item>

<q-item clickable v-ripple>
<q-item-section avatar>
<q-icon name="drafts" />
</q-item-section>

<q-item-section>
Drafts
</q-item-section>
</q-item>
</q-list>
</q-scroll-area>
</q-drawer>

<q-page-container>
<q-page padding>
<div v-for="n in contentSize" :key="n">
My page My page My page My page My page My page
My page My page My page My page My page My page {{ n }} / {{ contentSize }}
</div>
</q-page>
</q-page-container>
</q-layout>
</div>
</template>

<script>
export default {
data () {
return {
miniState: true,
miniToOverlay: true,
width: 1030,
contentSize: 30,
disableMiniAnimation: false
}
},

computed: {
containerStyle () {
return {
height: '800px',
width: this.width + 'px'
}
}
}
}
</script>
2 changes: 2 additions & 0 deletions ui/src/components/drawer/QDrawer.js
Expand Up @@ -41,6 +41,7 @@ export default createComponent({
type: Number,
default: 57
},
disableMiniAnimation: Boolean,

breakpoint: {
type: Number,
Expand Down Expand Up @@ -417,6 +418,7 @@ export default createComponent({
watch(() => $q.lang.rtl, () => { applyPosition() })

watch(() => props.mini, () => {
if (props.disableMiniAnimation) return
if (props.modelValue === true) {
animateMini()
$layout.animate()
Expand Down
7 changes: 7 additions & 0 deletions ui/src/components/drawer/QDrawer.json
Expand Up @@ -108,6 +108,13 @@
"type": "Boolean",
"desc": "Disables the default behavior where drawer backdrop can be swiped",
"category": "behavior"
},

"disable-mini-animation": {
"type": "Boolean",
"desc": "Disables animation of the drawer when toggling mini mode",
"category": "behavior",
"addedIn": "v2.11.11"
}
},

Expand Down