Merge branch 'master' into feature/sqs-relationships

This commit is contained in:
Michael Drury 2024-04-15 13:59:05 +01:00 committed by GitHub
commit 99b577d05b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7 additions and 47 deletions

View File

@ -7,11 +7,11 @@
export let narrower = false export let narrower = false
export let noPadding = false export let noPadding = false
let sidePanelVisible = false let sidePanelVisble = false
setContext("side-panel", { setContext("side-panel", {
open: () => (sidePanelVisible = true), open: () => (sidePanelVisble = true),
close: () => (sidePanelVisible = false), close: () => (sidePanelVisble = false),
}) })
</script> </script>
@ -24,9 +24,9 @@
</div> </div>
<div <div
id="side-panel" id="side-panel"
class:visible={sidePanelVisible} class:visible={sidePanelVisble}
use:clickOutside={() => { use:clickOutside={() => {
sidePanelVisible = false sidePanelVisble = false
}} }}
> >
<slot name="side-panel" /> <slot name="side-panel" />

View File

@ -6723,21 +6723,7 @@
"illegalChildren": ["section", "sidepanel"], "illegalChildren": ["section", "sidepanel"],
"showEmptyState": false, "showEmptyState": false,
"draggable": false, "draggable": false,
"info": "Side panels are hidden by default. They will only be revealed when triggered by the 'Open Side Panel' action.", "info": "Side panels are hidden by default. They will only be revealed when triggered by the 'Open Side Panel' action."
"sendEvents": true,
"settings": [
{
"type": "boolean",
"key": "clickOutsideToClose",
"label": "Click outside to close",
"defaultValue": true
},
{
"type": "event",
"key": "onSidePanelClose",
"label": "On side panel close"
}
]
}, },
"rowexplorer": { "rowexplorer": {
"block": true, "block": true,

View File

@ -73,10 +73,7 @@
$context.device.width, $context.device.width,
$context.device.height $context.device.height
) )
$: autoCloseSidePanel = $: autoCloseSidePanel = !$builderStore.inBuilder && $sidePanelStore.open
!$builderStore.inBuilder &&
$sidePanelStore.open &&
$sidePanelStore.clickOutsideToClose
$: screenId = $builderStore.inBuilder $: screenId = $builderStore.inBuilder
? `${$builderStore.screen?._id}-screen` ? `${$builderStore.screen?._id}-screen`
: "screen" : "screen"

View File

@ -5,9 +5,6 @@
const { styleable, sidePanelStore, builderStore, dndIsDragging } = const { styleable, sidePanelStore, builderStore, dndIsDragging } =
getContext("sdk") getContext("sdk")
export let sidePanelClose
export let clickOutsideToClose
// Automatically show and hide the side panel when inside the builder. // Automatically show and hide the side panel when inside the builder.
// For some unknown reason, svelte reactivity breaks if we reference the // For some unknown reason, svelte reactivity breaks if we reference the
// reactive variable "open" inside the following expression, or if we define // reactive variable "open" inside the following expression, or if we define
@ -29,10 +26,6 @@
} }
} }
$: {
sidePanelStore.actions.setSidepanelState(clickOutsideToClose)
}
// Derive visibility // Derive visibility
$: open = $sidePanelStore.contentId === $component.id $: open = $sidePanelStore.contentId === $component.id
@ -47,12 +40,6 @@
} }
} }
const handleSidePanelClose = async () => {
if (sidePanelClose) {
await sidePanelClose()
}
}
const showInSidePanel = (el, visible) => { const showInSidePanel = (el, visible) => {
const update = visible => { const update = visible => {
const target = document.getElementById("side-panel-container") const target = document.getElementById("side-panel-container")
@ -64,7 +51,6 @@
} else { } else {
if (target.contains(node)) { if (target.contains(node)) {
target.removeChild(node) target.removeChild(node)
handleSidePanelClose()
} }
} }
} }

View File

@ -3,7 +3,6 @@ import { writable, derived } from "svelte/store"
export const createSidePanelStore = () => { export const createSidePanelStore = () => {
const initialState = { const initialState = {
contentId: null, contentId: null,
clickOutsideToClose: true,
} }
const store = writable(initialState) const store = writable(initialState)
const derivedStore = derived(store, $store => { const derivedStore = derived(store, $store => {
@ -33,19 +32,11 @@ export const createSidePanelStore = () => {
}, 50) }, 50)
} }
const setSidepanelState = bool => {
clearTimeout(timeout)
store.update(state => {
state.clickOutsideToClose = bool
return state
})
}
return { return {
subscribe: derivedStore.subscribe, subscribe: derivedStore.subscribe,
actions: { actions: {
open, open,
close, close,
setSidepanelState,
}, },
} }
} }