Merge pull request #8714 from Budibase/feature/delete-and-duplicate-component-actions

Show settings bar for all components
This commit is contained in:
deanhannigan 2022-11-21 16:01:24 +00:00 committed by GitHub
commit d3679a598c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 28 deletions

View File

@ -84,7 +84,6 @@
"description": "This component contains things within itself",
"icon": "Selection",
"hasChildren": true,
"showSettingsBar": true,
"size": {
"width": 400,
"height": 200
@ -283,7 +282,6 @@
"description": "A basic html button that is ready for styling",
"icon": "Button",
"editable": true,
"showSettingsBar": true,
"size": {
"width": 105,
"height": 35
@ -420,7 +418,6 @@
"section"
],
"hasChildren": true,
"showSettingsBar": true,
"size": {
"width": 400,
"height": 100
@ -683,7 +680,6 @@
"illegalChildren": [
"section"
],
"showSettingsBar": true,
"editable": true,
"size": {
"width": 400,
@ -809,7 +805,6 @@
"illegalChildren": [
"section"
],
"showSettingsBar": true,
"editable": true,
"size": {
"width": 400,
@ -931,7 +926,6 @@
"tag": {
"name": "Tag",
"icon": "Label",
"showSettingsBar": true,
"size": {
"width": 100,
"height": 25
@ -1189,7 +1183,6 @@
"name": "Link",
"description": "A basic link component for internal and external links",
"icon": "Link",
"showSettingsBar": true,
"editable": true,
"size": {
"width": 200,
@ -3927,7 +3920,6 @@
"dynamicfilter": {
"name": "Dynamic Filter",
"icon": "Filter",
"showSettingsBar": true,
"size": {
"width": 100,
"height": 35
@ -4797,7 +4789,6 @@
"section"
],
"hasChildren": true,
"showSettingsBar": true,
"size": {
"width": 400,
"height": 100
@ -5270,4 +5261,4 @@
"suffix": "repeater"
}
}
}
}

View File

@ -16,13 +16,16 @@
let measured = false
$: definition = $componentStore.selectedComponentDefinition
$: showBar = definition?.showSettingsBar && !$dndIsDragging
$: showBar =
definition?.showSettingsBar !== false && !$dndIsDragging && definition
$: {
if (!showBar) {
measured = false
}
}
$: settings = getBarSettings(definition)
$: isScreen =
$builderStore.selectedComponentId === $builderStore.screen?.props?._id
const getBarSettings = definition => {
let allSettings = []
@ -152,26 +155,30 @@
{:else if setting.type === "color"}
<SettingsColorPicker prop={setting.key} />
{/if}
{#if setting.barSeparator !== false}
{#if setting.barSeparator !== false && (settings.length != idx + 1 || !isScreen)}
<div class="divider" />
{/if}
{/each}
<SettingsButton
icon="Duplicate"
on:click={() => {
builderStore.actions.duplicateComponent(
$builderStore.selectedComponentId
)
}}
title="Duplicate component"
/>
<SettingsButton
icon="Delete"
on:click={() => {
builderStore.actions.deleteComponent($builderStore.selectedComponentId)
}}
title="Delete component"
/>
{#if !isScreen}
<SettingsButton
icon="Duplicate"
on:click={() => {
builderStore.actions.duplicateComponent(
$builderStore.selectedComponentId
)
}}
title="Duplicate component"
/>
<SettingsButton
icon="Delete"
on:click={() => {
builderStore.actions.deleteComponent(
$builderStore.selectedComponentId
)
}}
title="Delete component"
/>
{/if}
</div>
{/if}