|
|
@ -1,7 +1,7 @@ |
|
|
<script> |
|
|
<script> |
|
|
import { flip } from "svelte/animate" |
|
|
import { flip } from "svelte/animate" |
|
|
import { dndzone } from "svelte-dnd-action" |
|
|
import { dndzone } from "svelte-dnd-action" |
|
|
import { Icon, Button, Popover, Spacer, DrawerContent } from "@budibase/bbui" |
|
|
import { Icon, Button, Popover, Layout, DrawerContent } from "@budibase/bbui" |
|
|
import actionTypes from "./actions" |
|
|
import actionTypes from "./actions" |
|
|
import { generate } from "shortid" |
|
|
import { generate } from "shortid" |
|
|
|
|
|
|
|
|
@ -70,12 +70,11 @@ |
|
|
|
|
|
|
|
|
<DrawerContent> |
|
|
<DrawerContent> |
|
|
<div class="actions-list" slot="sidebar"> |
|
|
<div class="actions-list" slot="sidebar"> |
|
|
<div> |
|
|
<Layout> |
|
|
<div bind:this={addActionButton}> |
|
|
<div bind:this={addActionButton}> |
|
|
<Button wide secondary on:click={addActionDropdown.show}> |
|
|
<Button wide secondary on:click={addActionDropdown.show}> |
|
|
Add Action |
|
|
Add Action |
|
|
</Button> |
|
|
</Button> |
|
|
<Spacer small /> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
<Popover |
|
|
<Popover |
|
|
bind:this={addActionDropdown} |
|
|
bind:this={addActionDropdown} |
|
|
@ -90,55 +89,53 @@ |
|
|
{/each} |
|
|
{/each} |
|
|
</div> |
|
|
</div> |
|
|
</Popover> |
|
|
</Popover> |
|
|
</div> |
|
|
|
|
|
|
|
|
{#if actions && actions.length > 0} |
|
|
{#if actions && actions.length > 0} |
|
|
<div |
|
|
<div |
|
|
class="action-dnd-container" |
|
|
class="action-dnd-container" |
|
|
use:dndzone={{ |
|
|
use:dndzone={{ |
|
|
items: actions, |
|
|
items: actions, |
|
|
flipDurationMs, |
|
|
flipDurationMs, |
|
|
dropTargetStyle: { outline: "none" }, |
|
|
dropTargetStyle: { outline: "none" }, |
|
|
}} |
|
|
}} |
|
|
on:consider={handleDndConsider} |
|
|
on:consider={handleDndConsider} |
|
|
on:finalize={handleDndFinalize} |
|
|
on:finalize={handleDndFinalize} |
|
|
> |
|
|
> |
|
|
{#each actions as action, index (action.id)} |
|
|
{#each actions as action, index (action.id)} |
|
|
|
|
|
<div |
|
|
|
|
|
class="action-container" |
|
|
|
|
|
animate:flip={{ duration: flipDurationMs }} |
|
|
|
|
|
> |
|
|
|
|
|
<div |
|
|
|
|
|
class="action-header" |
|
|
|
|
|
class:selected={action === selectedAction} |
|
|
|
|
|
on:click={selectAction(action)} |
|
|
|
|
|
> |
|
|
|
|
|
{index + 1}. |
|
|
|
|
|
{action[EVENT_TYPE_KEY]} |
|
|
|
|
|
</div> |
|
|
|
|
|
<div |
|
|
<div |
|
|
on:click={() => deleteAction(index)} |
|
|
class="action-container" |
|
|
style="margin-left: auto;" |
|
|
animate:flip={{ duration: flipDurationMs }} |
|
|
> |
|
|
> |
|
|
<Icon size="S" hoverable name="Close" /> |
|
|
<div |
|
|
|
|
|
class="action-header" |
|
|
|
|
|
class:selected={action === selectedAction} |
|
|
|
|
|
on:click={selectAction(action)} |
|
|
|
|
|
> |
|
|
|
|
|
{index + 1}. |
|
|
|
|
|
{action[EVENT_TYPE_KEY]} |
|
|
|
|
|
</div> |
|
|
|
|
|
<div |
|
|
|
|
|
on:click={() => deleteAction(index)} |
|
|
|
|
|
style="margin-left: auto;" |
|
|
|
|
|
> |
|
|
|
|
|
<Icon size="S" hoverable name="Close" /> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
{/each} |
|
|
{/each} |
|
|
|
|
|
</div> |
|
|
|
|
|
{/if} |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="actions-container"> |
|
|
|
|
|
<div class="action-config"> |
|
|
|
|
|
{#if selectedAction} |
|
|
|
|
|
<div class="selected-action-container"> |
|
|
|
|
|
<svelte:component |
|
|
|
|
|
this={selectedActionComponent} |
|
|
|
|
|
parameters={selectedAction.parameters} |
|
|
|
|
|
/> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
{/if} |
|
|
{/if} |
|
|
</div> |
|
|
</Layout> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<Layout> |
|
|
|
|
|
{#if selectedAction} |
|
|
|
|
|
<div class="selected-action-container"> |
|
|
|
|
|
<svelte:component |
|
|
|
|
|
this={selectedActionComponent} |
|
|
|
|
|
parameters={selectedAction.parameters} |
|
|
|
|
|
/> |
|
|
|
|
|
</div> |
|
|
|
|
|
{/if} |
|
|
|
|
|
</Layout> |
|
|
</DrawerContent> |
|
|
</DrawerContent> |
|
|
|
|
|
|
|
|
<style> |
|
|
<style> |
|
|
@ -146,7 +143,7 @@ |
|
|
display: flex; |
|
|
display: flex; |
|
|
flex-direction: row; |
|
|
flex-direction: row; |
|
|
align-items: center; |
|
|
align-items: center; |
|
|
margin-top: var(--spacing-m); |
|
|
margin-top: var(--spacing-s); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.action-header { |
|
|
.action-header { |
|
|
@ -162,11 +159,6 @@ |
|
|
color: var(--ink); |
|
|
color: var(--ink); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.actions-list { |
|
|
|
|
|
border-right: var(--border-light); |
|
|
|
|
|
padding: var(--spacing-l); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.available-action { |
|
|
.available-action { |
|
|
padding: var(--spacing-s); |
|
|
padding: var(--spacing-s); |
|
|
font-size: var(--font-size-xs); |
|
|
font-size: var(--font-size-xs); |
|
|
@ -177,16 +169,6 @@ |
|
|
background: var(--grey-2); |
|
|
background: var(--grey-2); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.actions-container { |
|
|
|
|
|
height: 40vh; |
|
|
|
|
|
display: grid; |
|
|
|
|
|
grid-template-columns: 260px 1fr; |
|
|
|
|
|
grid-auto-flow: column; |
|
|
|
|
|
min-height: 0; |
|
|
|
|
|
padding-top: 0; |
|
|
|
|
|
overflow-y: auto; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.action-container { |
|
|
.action-container { |
|
|
border-bottom: 1px solid var(--grey-1); |
|
|
border-bottom: 1px solid var(--grey-1); |
|
|
display: flex; |
|
|
display: flex; |
|
|
@ -196,10 +178,6 @@ |
|
|
border-bottom: none; |
|
|
border-bottom: none; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.selected-action-container { |
|
|
|
|
|
padding: var(--spacing-l); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
i:hover { |
|
|
i:hover { |
|
|
color: var(--red); |
|
|
color: var(--red); |
|
|
cursor: pointer; |
|
|
cursor: pointer; |
|
|
|