Revert "Fixes for Screen and Page Props"
This commit is contained in:
parent
9adf9ee7bf
commit
35aa2d341a
|
@ -69,7 +69,6 @@ export const getStore = () => {
|
||||||
store.getPathToComponent = getPathToComponent(store)
|
store.getPathToComponent = getPathToComponent(store)
|
||||||
store.addTemplatedComponent = addTemplatedComponent(store)
|
store.addTemplatedComponent = addTemplatedComponent(store)
|
||||||
store.setMetadataProp = setMetadataProp(store)
|
store.setMetadataProp = setMetadataProp(store)
|
||||||
store.editPageOrScreen = editPageOrScreen(store)
|
|
||||||
return store
|
return store
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,15 +171,6 @@ const createScreen = store => (screenName, route, layoutComponentName) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const editPageOrScreen = store => (key, value) => {
|
|
||||||
store.update(state => {
|
|
||||||
state.currentPreviewItem[key] = value
|
|
||||||
_saveCurrentPreviewItem(state)
|
|
||||||
|
|
||||||
return state
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const setCurrentScreen = store => screenName => {
|
const setCurrentScreen = store => screenName => {
|
||||||
store.update(s => {
|
store.update(s => {
|
||||||
const screen = getExactComponent(s.screens, screenName)
|
const screen = getExactComponent(s.screens, screenName)
|
||||||
|
@ -295,7 +285,6 @@ const setCurrentPage = store => pageName => {
|
||||||
|
|
||||||
state.currentFrontEndType = "page"
|
state.currentFrontEndType = "page"
|
||||||
state.currentPageName = pageName
|
state.currentPageName = pageName
|
||||||
state.currentView = "detail"
|
|
||||||
state.screens = Array.isArray(current_screens)
|
state.screens = Array.isArray(current_screens)
|
||||||
? current_screens
|
? current_screens
|
||||||
: Object.values(current_screens)
|
: Object.values(current_screens)
|
||||||
|
@ -456,7 +445,6 @@ const setScreenType = store => type => {
|
||||||
|
|
||||||
state.currentComponentInfo = pageOrScreen ? pageOrScreen.props : null
|
state.currentComponentInfo = pageOrScreen ? pageOrScreen.props : null
|
||||||
state.currentPreviewItem = pageOrScreen
|
state.currentPreviewItem = pageOrScreen
|
||||||
state.currentView = "detail"
|
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
import { setContext, onMount } from "svelte"
|
import { setContext, onMount } from "svelte"
|
||||||
import {screen, page} from "./propertyCategories.js"
|
|
||||||
import PropsView from "./PropsView.svelte"
|
import PropsView from "./PropsView.svelte"
|
||||||
import { store } from "builderStore"
|
import { store } from "builderStore"
|
||||||
import IconButton from "components/common/IconButton.svelte"
|
import IconButton from "components/common/IconButton.svelte"
|
||||||
|
@ -31,6 +30,7 @@
|
||||||
let selectedCategory = categories[0]
|
let selectedCategory = categories[0]
|
||||||
|
|
||||||
$: components = $store.components
|
$: components = $store.components
|
||||||
|
$: componentInstance = $store.currentComponentInfo
|
||||||
$: componentDefinition = $store.components[componentInstance._component]
|
$: componentDefinition = $store.components[componentInstance._component]
|
||||||
$: componentPropDefinition =
|
$: componentPropDefinition =
|
||||||
flattenedPanel.find(
|
flattenedPanel.find(
|
||||||
|
@ -38,37 +38,18 @@
|
||||||
c => c._component === componentInstance._component
|
c => c._component === componentInstance._component
|
||||||
) || {}
|
) || {}
|
||||||
|
|
||||||
|
$: panelDefinition = componentPropDefinition.properties
|
||||||
|
? componentPropDefinition.properties[selectedCategory.value]
|
||||||
|
: {}
|
||||||
|
|
||||||
let panelDefinition = {}
|
// SCREEN PROPS =============================================
|
||||||
|
$: screen_props =
|
||||||
$: {
|
$store.currentFrontEndType === "page"
|
||||||
if(componentPropDefinition.properties) {
|
? getProps($store.currentPreviewItem, ["name", "favicon"])
|
||||||
if(selectedCategory.value === "design") {
|
: getProps($store.currentPreviewItem, ["name", "description", "route"])
|
||||||
panelDefinition = componentPropDefinition.properties["design"]
|
|
||||||
}else{
|
|
||||||
let panelDef = componentPropDefinition.properties["settings"]
|
|
||||||
if($store.currentFrontEndType === "page") {
|
|
||||||
panelDefinition = [...page,...panelDef]
|
|
||||||
}else if($store.currentFrontEndType === "screen" && $store.currentView !== "component") {
|
|
||||||
panelDefinition = [...screen, ...panelDef]
|
|
||||||
}else {
|
|
||||||
panelDefinition = panelDef
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$: componentInstance = $store.currentView !== "component" ? {...$store.currentPreviewItem, ...$store.currentComponentInfo} : $store.currentComponentInfo
|
|
||||||
|
|
||||||
const onStyleChanged = store.setComponentStyle
|
const onStyleChanged = store.setComponentStyle
|
||||||
|
const onPropChanged = store.setComponentProp
|
||||||
function onPropChanged(key, value) {
|
|
||||||
if($store.currentView !== "component") {
|
|
||||||
store.editPageOrScreen(key, value)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
store.setComponentProp(key, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
function walkProps(component, action) {
|
function walkProps(component, action) {
|
||||||
action(component)
|
action(component)
|
||||||
|
@ -108,9 +89,9 @@
|
||||||
<DesignView {panelDefinition} {componentInstance} {onStyleChanged} />
|
<DesignView {panelDefinition} {componentInstance} {onStyleChanged} />
|
||||||
{:else if selectedCategory.value === 'settings'}
|
{:else if selectedCategory.value === 'settings'}
|
||||||
<SettingsView
|
<SettingsView
|
||||||
{panelDefinition}
|
|
||||||
{componentInstance}
|
{componentInstance}
|
||||||
{componentDefinition}
|
{componentDefinition}
|
||||||
|
{panelDefinition}
|
||||||
onChange={onPropChanged} />
|
onChange={onPropChanged} />
|
||||||
{:else if selectedCategory.value === 'events'}
|
{:else if selectedCategory.value === 'events'}
|
||||||
<EventsEditor component={componentInstance} />
|
<EventsEditor component={componentInstance} />
|
||||||
|
@ -125,10 +106,12 @@
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
/* Merge Check */
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
/* Merge Check */
|
||||||
}
|
}
|
||||||
|
|
||||||
.title > div:nth-child(1) {
|
.title > div:nth-child(1) {
|
||||||
|
|
|
@ -9,10 +9,7 @@
|
||||||
export let componentInstance = {}
|
export let componentInstance = {}
|
||||||
export let onChange = () => {}
|
export let onChange = () => {}
|
||||||
|
|
||||||
|
const propExistsOnComponentDef = prop => prop in componentDefinition.props
|
||||||
let pageScreenProps = ["title","favicon", "description", "route"]
|
|
||||||
|
|
||||||
const propExistsOnComponentDef = prop => pageScreenProps.includes(prop) || prop in componentDefinition.props
|
|
||||||
|
|
||||||
function handleChange(key, data) {
|
function handleChange(key, data) {
|
||||||
data.target ? onChange(key, data.target.value) : onChange(key, data)
|
data.target ? onChange(key, data.target.value) : onChange(key, data)
|
||||||
|
|
|
@ -2,16 +2,10 @@ import Input from "../common/Input.svelte"
|
||||||
import OptionSelect from "./OptionSelect.svelte"
|
import OptionSelect from "./OptionSelect.svelte"
|
||||||
import InputGroup from "../common/Inputs/InputGroup.svelte"
|
import InputGroup from "../common/Inputs/InputGroup.svelte"
|
||||||
import FlatButtonGroup from "./FlatButtonGroup.svelte"
|
import FlatButtonGroup from "./FlatButtonGroup.svelte"
|
||||||
|
// import Colorpicker from "../common/Colorpicker.svelte"
|
||||||
export const screen = [
|
/*
|
||||||
{ label: "Description", key: "description", control: Input },
|
TODO: Allow for default values for all properties
|
||||||
{ label: "Route", key: "route", control: Input },
|
*/
|
||||||
]
|
|
||||||
|
|
||||||
export const page = [
|
|
||||||
{ label: "Title", key: "title", control: Input },
|
|
||||||
{ label: "Favicon", key: "favicon", control: Input },
|
|
||||||
]
|
|
||||||
|
|
||||||
export const layout = [
|
export const layout = [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue