-
Notifications
You must be signed in to change notification settings - Fork 28
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
fix(deps): update dependency vuetify to v3.6.8 #1785
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |
<v-navigation-drawer | ||
v-model="drawer" | ||
id="c-sidebar" | ||
ref="drawerRef" | ||
floating | ||
:width="drawerWidth" | ||
class="fill-height" | ||
|
@@ -68,11 +67,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |
</template> | ||
|
||
<script> | ||
import { nextTick, ref } from 'vue' | ||
import { useDisplay } from 'vuetify' | ||
import Header from '@/components/cylc/Header.vue' | ||
import { mapMutations } from 'vuex' | ||
import Workflows from '@/views/Workflows.vue' | ||
import { mdiHome, mdiGraphql } from '@mdi/js' | ||
import pkg from '@/../package.json' | ||
import { when } from '@/utils' | ||
import { useDrawer } from '@/utils/toolbar' | ||
|
||
export const initialWidth = 260 | ||
export const minWidth = 150 | ||
|
@@ -83,71 +85,55 @@ export default { | |
'c-header': Header | ||
}, | ||
|
||
data: function () { | ||
return { | ||
drawerWidth: initialWidth | ||
} | ||
}, | ||
setup () { | ||
const { mobile } = useDisplay() | ||
|
||
mounted () { | ||
this.setEvents() | ||
}, | ||
const drawerWidth = ref(initialWidth) | ||
|
||
const { drawer } = useDrawer() | ||
// Show drawer initially if viewport is large enough: | ||
drawer.value = !mobile.value | ||
|
||
computed: { | ||
drawer: { | ||
get () { | ||
return this.$store.state.app.drawer | ||
}, | ||
set (val) { | ||
this.setDrawer(val) | ||
} | ||
function resize (e) { | ||
// If less than min width, will collapse (to 4px because that's the resize-bar width) | ||
drawerWidth.value = e.clientX > minWidth ? e.clientX : 4 | ||
} | ||
}, | ||
|
||
methods: { | ||
...mapMutations('app', ['setDrawer']), | ||
getDrawerElement () { | ||
// Cannot use $refs.drawerRef.$el due to https://github.com/vuetifyjs/vuetify/issues/16766 | ||
return document.getElementById('c-sidebar') | ||
}, | ||
resize (e) { | ||
// If less than min width, will collapse (to 4px because that's the | ||
// resize-bar width) | ||
this.drawerWidth = e.clientX > minWidth ? e.clientX : 4 | ||
}, | ||
setEvents () { | ||
const el = this.getDrawerElement() | ||
const drawerBorder = this.$refs.resizeBar | ||
drawerBorder.addEventListener( | ||
/** @type {import('vue').Ref<HTMLElement>} template ref */ | ||
const resizeBar = ref(null) | ||
|
||
when(resizeBar, () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Appears to work ok. The target region for resizing is very narrow and can be obscured by scroll bars, but this isn't new, opened a separate issue. |
||
resizeBar.value.addEventListener( | ||
'mousedown', | ||
(mdEvent) => { | ||
// Prevent Vuetify-provided transitions to ensure responsiveness | ||
el.style.transition = 'none' | ||
Comment on lines
-124
to
-125
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved this to CSS |
||
document.body.classList.add('resizing-drawer') | ||
document.addEventListener('mousemove', this.resize, { passive: true }) | ||
document.addEventListener('mousemove', resize, { passive: true }) | ||
mdEvent.stopPropagation?.() | ||
mdEvent.preventDefault?.() | ||
|
||
document.addEventListener( | ||
'mouseup', | ||
(muEvent) => { | ||
if (muEvent.clientX < minWidth) { | ||
this.drawer = false | ||
drawer.value = false | ||
// Reset to width at time of mousedown | ||
// (using a timeout as a hack to prevent drawer briefly | ||
// reappearing (nextTick doesn't work)) | ||
setTimeout(() => { | ||
this.drawerWidth = mdEvent.clientX | ||
}, 200) | ||
nextTick(() => { | ||
drawerWidth.value = mdEvent.clientX | ||
}) | ||
} | ||
el.style.transition = null | ||
document.body.classList.remove('resizing-drawer') | ||
document.removeEventListener('mousemove', this.resize) | ||
document.removeEventListener('mousemove', resize) | ||
}, | ||
{ once: true } | ||
) | ||
} | ||
) | ||
}) | ||
|
||
return { | ||
drawer, | ||
drawerWidth, | ||
resizeBar, | ||
} | ||
}, | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,15 +18,11 @@ | |
import { markRaw } from 'vue' | ||
|
||
const state = () => ({ | ||
drawer: null, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1๏ธโฃ For some reason, in Vuetify 3.6, trying to base the drawer visibility state off the vuex store broke resizing the drawer: vuetifyjs/vuetify#19925 See next comment for how I worked around this |
||
title: null, | ||
workspaceLayouts: new Map(), | ||
}) | ||
|
||
const mutations = { | ||
setDrawer (state, drawer) { | ||
state.drawer = drawer | ||
}, | ||
setTitle (state, title) { | ||
state.title = title | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,13 +20,13 @@ | |
|
||
body.resizing-drawer { | ||
cursor: ew-resize !important; | ||
#c-sidebar, .v-main { | ||
// Prevent Vuetify-provided transitions during resize to ensure responsiveness | ||
transition: none !important; | ||
} | ||
} | ||
|
||
#c-sidebar { | ||
/* this is not in our styles/material-dashboard, so we need to force-override */ | ||
-webkit-box-shadow: none !important; | ||
box-shadow: none !important; | ||
Comment on lines
-26
to
-28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this was outdated, wasn't doing anything There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a visible drop shadow when opening the draw in the workspace view from its collapsed state (i.e. via the toggle button in the top left), but this is fine. |
||
|
||
@include theme-dependent(background-color, settings.$grey, 4); | ||
|
||
.resize-bar { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,46 +15,34 @@ | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { computed, onMounted } from 'vue' | ||
import { computed, ref } from 'vue' | ||
import { useDisplay } from 'vuetify' | ||
import { useStore } from 'vuex' | ||
|
||
/** Height in px */ | ||
export const toolbarHeight = 48 | ||
|
||
/** | ||
* Composable that returns a computed property for whether we should show | ||
* the hamburger nav drawer button. | ||
*/ | ||
export function useNavBtn () { | ||
const { mobile } = useDisplay() | ||
const store = useStore() | ||
/** Global state of navigation drawer visibility */ | ||
const drawer = ref(false) | ||
Comment on lines
+24
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2๏ธโฃ This replaces the entry in the vuex store |
||
|
||
function toggleDrawer () { | ||
drawer.value = !drawer.value | ||
} | ||
|
||
/** Composable that provides the global state of the navigation drawer visibility. */ | ||
export function useDrawer () { | ||
return { | ||
showNavBtn: computed(() => mobile.value || !store.state.app.drawer), | ||
drawer, | ||
toggleDrawer, | ||
} | ||
} | ||
|
||
/** | ||
* Composable that replaces the old toolbar mixin. | ||
* | ||
* Main responsibility is to add responsive toggle | ||
* to a Toolbar component. Shared between (at least) the Cylc | ||
* UI default Toolbar, and the Workflow view Toolbar. | ||
* Composable that returns a computed property for whether we should show | ||
* the hamburger nav drawer button. | ||
*/ | ||
export function useToolbar () { | ||
const store = useStore() | ||
const { showNavBtn } = useNavBtn() | ||
|
||
onMounted(() => { | ||
store.commit('app/setDrawer', !showNavBtn.value) | ||
}) | ||
|
||
const toggleDrawer = () => { | ||
store.commit('app/setDrawer', !store.state.app.drawer) | ||
} | ||
|
||
export function useNavBtn () { | ||
const { mobile } = useDisplay() | ||
return { | ||
showNavBtn, | ||
toggleDrawer, | ||
showNavBtn: computed(() => mobile.value || !drawer.value), | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I spent a bit of time yesterday trying to make this into
<script setup>
but was struggling with these bitsnot sure how to rename a component like this in Vue3
don't know where to put these.
Its not necessary anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to specify components in
<script setup>
, just import them e.g.import CHeader from '@/components/cylc/Header.vue'
You could do
const mode = import.meta.env.MODE
and just usepkg.version
directly in the template