forked from tsai/budibase
8 changed files with 136 additions and 48 deletions
@ -0,0 +1,66 @@ |
|||||
|
<script> |
||||
|
import { |
||||
|
Input, |
||||
|
Select, |
||||
|
ColorPicker, |
||||
|
DrawerContent, |
||||
|
Layout, |
||||
|
Label, |
||||
|
} from "@budibase/bbui" |
||||
|
import { store } from "builderStore" |
||||
|
import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte" |
||||
|
|
||||
|
export let column |
||||
|
</script> |
||||
|
|
||||
|
<DrawerContent> |
||||
|
<div class="container"> |
||||
|
<Layout noPadding gap="S"> |
||||
|
<Input bind:value={column.width} label="Width" placeholder="Auto" /> |
||||
|
<Select |
||||
|
label="Alignment" |
||||
|
bind:value={column.align} |
||||
|
options={["Left", "Center", "Right"]} |
||||
|
placeholder="Default" |
||||
|
/> |
||||
|
<DrawerBindableInput |
||||
|
label="Value" |
||||
|
value={column.template} |
||||
|
on:change={e => (column.template = e.detail)} |
||||
|
placeholder={`{{ Value }}`} |
||||
|
bindings={[ |
||||
|
{ |
||||
|
readableBinding: "Value", |
||||
|
runtimeBinding: "[value]", |
||||
|
}, |
||||
|
]} |
||||
|
/> |
||||
|
<Layout noPadding gap="XS"> |
||||
|
<Label>Background color</Label> |
||||
|
<ColorPicker |
||||
|
value={column.background} |
||||
|
on:change={e => (column.background = e.detail)} |
||||
|
alignRight |
||||
|
spectrumTheme={$store.theme} |
||||
|
/> |
||||
|
</Layout> |
||||
|
<Layout noPadding gap="XS"> |
||||
|
<Label>Text color</Label> |
||||
|
<ColorPicker |
||||
|
value={column.color} |
||||
|
on:change={e => (column.color = e.detail)} |
||||
|
alignRight |
||||
|
spectrumTheme={$store.theme} |
||||
|
/> |
||||
|
</Layout> |
||||
|
</Layout> |
||||
|
</div> |
||||
|
</DrawerContent> |
||||
|
|
||||
|
<style> |
||||
|
.container { |
||||
|
width: 100%; |
||||
|
max-width: 240px; |
||||
|
margin: 0 auto; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,34 @@ |
|||||
|
<script> |
||||
|
import { Drawer, Button, Icon } from "@budibase/bbui" |
||||
|
import CellDrawer from "./CellDrawer.svelte" |
||||
|
|
||||
|
export let column |
||||
|
|
||||
|
let boundValue |
||||
|
let drawer |
||||
|
|
||||
|
$: updateBoundValue(column) |
||||
|
|
||||
|
const updateBoundValue = value => { |
||||
|
boundValue = { ...value } |
||||
|
} |
||||
|
|
||||
|
const open = () => { |
||||
|
updateBoundValue(column) |
||||
|
drawer.show() |
||||
|
} |
||||
|
|
||||
|
const save = () => { |
||||
|
column = boundValue |
||||
|
drawer.hide() |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<Icon name="Settings" hoverable size="S" on:click={open} /> |
||||
|
<Drawer bind:this={drawer} title="Table Columns"> |
||||
|
<svelte:fragment slot="description"> |
||||
|
"{column.name}" column settings |
||||
|
</svelte:fragment> |
||||
|
<Button cta slot="buttons" on:click={save}>Save</Button> |
||||
|
<CellDrawer slot="body" bind:column={boundValue} /> |
||||
|
</Drawer> |
||||
Loading…
Reference in new issue