2019-08-02 15:54:10 +02:00
|
|
|
<script>
|
2020-04-28 15:28:31 +02:00
|
|
|
import { params, goto } from "@sveltech/routify"
|
2020-02-03 10:50:30 +01:00
|
|
|
import ComponentsHierarchyChildren from "./ComponentsHierarchyChildren.svelte"
|
|
|
|
import { last, sortBy, map, trimCharsStart, trimChars, join } from "lodash/fp"
|
2020-03-31 13:16:03 +02:00
|
|
|
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
|
|
|
|
import { pipe } from "components/common/core"
|
|
|
|
import { store } from "builderStore"
|
|
|
|
import { ArrowDownIcon, ShapeIcon } from "components/common/Icons/"
|
2020-02-03 10:50:30 +01:00
|
|
|
|
2020-02-10 16:51:09 +01:00
|
|
|
export let screens = []
|
2020-02-03 10:50:30 +01:00
|
|
|
|
2020-02-18 17:51:28 +01:00
|
|
|
let confirmDeleteDialog
|
|
|
|
let componentToDelete = ""
|
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
const joinPath = join("/")
|
|
|
|
|
|
|
|
const normalizedName = name =>
|
2020-04-28 15:28:31 +02:00
|
|
|
pipe(name, [
|
|
|
|
trimCharsStart("./"),
|
|
|
|
trimCharsStart("~/"),
|
|
|
|
trimCharsStart("../"),
|
|
|
|
trimChars(" "),
|
|
|
|
])
|
2020-02-03 10:50:30 +01:00
|
|
|
|
2020-04-28 15:28:31 +02:00
|
|
|
const changeScreen = screen => {
|
2020-06-04 19:08:50 +02:00
|
|
|
store.setCurrentScreen(screen.props._instanceName)
|
2020-04-28 15:28:31 +02:00
|
|
|
$goto(`./:page/${screen.title}`)
|
|
|
|
}
|
2020-02-03 10:50:30 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="root">
|
2020-06-04 19:08:50 +02:00
|
|
|
{#each screens as screen}
|
2020-02-03 10:50:30 +01:00
|
|
|
<div
|
2020-02-24 16:00:48 +01:00
|
|
|
class="budibase__nav-item component"
|
2020-06-04 19:08:50 +02:00
|
|
|
class:selected={$store.currentComponentInfo._id === screen.props._id}
|
2020-04-28 15:28:31 +02:00
|
|
|
on:click|stopPropagation={() => changeScreen(screen)}>
|
2020-02-03 10:50:30 +01:00
|
|
|
|
|
|
|
<span
|
|
|
|
class="icon"
|
2020-06-04 19:08:50 +02:00
|
|
|
class:rotate={$store.currentPreviewItem.name !== screen.props._instanceName}>
|
|
|
|
{#if screen.props._children.length}
|
2020-02-03 10:50:30 +01:00
|
|
|
<ArrowDownIcon />
|
2020-01-24 12:32:13 +01:00
|
|
|
{/if}
|
2020-02-03 10:50:30 +01:00
|
|
|
</span>
|
|
|
|
|
2020-05-29 19:32:52 +02:00
|
|
|
<i class="ri-artboard-2-fill icon" />
|
2020-02-20 18:11:41 +01:00
|
|
|
|
2020-06-04 19:08:50 +02:00
|
|
|
<span class="title">{screen.props._instanceName}</span>
|
2020-02-03 10:50:30 +01:00
|
|
|
</div>
|
|
|
|
|
2020-06-04 19:08:50 +02:00
|
|
|
{#if $store.currentPreviewItem.props._instanceName && $store.currentPreviewItem.props._instanceName === screen.props._instanceName && screen.props._children}
|
2020-02-03 10:50:30 +01:00
|
|
|
<ComponentsHierarchyChildren
|
2020-06-04 19:08:50 +02:00
|
|
|
components={screen.props._children}
|
2020-06-01 11:25:12 +02:00
|
|
|
currentComponent={$store.currentComponentInfo} />
|
2020-02-03 10:50:30 +01:00
|
|
|
{/if}
|
|
|
|
{/each}
|
2019-08-02 15:54:10 +02:00
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
2020-02-03 10:50:30 +01:00
|
|
|
.root {
|
2020-02-20 18:11:41 +01:00
|
|
|
font-weight: 400;
|
2020-05-29 19:31:47 +02:00
|
|
|
color: var(--ink);
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2019-08-02 15:54:10 +02:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
.title {
|
2019-08-02 15:54:10 +02:00
|
|
|
margin-left: 10px;
|
2020-02-20 18:11:41 +01:00
|
|
|
margin-top: 2px;
|
2020-05-29 19:31:47 +02:00
|
|
|
font-size: 14px;
|
2020-06-01 23:16:12 +02:00
|
|
|
font-weight: 400;
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2019-08-02 15:54:10 +02:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
.icon {
|
2020-01-28 22:17:04 +01:00
|
|
|
display: inline-block;
|
|
|
|
transition: 0.2s;
|
2020-05-29 19:31:47 +02:00
|
|
|
font-size: 24px;
|
2020-02-20 18:11:41 +01:00
|
|
|
width: 20px;
|
|
|
|
margin-top: 2px;
|
2020-05-29 19:31:47 +02:00
|
|
|
color: var(--ink-light);
|
2020-02-20 18:11:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.icon:nth-of-type(2) {
|
|
|
|
width: 14px;
|
|
|
|
margin: 0 0 0 5px;
|
|
|
|
}
|
|
|
|
|
|
|
|
:global(svg) {
|
|
|
|
transition: 0.2s;
|
|
|
|
}
|
|
|
|
|
|
|
|
.rotate :global(svg) {
|
|
|
|
transform: rotate(-90deg);
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2020-01-20 17:47:35 +01:00
|
|
|
</style>
|