diff --git a/packages/builder/src/builderStore/store.js b/packages/builder/src/builderStore/store.js index 2096f932f1..0c69f5675b 100644 --- a/packages/builder/src/builderStore/store.js +++ b/packages/builder/src/builderStore/store.js @@ -112,6 +112,7 @@ export const getStore = () => { store.moveDownComponent = moveDownComponent(store) store.copyComponent = copyComponent(store) store.addTemplatedComponent = addTemplatedComponent(store) + store.setMetadataProp = setMetadataProp(store) return store } @@ -517,6 +518,7 @@ const setCurrentScreen = store => screenName => { screen._css = generate_screen_css([screen.props]) s.currentPreviewItem = screen s.currentFrontEndType = "screen" + s.currentView = "detail" s.currentComponentInfo = makePropsSafe( getContainerComponent(s.components), @@ -764,6 +766,7 @@ const addChildComponent = store => (componentToAdd, presetName) => { ? _savePage(state) : _saveScreenApi(state.currentPreviewItem, state) + state.currentView = "component" state.currentComponentInfo = newComponent.props return state @@ -794,6 +797,7 @@ const selectComponent = store => component => { ? component : state.components.find(c => c.name === component._component) state.currentComponentInfo = makePropsSafe(componentDef, component) + state.currentView = "component" return state }) } @@ -952,6 +956,13 @@ const walkProps = (props, action, cancelToken = null) => { } } +const setMetadataProp = store => (name, prop) => { + store.update(s => { + s.currentPreviewItem[name] = prop + return s + }) +} + const _saveCurrentPreviewItem = s => s.currentFrontEndType === "page" ? _savePage(s) diff --git a/packages/builder/src/userInterface/ComponentPropertiesPanel.svelte b/packages/builder/src/userInterface/ComponentPropertiesPanel.svelte index 4b6f7b0631..b066386892 100644 --- a/packages/builder/src/userInterface/ComponentPropertiesPanel.svelte +++ b/packages/builder/src/userInterface/ComponentPropertiesPanel.svelte @@ -1,5 +1,6 @@
@@ -64,11 +76,23 @@ {/if} - {$store.currentFrontEndType}
{#if current_view === 'props'} - + {#if $store.currentView === 'detail'} + {#each screen_props as [k, v, id] (id)} +
+ + store.setMetadataProp(k, target.value)} /> +
+ {/each} + + {:else} + + {/if} {:else if current_view === 'layout'} {:else if current_view === 'events'} @@ -85,6 +109,41 @@