From 5ab71620883fb8a803abeb19ef2906534952a00f Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 12 Feb 2020 10:12:08 +0000 Subject: [PATCH] final tidy up --- packages/builder/src/builderStore/store.js | 4 +-- .../userInterface/ComponentsHierarchy.svelte | 2 -- .../src/userInterface/PropertyCascader.svelte | 35 ++++++++++--------- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/packages/builder/src/builderStore/store.js b/packages/builder/src/builderStore/store.js index 56a755e886..4871396ea0 100644 --- a/packages/builder/src/builderStore/store.js +++ b/packages/builder/src/builderStore/store.js @@ -461,10 +461,10 @@ const saveScreen = store => screen => { }) } -const _saveScreen = (store, s, screen) => { +const _saveScreen = async (store, s, screen) => { const currentPageScreens = s.pages[s.currentPageName]._screens - api + await api .post(`/_builder/api/${s.appname}/pages/${s.currentPageName}/screen`, screen) .then(async savedScreen => { _savePage(s); diff --git a/packages/builder/src/userInterface/ComponentsHierarchy.svelte b/packages/builder/src/userInterface/ComponentsHierarchy.svelte index 89dc2be358..5c5917c536 100644 --- a/packages/builder/src/userInterface/ComponentsHierarchy.svelte +++ b/packages/builder/src/userInterface/ComponentsHierarchy.svelte @@ -38,8 +38,6 @@ component.component && $store.currentPreviewItem && component.component.name === $store.currentPreviewItem.name - - $: console.log(_screens)
diff --git a/packages/builder/src/userInterface/PropertyCascader.svelte b/packages/builder/src/userInterface/PropertyCascader.svelte index bf5803d6f5..c8f6b4af6b 100644 --- a/packages/builder/src/userInterface/PropertyCascader.svelte +++ b/packages/builder/src/userInterface/PropertyCascader.svelte @@ -12,12 +12,11 @@ let bindingPath = ""; let bindingFallbackValue = ""; let bindingSource = "store"; - - const clearBinding = () => onChanged(""); + let bindingValue = ""; const bind = (path, fallback, source) => { if (!path) { - clearBinding(""); + onChanged(fallback); return; } const binding = setBinding({ path, fallback, source }); @@ -34,14 +33,11 @@ $: { const binding = getBinding(value); - if (bindingPath !== binding.path) isOpen = false; + if (bindingPath !== binding.path) isOpen = false; bindingPath = binding.path; - bindingFallbackValue = binding.fallback - ? binding.fallback - : typeof value === "object" - ? "" - : value; - + bindingValue = typeof value === "object" ? "" : value; + bindingFallbackValue = binding.fallback || bindingValue; + const currentScreen = $store.screens.find( ({ name }) => name === $store.currentPreviewItem.name ); @@ -52,8 +48,9 @@
{ setBindingFallback(e.target.value); onChanged(e.target.value); @@ -61,10 +58,8 @@ @@ -73,7 +68,7 @@
    {#each Object.keys(stateBindings) as stateBinding}
  • { setBindingPath(stateBinding === bindingPath ? null : stateBinding); }}> @@ -85,6 +80,14 @@