preparing moving of locations

This commit is contained in:
2025-10-22 18:51:14 +02:00
parent 1acf54f58a
commit 7b259e7425
7 changed files with 65 additions and 15 deletions

View File

@@ -5,7 +5,13 @@
import LineEditor from '../../Components/LineEditor.svelte';
let { locations, move_dragged_to = new_loc => {}, parent = null, selected = $bindable(null) } = $props();
let {
drag_start = loc => console.log({dragging:loc}),
locations,
move_dragged_to = new_loc => {},
parent = null,
selected = $bindable(null)
} = $props();
let show_location_form = $state(false);
let new_location_name = $state(null);
@@ -102,12 +108,14 @@
{#each locations as location}
<li onclick={e => toggleChildren(e, location)}
class="{location.locations?'expanded':'collapsed'} {location.highlight?'highlight':null}"
draggable={true}
ondragover={e => drag_over(e,location)}
ondrop={e => onDrop(e,location)}
ondragleave={e => delete location.highlight}>
ondragleave={e => delete location.highlight}
ondragstart={e => drag_start(location)} >
<span class="name">{location.name}</span>
{#if location.locations}
<svelte:self locations={location.locations} {move_dragged_to} parent={{location:location.id}} bind:selected />
<svelte:self locations={location.locations} {drag_start} {move_dragged_to} parent={{location:location.id}} bind:selected />
{/if}
</li>
{/each}