* fix(frontend): wip * fix(frontend): wip * fix(frontend): fix while loops + theme * fix(frontend): wip * fix(frontend): wip * fix(frontend): same view as before * fix(frontend): wip * fix(frontend): wip * feat(frontend): flow status viewer * fix(frontend): wip * feat(frontend): migrate to xyflow * feat(frontend): dataflow * feat(frontend): clean up * feat(frontend): clean up * feat(frontend): clean up * feat(frontend): fix min-height * feat(frontend): clean up * feat(frontend): add missing insert button for empty loops * feat(frontend): Fix insert * feat(frontend): Fix branch one * feat(frontend): Support default branch for branch one * feat(frontend): fix add and delete branches * feat(frontend): Make the iterations menu work * feat(frontend): Fix graph height in the flow status viewer * feat(frontend): code improvement * feat(frontend): add missing trigger * feat(frontend): add support for triggers * feat(frontend): fix move * feat(frontend): fix No branch for branch one * feat(frontend): fix light theme * feat(frontend): fix build * feat(frontend): remove dead code * feat(frontend): fix move * feat(frontend): fix vertical alignement * feat(frontend): fix viewport * feat(frontend): style fix * feat(frontend): fix viewgraph * feat(frontend): fix build * feat(frontend): Fix node position * feat(frontend): UI nits * feat(frontend): UI nits * feat(frontend): fix zoom level + fix insert button position * feat(frontend): svelvet clean up * feat(frontend): fix paste button position * feat(frontend): clean up * feat(frontend): migrate Decision Tree * feat(frontend): clean up * feat(frontend): add callback * feat(frontend): migrate Decision Tree * feat(frontend): fix build * feat(frontend): fix branches * feat(frontend): fix branches * feat(frontend): fix insert * feat(frontend): wip * feat(frontend): done * feat(frontend): done * feat(frontend): fix reactivity * feat(frontend): fix z-index issues * feat(frontend): fix bg issue * feat(frontend): fix border status * add padding to flow height * Update FlowGraphV2.svelte --------- Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
82 lines
2.3 KiB
Svelte
82 lines
2.3 KiB
Svelte
<script lang="ts">
|
|
import type { DecisionTreeNode } from '../component'
|
|
import { twMerge } from 'tailwind-merge'
|
|
import InsertDecisionTreeNode from './decisionTree/InsertDecisionTreeNode.svelte'
|
|
import { X } from 'lucide-svelte'
|
|
import NodeWrapper from '$lib/components/graph/renderers/nodes/NodeWrapper.svelte'
|
|
|
|
export let data: {
|
|
node: DecisionTreeNode
|
|
canDelete: boolean
|
|
nodeCallbackHandler: (
|
|
event: string,
|
|
detail: string,
|
|
graphNode: DecisionTreeNode | undefined,
|
|
parentIds: string[],
|
|
branchInsert: boolean
|
|
) => void
|
|
parentIds: string[]
|
|
branchHeader: boolean
|
|
}
|
|
|
|
let open: boolean = false
|
|
</script>
|
|
|
|
<NodeWrapper>
|
|
<div class="relative h-full">
|
|
<div
|
|
class={twMerge(
|
|
'w-full h-full border border-gray-400',
|
|
'flex flex-row gap-2 items-center justify-between rounded-sm overflow-hidden'
|
|
)}
|
|
style="width: 275px; height: 34px; background-color: {document.documentElement.classList.contains(
|
|
'dark'
|
|
)
|
|
? '#2e3440'
|
|
: '#dfe6ee'}"
|
|
>
|
|
<div class="ml-4 text-xs font-normal text-primary"> {data.node.label} </div>
|
|
</div>
|
|
|
|
{#if data.canDelete}
|
|
<div class="w-[27px] absolute -top-[32px] left-[50%] right-[50%] -translate-x-1/2">
|
|
<button
|
|
title="Delete branch"
|
|
on:click|preventDefault|stopPropagation={() => {
|
|
data.nodeCallbackHandler('removeBranch', data.node.id, data.node, data.parentIds, false)
|
|
}}
|
|
type="button"
|
|
class="text-primary bg-surface border mx-[1px] border-gray-300 dark:border-gray-500 focus:outline-none hover:bg-surface-hover focus:ring-4 focus:ring-gray-200 font-medium rounded-full text-sm w-[25px] h-[25px] flex items-center justify-center"
|
|
>
|
|
<X class="m-[5px]" size={15} />
|
|
</button>
|
|
</div>
|
|
{/if}
|
|
|
|
{#if data.node.id !== 'end'}
|
|
<div
|
|
class={twMerge(
|
|
'absolute -bottom-10 left-1/2 transform -translate-x-1/2 flex items-center',
|
|
open ? 'z-20' : ''
|
|
)}
|
|
>
|
|
<InsertDecisionTreeNode
|
|
on:node={() => {
|
|
data.nodeCallbackHandler(
|
|
'nodeInsert',
|
|
data.node.id,
|
|
data.node,
|
|
data.parentIds ?? [],
|
|
data.branchHeader
|
|
)
|
|
}}
|
|
on:addBranch={() => {
|
|
data.nodeCallbackHandler('addBranch', data.node.id, data.node, data.parentIds, true)
|
|
}}
|
|
canAddBranch={false}
|
|
/>
|
|
</div>
|
|
{/if}
|
|
</div>
|
|
</NodeWrapper>
|