add setup to go to page-layout screen
This commit is contained in:
parent
6cc8d7982e
commit
eb1d2dc337
|
@ -1,4 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
|
import { params, goto } from "@sveltech/routify"
|
||||||
import ComponentsHierarchyChildren from "./ComponentsHierarchyChildren.svelte"
|
import ComponentsHierarchyChildren from "./ComponentsHierarchyChildren.svelte"
|
||||||
|
|
||||||
import { last, sortBy, map, trimCharsStart, trimChars, join } from "lodash/fp"
|
import { last, sortBy, map, trimCharsStart, trimChars, join } from "lodash/fp"
|
||||||
|
@ -15,15 +16,12 @@
|
||||||
const joinPath = join("/")
|
const joinPath = join("/")
|
||||||
|
|
||||||
const normalizedName = name =>
|
const normalizedName = name =>
|
||||||
pipe(
|
pipe(name, [
|
||||||
name,
|
|
||||||
[
|
|
||||||
trimCharsStart("./"),
|
trimCharsStart("./"),
|
||||||
trimCharsStart("~/"),
|
trimCharsStart("~/"),
|
||||||
trimCharsStart("../"),
|
trimCharsStart("../"),
|
||||||
trimChars(" "),
|
trimChars(" "),
|
||||||
]
|
])
|
||||||
)
|
|
||||||
|
|
||||||
const lastPartOfName = c => {
|
const lastPartOfName = c => {
|
||||||
if (!c) return ""
|
if (!c) return ""
|
||||||
|
@ -35,10 +33,10 @@
|
||||||
|
|
||||||
const isFolderSelected = (current, folder) => isInSubfolder(current, folder)
|
const isFolderSelected = (current, folder) => isInSubfolder(current, folder)
|
||||||
|
|
||||||
$: _screens = pipe(
|
$: _screens = pipe(screens, [
|
||||||
screens,
|
map(c => ({ component: c, title: lastPartOfName(c) })),
|
||||||
[map(c => ({ component: c, title: lastPartOfName(c) })), sortBy("title")]
|
sortBy("title"),
|
||||||
)
|
])
|
||||||
|
|
||||||
const isScreenSelected = component =>
|
const isScreenSelected = component =>
|
||||||
component.component &&
|
component.component &&
|
||||||
|
@ -49,6 +47,14 @@
|
||||||
componentToDelete = component
|
componentToDelete = component
|
||||||
confirmDeleteDialog.show()
|
confirmDeleteDialog.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const changeScreen = screen => {
|
||||||
|
console.log("Screen: ", screen)
|
||||||
|
store.setCurrentScreen(screen.title)
|
||||||
|
$goto(`./:page/${screen.title}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
$: console.log("Params: ", $params)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="root">
|
<div class="root">
|
||||||
|
@ -57,7 +63,7 @@
|
||||||
<div
|
<div
|
||||||
class="budibase__nav-item component"
|
class="budibase__nav-item component"
|
||||||
class:selected={$store.currentComponentInfo._id === screen.component.props._id}
|
class:selected={$store.currentComponentInfo._id === screen.component.props._id}
|
||||||
on:click|stopPropagation={() => store.setCurrentScreen(screen.title)}>
|
on:click|stopPropagation={() => changeScreen(screen)}>
|
||||||
|
|
||||||
<span
|
<span
|
||||||
class="icon"
|
class="icon"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
|
import { goto } from "@sveltech/routify"
|
||||||
// import { tick } from "svelte"
|
// import { tick } from "svelte"
|
||||||
import ComponentsHierarchyChildren from "./ComponentsHierarchyChildren.svelte"
|
import ComponentsHierarchyChildren from "./ComponentsHierarchyChildren.svelte"
|
||||||
|
|
||||||
|
@ -16,15 +17,12 @@
|
||||||
const joinPath = join("/")
|
const joinPath = join("/")
|
||||||
|
|
||||||
const normalizedName = name =>
|
const normalizedName = name =>
|
||||||
pipe(
|
pipe(name, [
|
||||||
name,
|
|
||||||
[
|
|
||||||
trimCharsStart("./"),
|
trimCharsStart("./"),
|
||||||
trimCharsStart("~/"),
|
trimCharsStart("~/"),
|
||||||
trimCharsStart("../"),
|
trimCharsStart("../"),
|
||||||
trimChars(" "),
|
trimChars(" "),
|
||||||
]
|
])
|
||||||
)
|
|
||||||
|
|
||||||
const lastPartOfName = c =>
|
const lastPartOfName = c =>
|
||||||
c && last(c.name ? c.name.split("/") : c._component.split("/"))
|
c && last(c.name ? c.name.split("/") : c._component.split("/"))
|
||||||
|
@ -33,10 +31,7 @@
|
||||||
|
|
||||||
const isFolderSelected = (current, folder) => isInSubfolder(current, folder)
|
const isFolderSelected = (current, folder) => isInSubfolder(current, folder)
|
||||||
|
|
||||||
$: _layout = pipe(
|
$: _layout = pipe(layout, [c => ({ component: c, title: lastPartOfName(c) })])
|
||||||
layout,
|
|
||||||
[c => ({ component: c, title: lastPartOfName(c) })]
|
|
||||||
)
|
|
||||||
|
|
||||||
const isScreenSelected = component =>
|
const isScreenSelected = component =>
|
||||||
component.component &&
|
component.component &&
|
||||||
|
@ -48,6 +43,11 @@
|
||||||
// await tick()
|
// await tick()
|
||||||
confirmDeleteDialog.show()
|
confirmDeleteDialog.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const setCurrentScreenToLayout = () => {
|
||||||
|
store.setScreenType("page")
|
||||||
|
$goto("./:page/page-layout")
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="pagelayoutSection">
|
<div class="pagelayoutSection">
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
<div
|
<div
|
||||||
class="budibase__nav-item root"
|
class="budibase__nav-item root"
|
||||||
class:selected={$store.currentComponentInfo._id === _layout.component.props._id}
|
class:selected={$store.currentComponentInfo._id === _layout.component.props._id}
|
||||||
on:click|stopPropagation={() => store.setScreenType('page')}>
|
on:click|stopPropagation={setCurrentScreenToLayout}>
|
||||||
<span
|
<span
|
||||||
class="icon"
|
class="icon"
|
||||||
class:rotate={$store.currentPreviewItem.name !== _layout.title}>
|
class:rotate={$store.currentPreviewItem.name !== _layout.title}>
|
||||||
|
@ -100,12 +100,10 @@
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.pagelayoutSection {
|
.pagelayoutSection {
|
||||||
margin: 20px 0px 20px 0px;
|
margin: 20px 0px 20px 0px;
|
||||||
}
|
}
|
||||||
.root {
|
.root {
|
||||||
|
|
||||||
}
|
}
|
||||||
.title {
|
.title {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
<script>
|
|
||||||
import { leftover } from "@sveltech/routify"
|
|
||||||
|
|
||||||
const structure = $leftover.split("/")
|
|
||||||
|
|
||||||
console.log(structure)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
CREEN FALLBACK THINGIE!
|
|
|
@ -1,7 +0,0 @@
|
||||||
<script>
|
|
||||||
import { params } from "@sveltech/routify"
|
|
||||||
|
|
||||||
console.log($params)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<slot />
|
|
Loading…
Reference in New Issue