refactor(editor): Decouple Draggable from NDV store (#14531)

This commit is contained in:
Milorad FIlipović
2025-04-11 11:17:44 +02:00
committed by GitHub
parent e54f450a9d
commit be627f08a4
6 changed files with 63 additions and 30 deletions

View File

@@ -72,15 +72,24 @@ const getJsonParameterPath = (path: string) => {
});
};
const onDragStart = (el: HTMLElement) => {
const canDraggableDrop = computed(() => ndvStore.canDraggableDrop);
const draggableStickyPosition = computed(() => ndvStore.draggableStickyPos);
const onDragStart = (el: HTMLElement, data?: string) => {
if (el?.dataset.path) {
draggingPath.value = el.dataset.path;
}
ndvStore.draggableStartDragging({
type: 'mapping',
data: data ?? '',
dimensions: el?.getBoundingClientRect() ?? null,
});
ndvStore.resetMappingTelemetry();
};
const onDragEnd = (el: HTMLElement) => {
ndvStore.draggableStopDragging();
draggingPath.value = null;
const mappingTelemetry = ndvStore.mappingTelemetry;
const telemetryPayload = {
@@ -132,6 +141,8 @@ const getListItemName = (path: string) => {
type="mapping"
target-data-key="mappable"
:disabled="!mappingEnabled"
:can-drop="canDraggableDrop"
:sticky-position="draggableStickyPosition"
@dragstart="onDragStart"
@dragend="onDragEnd"
>