From 3a70a62cf53e738552c99bde2753f3ea3f115d40 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 22 Oct 2020 17:47:49 +0100 Subject: [PATCH] Update front end column structure layout and width to increase preview space --- .../ComponentPropertiesPanel.svelte | 58 +++++------ .../userInterface/DesignView.svelte | 4 +- .../userInterface/PropertyControl.svelte | 12 +-- .../userInterface/PropertyGroup.svelte | 31 ++++-- .../userInterface/SettingsView.svelte | 96 ++++++++++--------- 5 files changed, 105 insertions(+), 96 deletions(-) diff --git a/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte b/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte index 1331ce0bdb..dead297956 100644 --- a/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte +++ b/packages/builder/src/components/userInterface/ComponentPropertiesPanel.svelte @@ -20,7 +20,7 @@ $: componentPropDefinition = flattenedPanel.find( //use for getting controls for each component property - c => c._component === componentInstance._component + (c) => c._component === componentInstance._component ) || {} $: panelDefinition = @@ -48,8 +48,8 @@ function flattenComponents(props) { const components = [] - props.forEach(comp => - walkProps(comp, c => { + props.forEach((comp) => + walkProps(comp, (c) => { if ("_component" in c) { components.push(c) } @@ -63,41 +63,31 @@ } -
- (selectedCategory = category)} - {categories} - {selectedCategory} /> + (selectedCategory = category)} + {categories} + {selectedCategory} /> - {#if displayName} -
{componentInstance._instanceName}
+{#if displayName} +
{componentInstance._instanceName}
+{/if} + +
+ {#if selectedCategory.value === 'design'} + + {:else if selectedCategory.value === 'settings'} + {/if} - -
- {#if selectedCategory.value === 'design'} - - {:else if selectedCategory.value === 'settings'} - - {/if} -
diff --git a/packages/builder/src/components/userInterface/SettingsView.svelte b/packages/builder/src/components/userInterface/SettingsView.svelte index d821f1f2e2..fd4733c24e 100644 --- a/packages/builder/src/components/userInterface/SettingsView.svelte +++ b/packages/builder/src/components/userInterface/SettingsView.svelte @@ -18,7 +18,7 @@ let pageScreenProps = ["title", "favicon", "description", "route"] let duplicateName = false - const propExistsOnComponentDef = prop => + const propExistsOnComponentDef = (prop) => pageScreenProps.includes(prop) || prop in componentDefinition.props function handleChange(key, data) { @@ -47,10 +47,10 @@ $: isPage = screenOrPageInstance && screenOrPageInstance.favicon $: screenOrPageDefinition = isPage ? pageDefinition : screenDefinition - const isDuplicateName = name => { + const isDuplicateName = (name) => { let duplicate = false - const lookForDuplicate = rootPops => { + const lookForDuplicate = (rootPops) => { walkProps(rootPops, (inst, cancel) => { if (inst._instanceName === name && inst._id !== componentInstance._id) { duplicate = true @@ -85,50 +85,60 @@ } -{#if screenOrPageInstance} - {#each screenOrPageDefinition as def} - - {/each} -{/if} - -{#if displayNameField} - - {#if duplicateName} - Name must be unique - {/if} -{/if} - -{#if panelDefinition && panelDefinition.length > 0} - {#each panelDefinition as definition} - {#if canRenderControl(definition.key, definition.dependsOn)} +
+ {#if screenOrPageInstance} + {#each screenOrPageDefinition as def} + bindable={false} + control={def.control} + label={def.label} + key={def.key} + value={screenOrPageInstance[def.key]} + onChange={onScreenPropChange} + props={{ ...excludeProps(def, ['control', 'label']) }} /> + {/each} + {/if} + + {#if displayNameField} + + {#if duplicateName} + Name must be unique {/if} - {/each} -{:else} -
This component does not have any settings.
-{/if} + {/if} + + {#if panelDefinition && panelDefinition.length > 0} + {#each panelDefinition as definition} + {#if canRenderControl(definition.key, definition.dependsOn)} + + {/if} + {/each} + {:else} +
This component does not have any settings.
+ {/if} +