2020-02-20 18:11:41 +01:00
|
|
|
<script>
|
2020-04-28 15:28:31 +02:00
|
|
|
import { goto } from "@sveltech/routify"
|
2020-02-20 18:11:41 +01:00
|
|
|
// import { tick } from "svelte"
|
|
|
|
import ComponentsHierarchyChildren from "./ComponentsHierarchyChildren.svelte"
|
|
|
|
|
2020-05-07 11:53:34 +02:00
|
|
|
import {
|
|
|
|
last,
|
|
|
|
sortBy,
|
|
|
|
map,
|
|
|
|
trimCharsStart,
|
|
|
|
trimChars,
|
|
|
|
join,
|
|
|
|
compose,
|
|
|
|
} 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, GridIcon } from "components/common/Icons/"
|
2020-02-20 18:11:41 +01:00
|
|
|
|
|
|
|
export let layout
|
|
|
|
|
|
|
|
let confirmDeleteDialog
|
|
|
|
let componentToDelete = ""
|
|
|
|
|
|
|
|
const joinPath = join("/")
|
|
|
|
|
|
|
|
const lastPartOfName = c =>
|
|
|
|
c && last(c.name ? c.name.split("/") : c._component.split("/"))
|
|
|
|
|
|
|
|
const isComponentSelected = (current, comp) => current === comp
|
|
|
|
|
2020-05-02 16:29:10 +02:00
|
|
|
$: _layout = {
|
|
|
|
component: layout,
|
2020-05-07 11:53:34 +02:00
|
|
|
title: lastPartOfName(layout),
|
2020-05-02 16:29:10 +02:00
|
|
|
}
|
2020-02-20 18:11:41 +01:00
|
|
|
|
2020-04-28 15:28:31 +02:00
|
|
|
const setCurrentScreenToLayout = () => {
|
|
|
|
store.setScreenType("page")
|
|
|
|
$goto("./:page/page-layout")
|
|
|
|
}
|
2020-02-20 18:11:41 +01:00
|
|
|
</script>
|
|
|
|
|
2020-06-01 23:16:55 +02:00
|
|
|
<div
|
|
|
|
class="budibase__nav-item root"
|
|
|
|
class:selected={$store.currentComponentInfo._id === _layout.component.props._id}
|
|
|
|
on:click|stopPropagation={setCurrentScreenToLayout}>
|
|
|
|
<span
|
|
|
|
class="icon"
|
|
|
|
class:rotate={$store.currentPreviewItem.name !== _layout.title}>
|
|
|
|
<ArrowDownIcon />
|
|
|
|
</span>
|
|
|
|
<i class="ri-layout-3-fill icon-big" />
|
|
|
|
<span class="title">Master Screen</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{#if $store.currentPreviewItem.name === _layout.title && _layout.component.props._children}
|
|
|
|
<ComponentsHierarchyChildren
|
|
|
|
thisComponent={_layout.component.props}
|
|
|
|
components={_layout.component.props._children}
|
|
|
|
currentComponent={$store.currentComponentInfo} />
|
|
|
|
{/if}
|
2020-02-20 18:11:41 +01:00
|
|
|
|
|
|
|
<style>
|
|
|
|
.title {
|
|
|
|
margin-left: 10px;
|
2020-05-29 19:31:47 +02:00
|
|
|
font-size: 14px;
|
2020-06-01 23:16:12 +02:00
|
|
|
font-weight: 400;
|
2020-05-29 19:31:47 +02:00
|
|
|
color: var(--ink);
|
2020-02-20 18:11:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.icon {
|
2020-05-29 19:31:47 +02:00
|
|
|
width: 24px;
|
2020-02-20 18:11:41 +01:00
|
|
|
display: inline-block;
|
|
|
|
transition: 0.2s;
|
|
|
|
width: 20px;
|
2020-06-23 09:19:16 +02:00
|
|
|
color: var(--grey-7);
|
2020-02-20 18:11:41 +01:00
|
|
|
}
|
|
|
|
|
2020-05-29 19:31:47 +02:00
|
|
|
.icon-big {
|
2020-06-23 22:29:18 +02:00
|
|
|
font-size: 20px;
|
2020-06-23 09:19:16 +02:00
|
|
|
color: var(--grey-7);
|
2020-02-20 18:11:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
:global(svg) {
|
|
|
|
transition: 0.2s;
|
|
|
|
}
|
|
|
|
|
|
|
|
.rotate :global(svg) {
|
|
|
|
transform: rotate(-90deg);
|
|
|
|
}
|
|
|
|
</style>
|