tidy up
This commit is contained in:
parent
4466923c84
commit
f386d0c72b
|
@ -51,7 +51,6 @@
|
||||||
const screens = screenTemplates($store, [table])
|
const screens = screenTemplates($store, [table])
|
||||||
.filter(template => defaultScreens.includes(template.id))
|
.filter(template => defaultScreens.includes(template.id))
|
||||||
.map(template => template.create())
|
.map(template => template.create())
|
||||||
store.actions.layouts.select("main")
|
|
||||||
for (let screen of screens) {
|
for (let screen of screens) {
|
||||||
// Record the table that created this screen so we can link it later
|
// Record the table that created this screen so we can link it later
|
||||||
screen.autoTableId = table._id
|
screen.autoTableId = table._id
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
const selectComponent = component => {
|
const selectComponent = component => {
|
||||||
store.actions.components.select(component)
|
store.actions.components.select(component)
|
||||||
const path = store.actions.components.findRoute(component)
|
const path = store.actions.components.findRoute(component)
|
||||||
$goto(`./:screen/${path}`)
|
// $goto(`./:screen/${path}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const moveUpComponent = () => {
|
const moveUpComponent = () => {
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
import { goto } from "@sveltech/routify"
|
import { goto } from "@sveltech/routify"
|
||||||
import { store } from "builderStore"
|
import { store } from "builderStore"
|
||||||
import { getComponentDefinition } from "builderStore/storeUtils"
|
import { getComponentDefinition } from "builderStore/storeUtils"
|
||||||
import initDragDropStore, { DropEffect, DropPosition } from "./dragDropStore"
|
import { DropEffect, DropPosition } from "./dragDropStore"
|
||||||
import ComponentDropdownMenu from "../ComponentDropdownMenu.svelte"
|
import ComponentDropdownMenu from "../ComponentDropdownMenu.svelte"
|
||||||
import NavItem from "components/common/NavItem.svelte"
|
import NavItem from "components/common/NavItem.svelte"
|
||||||
|
|
||||||
|
export let layout
|
||||||
export let components = []
|
export let components = []
|
||||||
export let currentComponent
|
export let currentComponent
|
||||||
export let onSelect = () => {}
|
export let onSelect = () => {}
|
||||||
export let level = 0
|
export let level = 0
|
||||||
|
export let dragDropStore
|
||||||
export let dragDropStore = initDragDropStore()
|
|
||||||
|
|
||||||
const isScreenslot = name => name === "##builtin/screenslot"
|
const isScreenslot = name => name === "##builtin/screenslot"
|
||||||
|
|
||||||
|
@ -23,12 +23,11 @@
|
||||||
const path = store.actions.components.findRoute(component)
|
const path = store.actions.components.findRoute(component)
|
||||||
|
|
||||||
// Go to correct URL
|
// Go to correct URL
|
||||||
$goto(`./${path}`)
|
if (layout) {
|
||||||
// if (layout) {
|
$goto(`./layouts/${path}`)
|
||||||
// $goto(`./layouts/:layout/${path}`)
|
} else {
|
||||||
// } else {
|
$goto(`./screens/${path}`)
|
||||||
// $goto(`./screens/:screen/${path}`)
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const dragstart = component => e => {
|
const dragstart = component => e => {
|
||||||
|
@ -84,6 +83,7 @@
|
||||||
|
|
||||||
{#if component._children}
|
{#if component._children}
|
||||||
<svelte:self
|
<svelte:self
|
||||||
|
{layout}
|
||||||
components={component._children}
|
components={component._children}
|
||||||
{currentComponent}
|
{currentComponent}
|
||||||
{onSelect}
|
{onSelect}
|
||||||
|
|
|
@ -4,10 +4,12 @@
|
||||||
import { store } from "builderStore"
|
import { store } from "builderStore"
|
||||||
import instantiateStore from "./dragDropStore"
|
import instantiateStore from "./dragDropStore"
|
||||||
|
|
||||||
import ComponentsTree from "./ComponentTree.svelte"
|
import ComponentTree from "./ComponentTree.svelte"
|
||||||
import NavItem from "components/common/NavItem.svelte"
|
import NavItem from "components/common/NavItem.svelte"
|
||||||
import ScreenDropdownMenu from "./ScreenDropdownMenu.svelte"
|
import ScreenDropdownMenu from "./ScreenDropdownMenu.svelte"
|
||||||
|
|
||||||
|
const dragDropStore = instantiateStore();
|
||||||
|
|
||||||
export let route
|
export let route
|
||||||
export let path
|
export let path
|
||||||
export let indent
|
export let indent
|
||||||
|
@ -37,12 +39,13 @@
|
||||||
text={url === '/' ? 'Home' : url}
|
text={url === '/' ? 'Home' : url}
|
||||||
withArrow={route.subpaths}
|
withArrow={route.subpaths}
|
||||||
on:click={() => changeScreen(screenId)}>
|
on:click={() => changeScreen(screenId)}>
|
||||||
<ScreenDropdownMenu screenId={screenId} />
|
<ScreenDropdownMenu {screenId} />
|
||||||
</NavItem>
|
</NavItem>
|
||||||
{#if selectedScreen?._id === screenId}
|
{#if selectedScreen?._id === screenId}
|
||||||
<ComponentsTree
|
<ComponentTree
|
||||||
components={selectedScreen.props._children}
|
components={selectedScreen.props._children}
|
||||||
currentComponent={$store.currentComponentInfo}
|
currentComponent={$store.currentComponentInfo}
|
||||||
|
{dragDropStore}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
@ -48,7 +48,7 @@ export default function() {
|
||||||
if (mousePosition > 0.4 && mousePosition < 0.8) {
|
if (mousePosition > 0.4 && mousePosition < 0.8) {
|
||||||
state.dropPosition = DropPosition.INSIDE
|
state.dropPosition = DropPosition.INSIDE
|
||||||
}
|
}
|
||||||
return
|
return state
|
||||||
}
|
}
|
||||||
|
|
||||||
// bottom half
|
// bottom half
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
const onComponentChosen = component => {
|
const onComponentChosen = component => {
|
||||||
store.actions.components.create(component._component, component.presetProps)
|
store.actions.components.create(component._component, component.presetProps)
|
||||||
const path = store.actions.components.findRoute($store.currentComponentInfo)
|
const path = store.actions.components.findRoute($store.currentComponentInfo)
|
||||||
$goto(`./:screen/${path}`)
|
// $goto(`./:screen/${path}`)
|
||||||
// $goto(`./${path}`)
|
// $goto(`./${path}`)
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import { goto } from "@sveltech/routify"
|
import { goto } from "@sveltech/routify"
|
||||||
import { FrontendTypes } from "constants"
|
import { FrontendTypes } from "constants"
|
||||||
import ComponentTree from "./ComponentNavigationTree/ComponentTree.svelte"
|
import ComponentTree from "./ComponentNavigationTree/ComponentTree.svelte"
|
||||||
|
import initDragDropStore from "./ComponentNavigationTree/dragDropStore"
|
||||||
import NavItem from "components/common/NavItem.svelte"
|
import NavItem from "components/common/NavItem.svelte"
|
||||||
import { last } from "lodash/fp"
|
import { last } from "lodash/fp"
|
||||||
import { store, currentAsset } from "builderStore"
|
import { store, currentAsset } from "builderStore"
|
||||||
|
@ -12,7 +13,7 @@
|
||||||
let confirmDeleteDialog
|
let confirmDeleteDialog
|
||||||
let componentToDelete = ""
|
let componentToDelete = ""
|
||||||
|
|
||||||
const dragDropStore = writable({})
|
const dragDropStore = initDragDropStore();
|
||||||
|
|
||||||
const setCurrentScreenToLayout = () => {
|
const setCurrentScreenToLayout = () => {
|
||||||
store.actions.selectAssetType(FrontendTypes.LAYOUT)
|
store.actions.selectAssetType(FrontendTypes.LAYOUT)
|
||||||
|
@ -31,7 +32,7 @@
|
||||||
|
|
||||||
{#if $currentAsset._id === layout._id && layout.props._children}
|
{#if $currentAsset._id === layout._id && layout.props._children}
|
||||||
<ComponentTree
|
<ComponentTree
|
||||||
layout
|
layout={true}
|
||||||
components={layout.props._children}
|
components={layout.props._children}
|
||||||
currentComponent={$store.currentComponentInfo}
|
currentComponent={$store.currentComponentInfo}
|
||||||
{dragDropStore} />
|
{dragDropStore} />
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
if (!$store.currentAssetId) {
|
if (!$store.currentAssetId) {
|
||||||
// refactor so the right layout is chosen
|
// refactor so the right layout is chosen
|
||||||
store.actions.layouts.select($params.layout || "main")
|
store.actions.layouts.select($params.layout)
|
||||||
}
|
}
|
||||||
|
|
||||||
const changeLayout = id => {
|
const changeLayout = id => {
|
||||||
|
|
Loading…
Reference in New Issue