Add setting button for ejecting blocks. Update manifest to show info beside relevant settings

This commit is contained in:
Andrew Kingston 2022-08-30 10:53:58 +01:00
parent 945a4c99c5
commit b4dc03751d
4 changed files with 50 additions and 26 deletions

View File

@ -0,0 +1,23 @@
<script>
import { ActionButton } from "@budibase/bbui"
import { store } from "builderStore"
import ConfirmDialog from "components/common/ConfirmDialog.svelte"
export let componentInstance
let confirmDialog
</script>
<div>
<ActionButton secondary on:click={confirmDialog.show}>
Eject block
</ActionButton>
</div>
<ConfirmDialog
bind:this={confirmDialog}
title="Eject block"
body="Ejecting a block breaks it down into multiple components. Are you sure you want to eject this block?"
onOk={() =>
store.actions.components.requestEjectBlock(componentInstance?._id)}
okText="Eject block"
/>

View File

@ -20,6 +20,7 @@
export let componentBindings = [] export let componentBindings = []
export let nested = false export let nested = false
export let highlighted = false export let highlighted = false
export let info = null
$: nullishValue = value == null || value === "" $: nullishValue = value == null || value === ""
$: allBindings = getAllBindings(bindings, componentBindings, nested) $: allBindings = getAllBindings(bindings, componentBindings, nested)
@ -99,6 +100,9 @@
{...props} {...props}
/> />
</div> </div>
{#if info}
<div class="text">{@html info}</div>
{/if}
</div> </div>
<style> <style>
@ -123,4 +127,9 @@
.control { .control {
position: relative; position: relative;
} }
.text {
margin-top: var(--spectrum-global-dimension-size-65);
font-size: var(--spectrum-global-dimension-font-size-75);
color: var(--grey-6);
}
</style> </style>

View File

@ -4,6 +4,7 @@
import { store } from "builderStore" import { store } from "builderStore"
import PropertyControl from "components/design/settings/controls/PropertyControl.svelte" import PropertyControl from "components/design/settings/controls/PropertyControl.svelte"
import ResetFieldsButton from "components/design/settings/controls/ResetFieldsButton.svelte" import ResetFieldsButton from "components/design/settings/controls/ResetFieldsButton.svelte"
import EjectBlockButton from "components/design/settings/controls/EjectBlockButton.svelte"
import { getComponentForSetting } from "components/design/settings/componentSettings" import { getComponentForSetting } from "components/design/settings/componentSettings"
export let componentDefinition export let componentDefinition
@ -21,7 +22,6 @@
return [ return [
{ {
name: "General", name: "General",
info: componentDefinition?.info,
settings: generalSettings, settings: generalSettings,
}, },
...(customSections || []), ...(customSections || []),
@ -103,6 +103,7 @@
nested={setting.nested} nested={setting.nested}
onChange={val => updateSetting(setting.key, val)} onChange={val => updateSetting(setting.key, val)}
highlighted={$store.highlightedSettingKey === setting.key} highlighted={$store.highlightedSettingKey === setting.key}
info={setting.info}
props={{ props={{
// Generic settings // Generic settings
placeholder: setting.placeholder || null, placeholder: setting.placeholder || null,
@ -124,17 +125,8 @@
{#if idx === 0 && componentDefinition?.component?.endsWith("/fieldgroup")} {#if idx === 0 && componentDefinition?.component?.endsWith("/fieldgroup")}
<ResetFieldsButton {componentInstance} /> <ResetFieldsButton {componentInstance} />
{/if} {/if}
{#if section?.info} {#if idx === 0 && componentDefinition?.block}
<div class="text"> <EjectBlockButton {componentInstance} />
{@html section.info}
</div>
{/if} {/if}
</DetailSummary> </DetailSummary>
{/each} {/each}
<style>
.text {
font-size: var(--spectrum-global-dimension-font-size-75);
color: var(--grey-6);
}
</style>

View File

@ -3437,7 +3437,6 @@
}, },
"s3upload": { "s3upload": {
"name": "S3 File Upload", "name": "S3 File Upload",
"info": "This component can't be used with S3 datasources that use custom endpoints.",
"icon": "UploadToCloud", "icon": "UploadToCloud",
"styles": [ "styles": [
"size" "size"
@ -3458,7 +3457,8 @@
{ {
"type": "dataSource/s3", "type": "dataSource/s3",
"label": "S3 Datasource", "label": "S3 Datasource",
"key": "datasourceId" "key": "datasourceId",
"info": "This component can't be used with S3 datasources that use custom endpoints"
}, },
{ {
"type": "text", "type": "text",
@ -3496,7 +3496,6 @@
}, },
"dataprovider": { "dataprovider": {
"name": "Data Provider", "name": "Data Provider",
"info": "Pagination is only available for data stored in tables.",
"icon": "Data", "icon": "Data",
"illegalChildren": [ "illegalChildren": [
"section" "section"
@ -3542,7 +3541,8 @@
"type": "boolean", "type": "boolean",
"label": "Paginate", "label": "Paginate",
"key": "paginate", "key": "paginate",
"defaultValue": true "defaultValue": true,
"info": "Pagination is only available for data stored in tables"
} }
], ],
"context": { "context": {
@ -3579,7 +3579,6 @@
], ],
"hasChildren": true, "hasChildren": true,
"showEmptyState": false, "showEmptyState": false,
"info": "Row selection is only compatible with internal or SQL tables",
"settings": [ "settings": [
{ {
"type": "dataProvider", "type": "dataProvider",
@ -3636,7 +3635,8 @@
"type": "boolean", "type": "boolean",
"label": "Allow row selection", "label": "Allow row selection",
"key": "allowSelectRows", "key": "allowSelectRows",
"defaultValue": false "defaultValue": false,
"info": "Row selection is only compatible with internal or SQL tables"
}, },
{ {
"type": "boolean", "type": "boolean",
@ -3677,13 +3677,13 @@
"size" "size"
], ],
"hasChildren": false, "hasChildren": false,
"info": "Your data provider will be automatically filtered to the given date range.",
"settings": [ "settings": [
{ {
"type": "dataProvider", "type": "dataProvider",
"label": "Provider", "label": "Provider",
"key": "dataProvider", "key": "dataProvider",
"required": true "required": true,
"info": "Your data provider will be automatically filtered to the given date range."
}, },
{ {
"type": "field", "type": "field",
@ -3818,7 +3818,6 @@
"styles": [ "styles": [
"size" "size"
], ],
"info": "Only the first 3 search columns will be used.",
"settings": [ "settings": [
{ {
"type": "text", "type": "text",
@ -3835,7 +3834,8 @@
"type": "searchfield", "type": "searchfield",
"label": "Search Columns", "label": "Search Columns",
"key": "searchColumns", "key": "searchColumns",
"placeholder": "Choose search columns" "placeholder": "Choose search columns",
"info": "Only the first 3 search columns will be used"
}, },
{ {
"type": "filter", "type": "filter",
@ -3882,7 +3882,6 @@
{ {
"section": true, "section": true,
"name": "Table", "name": "Table",
"info": "Row selection is only compatible with internal or SQL tables",
"settings": [ "settings": [
{ {
"type": "number", "type": "number",
@ -3916,7 +3915,8 @@
{ {
"type": "boolean", "type": "boolean",
"label": "Allow row selection", "label": "Allow row selection",
"key": "allowSelectRows" "key": "allowSelectRows",
"info": "Row selection is only compatible with internal or SQL tables"
}, },
{ {
"type": "boolean", "type": "boolean",
@ -3983,7 +3983,6 @@
"styles": [ "styles": [
"size" "size"
], ],
"info": "Only the first 3 search columns will be used.",
"settings": [ "settings": [
{ {
"type": "text", "type": "text",
@ -4000,7 +3999,8 @@
"type": "searchfield", "type": "searchfield",
"label": "Search Columns", "label": "Search Columns",
"key": "searchColumns", "key": "searchColumns",
"placeholder": "Choose search columns" "placeholder": "Choose search columns",
"info": "Only the first 3 search columns will be used"
}, },
{ {
"type": "filter", "type": "filter",