Merge branch 'master' into flatpickr-cleanup
This commit is contained in:
commit
58bd3506a8
|
@ -7,11 +7,11 @@
|
||||||
export let narrower = false
|
export let narrower = false
|
||||||
export let noPadding = false
|
export let noPadding = false
|
||||||
|
|
||||||
let sidePanelVisble = false
|
let sidePanelVisible = false
|
||||||
|
|
||||||
setContext("side-panel", {
|
setContext("side-panel", {
|
||||||
open: () => (sidePanelVisble = true),
|
open: () => (sidePanelVisible = true),
|
||||||
close: () => (sidePanelVisble = false),
|
close: () => (sidePanelVisible = false),
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -24,9 +24,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
id="side-panel"
|
id="side-panel"
|
||||||
class:visible={sidePanelVisble}
|
class:visible={sidePanelVisible}
|
||||||
use:clickOutside={() => {
|
use:clickOutside={() => {
|
||||||
sidePanelVisble = false
|
sidePanelVisible = false
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<slot name="side-panel" />
|
<slot name="side-panel" />
|
||||||
|
|
|
@ -6717,7 +6717,20 @@
|
||||||
"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.",
|
||||||
|
"settings": [
|
||||||
|
{
|
||||||
|
"type": "boolean",
|
||||||
|
"key": "ignoreClicksOutside",
|
||||||
|
"label": "Ignore clicks outside",
|
||||||
|
"defaultValue": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "event",
|
||||||
|
"key": "onClose",
|
||||||
|
"label": "On close"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"rowexplorer": {
|
"rowexplorer": {
|
||||||
"block": true,
|
"block": true,
|
||||||
|
|
|
@ -73,7 +73,10 @@
|
||||||
$context.device.width,
|
$context.device.width,
|
||||||
$context.device.height
|
$context.device.height
|
||||||
)
|
)
|
||||||
$: autoCloseSidePanel = !$builderStore.inBuilder && $sidePanelStore.open
|
$: autoCloseSidePanel =
|
||||||
|
!$builderStore.inBuilder &&
|
||||||
|
$sidePanelStore.open &&
|
||||||
|
!$sidePanelStore.ignoreClicksOutside
|
||||||
$: screenId = $builderStore.inBuilder
|
$: screenId = $builderStore.inBuilder
|
||||||
? `${$builderStore.screen?._id}-screen`
|
? `${$builderStore.screen?._id}-screen`
|
||||||
: "screen"
|
: "screen"
|
||||||
|
@ -191,6 +194,11 @@
|
||||||
}
|
}
|
||||||
return url
|
return url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleClickLink = () => {
|
||||||
|
mobileOpen = false
|
||||||
|
sidePanelStore.actions.close()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
||||||
|
@ -281,7 +289,7 @@
|
||||||
url={navItem.url}
|
url={navItem.url}
|
||||||
subLinks={navItem.subLinks}
|
subLinks={navItem.subLinks}
|
||||||
internalLink={navItem.internalLink}
|
internalLink={navItem.internalLink}
|
||||||
on:clickLink={() => (mobileOpen = false)}
|
on:clickLink={handleClickLink}
|
||||||
leftNav={navigation === "Left"}
|
leftNav={navigation === "Left"}
|
||||||
{mobile}
|
{mobile}
|
||||||
{navStateStore}
|
{navStateStore}
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
const { styleable, sidePanelStore, builderStore, dndIsDragging } =
|
const { styleable, sidePanelStore, builderStore, dndIsDragging } =
|
||||||
getContext("sdk")
|
getContext("sdk")
|
||||||
|
|
||||||
|
export let onClose
|
||||||
|
export let ignoreClicksOutside
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -26,6 +29,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// $: {
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
// Derive visibility
|
// Derive visibility
|
||||||
$: open = $sidePanelStore.contentId === $component.id
|
$: open = $sidePanelStore.contentId === $component.id
|
||||||
|
|
||||||
|
@ -36,10 +43,17 @@
|
||||||
let renderKey = null
|
let renderKey = null
|
||||||
$: {
|
$: {
|
||||||
if (open) {
|
if (open) {
|
||||||
|
sidePanelStore.actions.setIgnoreClicksOutside(ignoreClicksOutside)
|
||||||
renderKey = Math.random()
|
renderKey = Math.random()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleSidePanelClose = async () => {
|
||||||
|
if (onClose) {
|
||||||
|
await onClose()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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")
|
||||||
|
@ -51,6 +65,7 @@
|
||||||
} else {
|
} else {
|
||||||
if (target.contains(node)) {
|
if (target.contains(node)) {
|
||||||
target.removeChild(node)
|
target.removeChild(node)
|
||||||
|
handleSidePanelClose()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { writable, derived } from "svelte/store"
|
||||||
export const createSidePanelStore = () => {
|
export const createSidePanelStore = () => {
|
||||||
const initialState = {
|
const initialState = {
|
||||||
contentId: null,
|
contentId: null,
|
||||||
|
ignoreClicksOutside: true,
|
||||||
}
|
}
|
||||||
const store = writable(initialState)
|
const store = writable(initialState)
|
||||||
const derivedStore = derived(store, $store => {
|
const derivedStore = derived(store, $store => {
|
||||||
|
@ -32,11 +33,18 @@ export const createSidePanelStore = () => {
|
||||||
}, 50)
|
}, 50)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const setIgnoreClicksOutside = bool => {
|
||||||
|
store.update(state => {
|
||||||
|
state.ignoreClicksOutside = bool
|
||||||
|
return state
|
||||||
|
})
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
subscribe: derivedStore.subscribe,
|
subscribe: derivedStore.subscribe,
|
||||||
actions: {
|
actions: {
|
||||||
open,
|
open,
|
||||||
close,
|
close,
|
||||||
|
setIgnoreClicksOutside,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,6 +240,7 @@ const triggerAutomationHandler = async action => {
|
||||||
const navigationHandler = action => {
|
const navigationHandler = action => {
|
||||||
const { url, peek, externalNewTab } = action.parameters
|
const { url, peek, externalNewTab } = action.parameters
|
||||||
routeStore.actions.navigate(url, peek, externalNewTab)
|
routeStore.actions.navigate(url, peek, externalNewTab)
|
||||||
|
closeSidePanelHandler()
|
||||||
}
|
}
|
||||||
|
|
||||||
const queryExecutionHandler = async action => {
|
const queryExecutionHandler = async action => {
|
||||||
|
|
Loading…
Reference in New Issue