Templates view and store
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
import { startDrag, stopDrag } from "$lib/utils"
|
||||
import { writable, type Writable } from "svelte/store";
|
||||
import { isHidden } from "$lib/widgets/utils";
|
||||
import { handleContainerConsider, handleContainerFinalize } from "./utils";
|
||||
|
||||
export let layoutState: WritableLayoutStateStore;
|
||||
export let container: ContainerLayout | null = null;
|
||||
@@ -46,14 +47,12 @@
|
||||
isOpen = container.isOpen
|
||||
}
|
||||
|
||||
function handleConsider(evt: any) {
|
||||
children = layoutState.updateChildren(container, evt.detail.items)
|
||||
// console.log(dragItems);
|
||||
function handleConsider(evt: CustomEvent<DndEvent<IDragItem>>) {
|
||||
children = handleContainerConsider(layoutState, container, evt)
|
||||
};
|
||||
|
||||
function handleFinalize(evt: any) {
|
||||
children = layoutState.updateChildren(container, evt.detail.items)
|
||||
// Ensure dragging is stopped on drag finish
|
||||
function handleFinalize(evt: CustomEvent<DndEvent<IDragItem>>) {
|
||||
children = handleContainerFinalize(layoutState, container, evt)
|
||||
};
|
||||
|
||||
function handleClick(e: CustomEvent<boolean>) {
|
||||
@@ -85,6 +84,7 @@
|
||||
class:empty={children.length === 0}
|
||||
class:edit={edit}
|
||||
use:dndzone="{{
|
||||
type: "layout",
|
||||
items: children,
|
||||
flipDurationMs,
|
||||
centreDraggedOnCursor: true,
|
||||
|
||||
Reference in New Issue
Block a user