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 ComponentsHierarchyChildren from "./ComponentsHierarchyChildren.svelte"
|
2020-10-22 18:42:03 +02:00
|
|
|
import NavItem from "components/common/NavItem.svelte"
|
|
|
|
import { last } from "lodash/fp"
|
2020-03-31 13:16:03 +02:00
|
|
|
import { store } from "builderStore"
|
2020-08-13 11:15:37 +02:00
|
|
|
import { writable } from "svelte/store"
|
2020-02-20 18:11:41 +01:00
|
|
|
|
|
|
|
export let layout
|
|
|
|
|
|
|
|
let confirmDeleteDialog
|
|
|
|
let componentToDelete = ""
|
|
|
|
|
2020-08-13 11:15:37 +02:00
|
|
|
const dragDropStore = writable({})
|
2020-02-20 18:11:41 +01:00
|
|
|
|
2020-10-22 18:42:03 +02:00
|
|
|
const lastPartOfName = (c) =>
|
2020-02-20 18:11:41 +01:00
|
|
|
c && last(c.name ? c.name.split("/") : c._component.split("/"))
|
|
|
|
|
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-10-22 18:42:03 +02:00
|
|
|
<NavItem
|
|
|
|
border={false}
|
|
|
|
icon="ri-layout-3-line"
|
|
|
|
text="Master Screen"
|
|
|
|
withArrow
|
|
|
|
selected={$store.currentComponentInfo._id === _layout.component.props._id}
|
|
|
|
opened={$store.currentPreviewItem.name === _layout.title}
|
|
|
|
on:click={setCurrentScreenToLayout} />
|
2020-06-01 23:16:55 +02:00
|
|
|
|
|
|
|
{#if $store.currentPreviewItem.name === _layout.title && _layout.component.props._children}
|
|
|
|
<ComponentsHierarchyChildren
|
|
|
|
thisComponent={_layout.component.props}
|
|
|
|
components={_layout.component.props._children}
|
2020-08-13 11:15:37 +02:00
|
|
|
currentComponent={$store.currentComponentInfo}
|
|
|
|
{dragDropStore} />
|
2020-06-01 23:16:55 +02:00
|
|
|
{/if}
|