Create DrawerContent component
This commit is contained in:
parent
bccc47cab3
commit
da993b47f1
|
@ -0,0 +1,42 @@
|
||||||
|
<div class="drawer-contents">
|
||||||
|
<div class="container" data-cy="binding-dropdown-modal">
|
||||||
|
<div class="sidebar">
|
||||||
|
<slot name="sidebar" />
|
||||||
|
</div>
|
||||||
|
<div class="main">
|
||||||
|
<slot name="main" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.drawer-contents {
|
||||||
|
height: 40vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.container {
|
||||||
|
height: 100%;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 290px 1fr;
|
||||||
|
}
|
||||||
|
.sidebar {
|
||||||
|
border-right: var(--border-light);
|
||||||
|
padding: var(--spacing-l);
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar::-webkit-scrollbar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
padding: var(--spacing-l);
|
||||||
|
font-family: var(--font-sans);
|
||||||
|
}
|
||||||
|
.main :global(textarea) {
|
||||||
|
min-height: 200px;
|
||||||
|
}
|
||||||
|
.main :global(p) {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -10,6 +10,7 @@ export { default as Select } from "./Form/Select.svelte"
|
||||||
export { default as Combobox } from "./Form/Combobox.svelte"
|
export { default as Combobox } from "./Form/Combobox.svelte"
|
||||||
export { default as Dropzone } from "./Form/Dropzone.svelte"
|
export { default as Dropzone } from "./Form/Dropzone.svelte"
|
||||||
export { default as Drawer } from "./Drawer/Drawer.svelte"
|
export { default as Drawer } from "./Drawer/Drawer.svelte"
|
||||||
|
export { default as DrawerContentWithSidebar } from "./Drawer/DrawerContentWithSidebar.svelte"
|
||||||
export { default as Avatar } from "./Avatar/Avatar.svelte"
|
export { default as Avatar } from "./Avatar/Avatar.svelte"
|
||||||
export { default as ActionButton } from "./ActionButton/ActionButton.svelte"
|
export { default as ActionButton } from "./ActionButton/ActionButton.svelte"
|
||||||
export { default as ActionGroup } from "./ActionGroup/ActionGroup.svelte"
|
export { default as ActionGroup } from "./ActionGroup/ActionGroup.svelte"
|
||||||
|
|
|
@ -47,8 +47,4 @@
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.icon i {
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -11,19 +11,21 @@
|
||||||
|
|
||||||
<form>
|
<form>
|
||||||
{#each Object.keys(schema) as configKey}
|
{#each Object.keys(schema) as configKey}
|
||||||
{#if schema[configKey].type === 'object'}
|
{#if schema[configKey].type === "object"}
|
||||||
<Label>{capitalise(configKey)}</Label>
|
<Label>{capitalise(configKey)}</Label>
|
||||||
<Spacer small />
|
<Spacer small />
|
||||||
<KeyValueBuilder
|
<KeyValueBuilder
|
||||||
defaults={schema[configKey].default}
|
defaults={schema[configKey].default}
|
||||||
bind:object={integration[configKey]} />
|
bind:object={integration[configKey]}
|
||||||
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<Label>{capitalise(configKey)}</Label>
|
<Label>{capitalise(configKey)}</Label>
|
||||||
<Input
|
<Input
|
||||||
type={schema[configKey].type}
|
type={schema[configKey].type}
|
||||||
on:change
|
on:change
|
||||||
bind:value={integration[configKey]} />
|
bind:value={integration[configKey]}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import groupBy from "lodash/fp/groupBy"
|
import groupBy from "lodash/fp/groupBy"
|
||||||
import { Search, TextArea, Heading, Spacer, Label } from "@budibase/bbui"
|
import { Search, TextArea, Heading, Spacer, Label, Layout, DrawerContentWithSidebar } from "@budibase/bbui"
|
||||||
import { createEventDispatcher } from "svelte"
|
import { createEventDispatcher } from "svelte"
|
||||||
import { isValid } from "@budibase/string-templates"
|
import { isValid } from "@budibase/string-templates"
|
||||||
import {
|
import {
|
||||||
|
@ -57,16 +57,15 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="drawer-contents">
|
<DrawerContentWithSidebar>
|
||||||
<div class="container" data-cy="binding-dropdown-modal">
|
|
||||||
<div class="list">
|
|
||||||
<Search placeholder="Search" bind:value={search} />
|
<Search placeholder="Search" bind:value={search} />
|
||||||
|
<svelte:fragment slot="sidebar">
|
||||||
<Spacer medium />
|
<Spacer medium />
|
||||||
{#if context}
|
{#if context}
|
||||||
<Heading xs h3>Columns</Heading>
|
<Heading xs h3>Columns</Heading>
|
||||||
<Spacer small />
|
<Spacer small />
|
||||||
<ul>
|
<ul>
|
||||||
{#each context.filter(context =>
|
{#each context.filter((context) =>
|
||||||
context.readableBinding.match(searchRgx)
|
context.readableBinding.match(searchRgx)
|
||||||
) as { readableBinding }}
|
) as { readableBinding }}
|
||||||
<li on:click={() => addToText(readableBinding)}>
|
<li on:click={() => addToText(readableBinding)}>
|
||||||
|
@ -80,7 +79,7 @@
|
||||||
<Heading xs h3>Components</Heading>
|
<Heading xs h3>Components</Heading>
|
||||||
<Spacer small />
|
<Spacer small />
|
||||||
<ul>
|
<ul>
|
||||||
{#each instance.filter(instance =>
|
{#each instance.filter((instance) =>
|
||||||
instance.readableBinding.match(searchRgx)
|
instance.readableBinding.match(searchRgx)
|
||||||
) as { readableBinding }}
|
) as { readableBinding }}
|
||||||
<li on:click={() => addToText(readableBinding)}>
|
<li on:click={() => addToText(readableBinding)}>
|
||||||
|
@ -93,7 +92,7 @@
|
||||||
<Heading xs h3>Helpers</Heading>
|
<Heading xs h3>Helpers</Heading>
|
||||||
<Spacer small />
|
<Spacer small />
|
||||||
<ul>
|
<ul>
|
||||||
{#each helpers.filter(helper => helper.label.match(searchRgx) || helper.description.match(searchRgx)) as helper}
|
{#each helpers.filter((helper) => helper.label.match(searchRgx) || helper.description.match(searchRgx)) as helper}
|
||||||
<li on:click={() => addToText(helper.text)}>
|
<li on:click={() => addToText(helper.text)}>
|
||||||
<div>
|
<div>
|
||||||
<Label extraSmall>{helper.displayText}</Label>
|
<Label extraSmall>{helper.displayText}</Label>
|
||||||
|
@ -105,12 +104,13 @@
|
||||||
</li>
|
</li>
|
||||||
{/each}
|
{/each}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</svelte:fragment>
|
||||||
<div class="text">
|
<svelte:fragment slot="main">
|
||||||
<TextArea
|
<TextArea
|
||||||
bind:getCaretPosition
|
bind:getCaretPosition
|
||||||
bind:value
|
bind:value
|
||||||
placeholder="Add text, or click the objects on the left to add them to the textbox." />
|
placeholder="Add text, or click the objects on the left to add them to the textbox."
|
||||||
|
/>
|
||||||
{#if !valid}
|
{#if !valid}
|
||||||
<p class="syntax-error">
|
<p class="syntax-error">
|
||||||
Current Handlebars syntax is invalid, please check the guide
|
Current Handlebars syntax is invalid, please check the guide
|
||||||
|
@ -118,36 +118,10 @@
|
||||||
for more details.
|
for more details.
|
||||||
</p>
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</svelte:fragment>
|
||||||
</div>
|
</DrawerContentWithSidebar>
|
||||||
</div>
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.container {
|
|
||||||
height: 100%;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 260px 1fr;
|
|
||||||
}
|
|
||||||
.list {
|
|
||||||
border-right: var(--border-light);
|
|
||||||
padding: var(--spacing-l);
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.list::-webkit-scrollbar {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.text {
|
|
||||||
padding: var(--spacing-l);
|
|
||||||
font-family: var(--font-sans);
|
|
||||||
}
|
|
||||||
.text :global(textarea) {
|
|
||||||
min-height: 200px;
|
|
||||||
}
|
|
||||||
.text :global(p) {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
ul {
|
ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
|
@ -182,11 +156,6 @@
|
||||||
color: var(--blue);
|
color: var(--blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer-contents {
|
|
||||||
height: 40vh;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.syntax-error {
|
.syntax-error {
|
||||||
padding-top: var(--spacing-m);
|
padding-top: var(--spacing-m);
|
||||||
color: var(--red);
|
color: var(--red);
|
||||||
|
|
|
@ -9,7 +9,9 @@
|
||||||
|
|
||||||
let unsaved = false
|
let unsaved = false
|
||||||
|
|
||||||
$: datasource = $datasources.list.find(ds => ds._id === $datasources.selected)
|
$: datasource = $datasources.list.find(
|
||||||
|
(ds) => ds._id === $datasources.selected
|
||||||
|
)
|
||||||
$: integration = datasource && $integrations[datasource.source]
|
$: integration = datasource && $integrations[datasource.source]
|
||||||
|
|
||||||
async function saveDatasource() {
|
async function saveDatasource() {
|
||||||
|
@ -46,7 +48,8 @@
|
||||||
<svelte:component
|
<svelte:component
|
||||||
this={ICONS[datasource.source]}
|
this={ICONS[datasource.source]}
|
||||||
height="26"
|
height="26"
|
||||||
width="26" />
|
width="26"
|
||||||
|
/>
|
||||||
<Heading m>{datasource.name}</Heading>
|
<Heading m>{datasource.name}</Heading>
|
||||||
</header>
|
</header>
|
||||||
<Body small grey lh>{integration.description}</Body>
|
<Body small grey lh>{integration.description}</Body>
|
||||||
|
@ -63,17 +66,18 @@
|
||||||
<IntegrationConfigForm
|
<IntegrationConfigForm
|
||||||
schema={integration.datasource}
|
schema={integration.datasource}
|
||||||
integration={datasource.config}
|
integration={datasource.config}
|
||||||
on:change={setUnsaved} />
|
on:change={setUnsaved}
|
||||||
|
/>
|
||||||
<Spacer extraLarge />
|
<Spacer extraLarge />
|
||||||
<Divider />
|
<Divider />
|
||||||
<Spacer extraLarge />
|
<Spacer extraLarge />
|
||||||
<div class="query-header">
|
<div class="query-header">
|
||||||
<Heading s>Queries</Heading>
|
<Heading s>Queries</Heading>
|
||||||
<Button secondary on:click={() => $goto('./new')}>Add Query</Button>
|
<Button secondary on:click={() => $goto("./new")}>Add Query</Button>
|
||||||
</div>
|
</div>
|
||||||
<Spacer extraLarge />
|
<Spacer extraLarge />
|
||||||
<div class="query-list">
|
<div class="query-list">
|
||||||
{#each $queries.list.filter(query => query.datasourceId === datasource._id) as query}
|
{#each $queries.list.filter((query) => query.datasourceId === datasource._id) as query}
|
||||||
<div class="query-list-item" on:click={() => onClickQuery(query)}>
|
<div class="query-list-item" on:click={() => onClickQuery(query)}>
|
||||||
<p class="query-name">{query.name}</p>
|
<p class="query-name">{query.name}</p>
|
||||||
<p>{capitalise(query.queryVerb)}</p>
|
<p>{capitalise(query.queryVerb)}</p>
|
||||||
|
@ -86,11 +90,6 @@
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
h3 {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
section {
|
section {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
width: 640px;
|
width: 640px;
|
||||||
|
|
Loading…
Reference in New Issue