svelte-dnd-action
Advanced tools
Comparing version 0.8.5 to 0.8.6
@@ -43,3 +43,3 @@ { | ||
"description": "*An awesome drag and drop library for Svelte 3 (not using the browser's built-in dnd, thanks god): Rich animations, nested containers, touch support and more *", | ||
"version": "0.8.5", | ||
"version": "0.8.6", | ||
"repository": { | ||
@@ -46,0 +46,0 @@ "type": "git", |
@@ -55,6 +55,11 @@ // external events | ||
export function dispatchDraggedElementLeftContainerForAnother(containerEl, draggedEl) { | ||
/** | ||
* @param containerEl - the dropzone the element left | ||
* @param draggedEl - the dragged element | ||
* @param theOtherDz - the new dropzone the element entered | ||
*/ | ||
export function dispatchDraggedElementLeftContainerForAnother(containerEl, draggedEl, theOtherDz) { | ||
containerEl.dispatchEvent( | ||
new CustomEvent(DRAGGED_LEFT_EVENT_NAME, { | ||
detail: {draggedEl, type: DRAGGED_LEFT_TYPES.LEFT_FOR_ANOTHER} | ||
detail: {draggedEl, type: DRAGGED_LEFT_TYPES.LEFT_FOR_ANOTHER, theOtherDz} | ||
}) | ||
@@ -61,0 +66,0 @@ ); |
@@ -69,3 +69,3 @@ import {findWouldBeIndex, resetIndexesCache} from "./listUtil"; | ||
if (dz !== lastDropZoneFound) { | ||
lastDropZoneFound && dispatchDraggedElementLeftContainerForAnother(lastDropZoneFound, draggedEl); | ||
lastDropZoneFound && dispatchDraggedElementLeftContainerForAnother(lastDropZoneFound, draggedEl, dz); | ||
dispatchDraggedElementEnteredContainer(dz, indexObj, draggedEl); | ||
@@ -72,0 +72,0 @@ lastDropZoneFound = dz; |
@@ -128,8 +128,8 @@ import { | ||
printDebug(() => ["dragged entered", e.currentTarget, e.detail]); | ||
isDraggedOutsideOfAnyDz = false; | ||
let {items, dropFromOthersDisabled} = dzToConfig.get(e.currentTarget); | ||
if (dropFromOthersDisabled && e.currentTarget !== originDropZone) { | ||
printDebug(() => "drop is currently disabled"); | ||
printDebug(() => "ignoring dragged entered because drop is currently disabled"); | ||
return; | ||
} | ||
isDraggedOutsideOfAnyDz = false; | ||
// this deals with another race condition. in rare occasions (super rapid operations) the list hasn't updated yet | ||
@@ -173,3 +173,8 @@ items = items.filter(item => item[ITEM_ID_KEY] !== shadowElData[ITEM_ID_KEY]); | ||
shadowElDropZone = undefined; | ||
if (e.detail.type === DRAGGED_LEFT_TYPES.OUTSIDE_OF_ANY) { | ||
const {type, theOtherDz} = e.detail; | ||
if ( | ||
type === DRAGGED_LEFT_TYPES.OUTSIDE_OF_ANY || | ||
(type === DRAGGED_LEFT_TYPES.LEFT_FOR_ANOTHER && theOtherDz !== originDropZone && dzToConfig.get(theOtherDz).dropFromOthersDisabled) | ||
) { | ||
printDebug(() => "dragged left all, putting shadow element back in the origin dz"); | ||
isDraggedOutsideOfAnyDz = true; | ||
@@ -176,0 +181,0 @@ shadowElDropZone = originDropZone; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
261087
6136