Update side panel transition to be much smoother
This commit is contained in:
parent
835ab5dab4
commit
76cec34343
|
@ -356,21 +356,21 @@
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 30px;
|
gap: 30px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
transition: margin-right 130ms ease-out;
|
transition: transform 130ms ease-out;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 400px;
|
width: 400px;
|
||||||
right: 0;
|
right: 0;
|
||||||
margin-right: -400px;
|
transform: translateX(100%);
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
#side-panel-container.builder {
|
#side-panel-container.builder {
|
||||||
margin-right: 0;
|
transform: translateX(0);
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
#side-panel-container.open {
|
#side-panel-container.open {
|
||||||
|
transform: translateX(0);
|
||||||
box-shadow: 0 0 40px 10px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 0 40px 10px rgba(0, 0, 0, 0.1);
|
||||||
margin-right: 0;
|
|
||||||
}
|
}
|
||||||
#side-panel-container.builder.open {
|
#side-panel-container.builder.open {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
<script>
|
<script>
|
||||||
import { getContext, onDestroy } from "svelte"
|
import { getContext } from "svelte"
|
||||||
|
|
||||||
const component = getContext("component")
|
const component = getContext("component")
|
||||||
const { styleable, sidePanelStore, builderStore, dndIsDragging } =
|
const { styleable, sidePanelStore, builderStore, dndIsDragging } =
|
||||||
getContext("sdk")
|
getContext("sdk")
|
||||||
|
|
||||||
let renderContent = false
|
|
||||||
let contentTimeout
|
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -32,18 +29,6 @@
|
||||||
// Derive visibility
|
// Derive visibility
|
||||||
$: open = $sidePanelStore.contentId === $component.id
|
$: open = $sidePanelStore.contentId === $component.id
|
||||||
|
|
||||||
// When we hide the side panel we want to kick off a short timeout which will
|
|
||||||
// eventually hide the content. We don't do this immediately as this causes
|
|
||||||
// things like cycling through a table to constantly remount the side panel
|
|
||||||
// contents.
|
|
||||||
$: updateContentVisibility(open)
|
|
||||||
const updateContentVisibility = open => {
|
|
||||||
clearTimeout(contentTimeout)
|
|
||||||
contentTimeout = setTimeout(() => {
|
|
||||||
renderContent = open
|
|
||||||
}, 130)
|
|
||||||
}
|
|
||||||
|
|
||||||
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,10 +49,6 @@
|
||||||
|
|
||||||
return { update }
|
return { update }
|
||||||
}
|
}
|
||||||
|
|
||||||
onDestroy(() => {
|
|
||||||
clearTimeout(contentTimeout)
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
@ -76,9 +57,7 @@
|
||||||
class="side-panel"
|
class="side-panel"
|
||||||
class:open
|
class:open
|
||||||
>
|
>
|
||||||
{#if renderContent}
|
<slot />
|
||||||
<slot />
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
$: editTitle = getEditTitle(detailsFormBlockId, primaryDisplay)
|
$: editTitle = getEditTitle(detailsFormBlockId, primaryDisplay)
|
||||||
$: normalFields = getNormalFields(schema)
|
$: normalFields = getNormalFields(schema)
|
||||||
$: rowClickActions =
|
$: rowClickActions =
|
||||||
clickBehaviour === "actions"
|
clickBehaviour === "actions" || dataSource?.type !== "table"
|
||||||
? onClick
|
? onClick
|
||||||
: [
|
: [
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
$: buttonClickActions =
|
$: buttonClickActions =
|
||||||
titleButtonClickBehaviour === "actions"
|
clickBehaviour === "actions" || dataSource?.type !== "table"
|
||||||
? onClickTitleButton
|
? onClickTitleButton
|
||||||
: [
|
: [
|
||||||
{
|
{
|
||||||
|
@ -108,7 +108,8 @@
|
||||||
return "Edit"
|
return "Edit"
|
||||||
}
|
}
|
||||||
const prefix = safe(detailsFormBlockId + "-repeater")
|
const prefix = safe(detailsFormBlockId + "-repeater")
|
||||||
return `{{ ${prefix}.${safe(primaryDisplay)} }}`
|
const binding = `${prefix}.${safe(primaryDisplay)}`
|
||||||
|
return `{{#if ${binding}}}{{${binding}}}{{else}}Details{{/if}}`
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue