Update form settings to be called Schema and add custom schema option

This commit is contained in:
Andrew Kingston 2021-02-04 18:00:02 +00:00
parent d939acbd4f
commit 9aac519351
7 changed files with 40 additions and 15 deletions

View File

@ -19,6 +19,7 @@
let drawer
export let value = {}
export let otherSources
$: tables = $backendUiStore.tables.map(m => ({
label: m.name,
@ -88,7 +89,7 @@
class="dropdownbutton"
bind:this={anchorRight}
on:click={dropdownRight.show}>
<span>{value?.label ? value.label : 'Choose option'}</span>
<span>{value?.label ?? 'Choose option'}</span>
<Icon name="arrowdown" />
</div>
{#if value?.type === 'query'}
@ -175,6 +176,22 @@
</li>
{/each}
</ul>
{#if otherSources?.length}
<hr />
<div class="title">
<Heading extraSmall>Other</Heading>
</div>
<ul>
{#each otherSources as source}
<li
class:selected={value === source}
on:click={() => handleSelected(source)}>
{source.label}
</li>
{/each}
</ul>
{/if}
</div>
</DropdownMenu>

View File

@ -0,0 +1,5 @@
<script>
import FieldSelect from "./FieldSelect.svelte"
</script>
<FieldSelect {...$$props} multiselect />

View File

@ -1,5 +0,0 @@
<script>
import TableViewFieldSelect from "./TableViewFieldSelect.svelte"
</script>
<TableViewFieldSelect {...$$props} multiselect />

View File

@ -0,0 +1,7 @@
<script>
import DatasourceSelect from "./DatasourceSelect.svelte"
const otherSources = [{ name: "Custom", label: "Custom" }]
</script>
<DatasourceSelect on:change {...$$props} {otherSources} />

View File

@ -11,11 +11,12 @@
import LayoutSelect from "./PropertyControls/LayoutSelect.svelte"
import RoleSelect from "./PropertyControls/RoleSelect.svelte"
import OptionSelect from "./PropertyControls/OptionSelect.svelte"
import MultiTableViewFieldSelect from "./PropertyControls/MultiTableViewFieldSelect.svelte"
import Checkbox from "./PropertyControls/Checkbox.svelte"
import TableSelect from "./PropertyControls/TableSelect.svelte"
import TableViewSelect from "./PropertyControls/TableViewSelect.svelte"
import TableViewFieldSelect from "./PropertyControls/TableViewFieldSelect.svelte"
import DatasourceSelect from "./PropertyControls/DatasourceSelect.svelte"
import FieldSelect from "./PropertyControls/FieldSelect.svelte"
import MultiFieldSelect from "./PropertyControls/MultiFieldSelect.svelte"
import SchemaSelect from "./PropertyControls/SchemaSelect.svelte"
import EventsEditor from "./PropertyControls/EventsEditor"
import ScreenSelect from "./PropertyControls/ScreenSelect.svelte"
import DetailScreenSelect from "./PropertyControls/DetailScreenSelect.svelte"
@ -60,7 +61,7 @@
const controlMap = {
text: Input,
select: OptionSelect,
datasource: TableViewSelect,
datasource: DatasourceSelect,
screen: ScreenSelect,
detailScreen: DetailScreenSelect,
boolean: Checkbox,
@ -69,8 +70,9 @@
table: TableSelect,
color: ColorPicker,
icon: IconSelect,
field: TableViewFieldSelect,
multifield: MultiTableViewFieldSelect,
field: FieldSelect,
multifield: MultiFieldSelect,
schema: SchemaSelect,
"field/string": StringFieldSelect,
"field/number": NumberFieldSelect,
"field/options": OptionsFieldSelect,

View File

@ -1045,12 +1045,11 @@
"styleable": true,
"hasChildren": true,
"dataProvider": true,
"datasourceSetting": "datasource",
"actions": ["ValidateForm"],
"settings": [
{
"type": "datasource",
"label": "Data",
"type": "schema",
"label": "Schema",
"key": "datasource"
},
{