Improve drawer state management between instances

This commit is contained in:
Andrew Kingston 2024-02-29 16:29:32 +00:00
parent 08ad9d9c4e
commit 47cc9557c4
2 changed files with 10 additions and 2 deletions

View File

@ -8,6 +8,7 @@
// Context level stores to keep drawers in sync
const openDrawers = writable([])
const modal = writable(false)
const resizable = writable(true)
const drawerLeft = writable(null)
const drawerWidth = writable(null)
@ -45,8 +46,13 @@
return
}
observer?.disconnect()
// Reset state
observer = null
modal.set(false)
resizable.set(true)
drawerLeft.set(null)
drawerWidth.set(null)
}
</script>
@ -93,6 +99,7 @@
}
if (forceModal) {
modal.set(true)
resizable.set(false)
}
observe()
visible = true
@ -114,7 +121,7 @@
hide,
show,
modal,
forceModal,
resizable,
})
const easeInOutQuad = x => {

View File

@ -34,6 +34,7 @@
import { capitalise } from "helpers"
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte"
import { Utils } from "@budibase/frontend-core"
import { get } from "svelte/store"
const dispatch = createEventDispatcher()
@ -213,7 +214,7 @@
<Icon name={tab} size="S" />
</ActionButton>
{/each}
{#if drawerContext && !drawerContext.forceModal}
{#if drawerContext && get(drawerContext.resizable)}
<ActionButton
size="M"
quiet