@dnd-kit/sortable
Advanced tools
Comparing version 7.0.0-next-202221523720 to 7.0.0-next-202221724226
# @dnd-kit/sortable | ||
## 7.0.0-next-202221523720 | ||
## 7.0.0-next-202221724226 | ||
### Major Changes | ||
- [#660](https://github.com/clauderic/dnd-kit/pull/660) [`30bbd12`](https://github.com/clauderic/dnd-kit/commit/30bbd12f9606c2e99523cb9ece465041cb37e916) Thanks [@clauderic](https://github.com/clauderic)! - The default `sortableKeyboardCoordinates` function that is exported from the `@dnd-kit/sortable` package has been updated to better handle cases where the collision rectangle is overlapping droppable rectangles. For example, for `down` arrow key, the default function had logic that would only consider collisions against droppables that were below the `bottom` edge of the collision rect. This was problematic when the collision rect was overlapping droppable rects, because it meant that it's bottom edge was below the top edge of the droppable, and that resulted in that droppable being skipped. | ||
```diff | ||
- collisionRect.bottom > droppableRect.top | ||
+ collisionRect.top > droppableRect.top | ||
``` | ||
This change should be backwards compatible for most consumers, but may introduce regressions in some use-cases, especially for consumers that may have copied the multiple containers examples. There is now a custom sortable keyboard coordinate getter [optimized for multiple containers that you can refer to](https://github.com/clauderic/dnd-kit/tree/master/stories/2%20-%20Presets/Sortable/multipleContainersKeyboardCoordinates.ts). | ||
### Patch Changes | ||
- Updated dependencies [[`c1b3b5a`](https://github.com/clauderic/dnd-kit/commit/c1b3b5a0be5759b707e22c4e1b1236aaa82773a2)]: | ||
- @dnd-kit/core@5.1.0-next-202221523720 | ||
- Updated dependencies [[`a41e5b8`](https://github.com/clauderic/dnd-kit/commit/a41e5b8eff84f0528ffc8b3455b94b95ab60a4a9), [`a41e5b8`](https://github.com/clauderic/dnd-kit/commit/a41e5b8eff84f0528ffc8b3455b94b95ab60a4a9), [`a41e5b8`](https://github.com/clauderic/dnd-kit/commit/a41e5b8eff84f0528ffc8b3455b94b95ab60a4a9), [`77e3d44`](https://github.com/clauderic/dnd-kit/commit/77e3d44502383d2f9a9f9af014b053619b3e37b3), [`e6e242c`](https://github.com/clauderic/dnd-kit/commit/e6e242cbc718ed687a26f5c622eeed4dbd6c2425), [`c1b3b5a`](https://github.com/clauderic/dnd-kit/commit/c1b3b5a0be5759b707e22c4e1b1236aaa82773a2)]: | ||
- @dnd-kit/core@5.1.0-next-202221724226 | ||
@@ -10,0 +21,0 @@ ## 6.0.1 |
@@ -577,5 +577,6 @@ 'use strict'; | ||
active, | ||
collisionRect, | ||
droppableRects, | ||
droppableContainers, | ||
collisionRect, | ||
over, | ||
scrollableAncestors | ||
@@ -605,3 +606,3 @@ } | ||
case core.KeyboardCode.Down: | ||
if (collisionRect.top + collisionRect.height <= rect.top) { | ||
if (collisionRect.top < rect.top) { | ||
filteredContainers.push(entry); | ||
@@ -613,3 +614,3 @@ } | ||
case core.KeyboardCode.Up: | ||
if (collisionRect.top >= rect.top + rect.height) { | ||
if (collisionRect.top > rect.top) { | ||
filteredContainers.push(entry); | ||
@@ -621,3 +622,3 @@ } | ||
case core.KeyboardCode.Left: | ||
if (collisionRect.left >= rect.left + rect.width) { | ||
if (collisionRect.left > rect.left) { | ||
filteredContainers.push(entry); | ||
@@ -629,3 +630,3 @@ } | ||
case core.KeyboardCode.Right: | ||
if (collisionRect.left + collisionRect.width <= rect.left) { | ||
if (collisionRect.left < rect.left) { | ||
filteredContainers.push(entry); | ||
@@ -644,4 +645,8 @@ } | ||
}); | ||
const closestId = core.getFirstCollision(collisions, 'id'); | ||
let closestId = core.getFirstCollision(collisions, 'id'); | ||
if (closestId === (over == null ? void 0 : over.id) && collisions.length > 1) { | ||
closestId = collisions[1].id; | ||
} | ||
if (closestId != null) { | ||
@@ -648,0 +653,0 @@ const newDroppable = droppableContainers.get(closestId); |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),r=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,n=require("@dnd-kit/core"),i=require("@dnd-kit/utilities");function o(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function s(e,t){return e.reduce((e,r,n)=>{const i=t.get(r);return i&&(e[n]=i),e},Array(e.length))}function a(e){return null!==e&&e>=0}const d={scaleX:1,scaleY:1},c=({rects:e,activeIndex:t,overIndex:r,index:n})=>{const i=o(e,r,t),s=e[n],a=i[n];return a&&s?{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}:null},l={scaleX:1,scaleY:1},u=r.createContext({activeIndex:-1,containerId:"Sortable",disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:c}),f=({id:e,items:t,activeIndex:r,overIndex:n})=>o(t,r,n).indexOf(e),x=({containerId:e,isSorting:t,wasDragging:r,index:n,items:i,newIndex:o,previousItems:s,previousContainerId:a,transition:d})=>!(!d||!r||s!==i&&n===o||!t&&(o===n||e!==a)),p={duration:200,easing:"ease"},g=i.CSS.Transition.toString({property:"transform",duration:0,easing:"linear"}),h={roleDescription:"sortable"},v=[n.KeyboardCode.Down,n.KeyboardCode.Right,n.KeyboardCode.Up,n.KeyboardCode.Left];exports.SortableContext=function({children:e,id:o,items:a,strategy:d=c}){const{active:l,dragOverlay:f,droppableRects:x,over:p,measureDroppableContainers:g,measuringScheduled:h}=n.useDndContext(),v=i.useUniqueId("Sortable",o),I=Boolean(null!==f.rect),y=t.useMemo(()=>a.map(e=>"string"==typeof e?e:e.id),[a]),b=null!=l,m=l?y.indexOf(l.id):-1,w=p?y.indexOf(p.id):-1,C=t.useRef(y),S=(R=C.current,!(y.join()===R.join()));var R;const D=-1!==w&&-1===m||S;i.useIsomorphicLayoutEffect(()=>{S&&b&&!h&&g(y)},[S,y,b,g,h]),t.useEffect(()=>{C.current=y},[y]);const O=t.useMemo(()=>({activeIndex:m,containerId:v,disableTransforms:D,items:y,overIndex:w,useDragOverlay:I,sortedRects:s(y,x),strategy:d}),[m,v,D,y,w,x,I,d]);return r.createElement(u.Provider,{value:O},e)},exports.arrayMove=o,exports.arraySwap=function(e,t,r){const n=e.slice();return n[t]=e[r],n[r]=e[t],n},exports.defaultAnimateLayoutChanges=x,exports.defaultNewIndexGetter=f,exports.horizontalListSortingStrategy=({rects:e,activeNodeRect:t,activeIndex:r,overIndex:n,index:i})=>{var o;const s=null!=(o=e[r])?o:t;if(!s)return null;const a=function(e,t,r){const n=e[t],i=e[t-1],o=e[t+1];return n&&(i||o)?r<t?i?n.left-(i.left+i.width):o.left-(n.left+n.width):o?o.left-(n.left+n.width):n.left-(i.left+i.width):0}(e,i,r);if(i===r){const t=e[n];return t?{x:r<n?t.left+t.width-(s.left+s.width):t.left-s.left,y:0,...d}:null}return i>r&&i<=n?{x:-s.width-a,y:0,...d}:i<r&&i>=n?{x:s.width+a,y:0,...d}:{x:0,y:0,...d}},exports.rectSortingStrategy=c,exports.rectSwappingStrategy=({activeIndex:e,index:t,rects:r,overIndex:n})=>{let i,o;return t===e&&(i=r[t],o=r[n]),t===n&&(i=r[t],o=r[e]),o&&i?{x:o.left-i.left,y:o.top-i.top,scaleX:o.width/i.width,scaleY:o.height/i.height}:null},exports.sortableKeyboardCoordinates=(e,{context:{active:t,droppableRects:r,droppableContainers:i,collisionRect:o,scrollableAncestors:s}})=>{if(v.includes(e.code)){if(e.preventDefault(),!t||!o)return;const a=[];i.getEnabled().forEach(t=>{if(!t||(null==t?void 0:t.disabled))return;const r=null==t?void 0:t.rect.current;if(r)switch(e.code){case n.KeyboardCode.Down:o.top+o.height<=r.top&&a.push(t);break;case n.KeyboardCode.Up:o.top>=r.top+r.height&&a.push(t);break;case n.KeyboardCode.Left:o.left>=r.left+r.width&&a.push(t);break;case n.KeyboardCode.Right:o.left+o.width<=r.left&&a.push(t)}});const d=n.closestCorners({active:t,collisionRect:o,droppableRects:r,droppableContainers:a,pointerCoordinates:null}),c=n.getFirstCollision(d,"id");if(null!=c){const e=i.get(c),t=null==e?void 0:e.node.current,r=null==e?void 0:e.rect.current;if(t&&r){const e=n.getScrollableAncestors(t).some((e,t)=>s[t]!==e)?{x:0,y:0}:{x:o.width-r.width,y:o.height-r.height};return{x:r.left-e.x,y:r.top-e.y}}}}},exports.useSortable=function({animateLayoutChanges:e=x,attributes:r,disabled:o,data:s,getNewIndex:d=f,id:c,strategy:l,resizeObserverConfig:v,transition:I=p}){const{items:y,containerId:b,activeIndex:m,disableTransforms:w,sortedRects:C,overIndex:S,useDragOverlay:R,strategy:D}=t.useContext(u),O=y.indexOf(c),N=t.useMemo(()=>({sortable:{containerId:b,index:O,items:y},...s}),[b,s,O,y]),E=t.useMemo(()=>y.slice(y.indexOf(c)),[y,c]),{rect:K,node:L,isOver:M,setNodeRef:T}=n.useDroppable({id:c,data:N,resizeObserverConfig:{updateMeasurementsFor:E,...v}}),{active:k,activatorEvent:q,activeNodeRect:A,attributes:X,setNodeRef:Y,listeners:j,isDragging:z,over:F,transform:U}=n.useDraggable({id:c,data:N,attributes:{...h,...r},disabled:o}),B=i.useCombinedRefs(T,Y),P=Boolean(k),_=P&&!w&&a(m)&&a(S),G=!R&&z,H=G&&_?U:null,J=_?null!=H?H:(null!=l?l:D)({rects:C,activeNodeRect:A,activeIndex:m,overIndex:S,index:O}):null,Q=a(m)&&a(S)?d({id:c,items:y,activeIndex:m,overIndex:S}):O,V=null==k?void 0:k.id,W=t.useRef({activeId:V,items:y,newIndex:Q,containerId:b}),Z=y!==W.current.items,$=e({active:k,containerId:b,isDragging:z,isSorting:P,id:c,index:O,items:y,newIndex:W.current.newIndex,previousItems:W.current.items,previousContainerId:W.current.containerId,transition:I,wasDragging:null!=W.current.activeId}),ee=function({disabled:e,index:r,node:o,rect:s}){const[a,d]=t.useState(null),c=t.useRef(r);return i.useIsomorphicLayoutEffect(()=>{if(!e&&r!==c.current&&o.current){const e=s.current;if(e){const t=n.getClientRect(o.current,{ignoreTransform:!0}),r={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(r.x||r.y)&&d(r)}}r!==c.current&&(c.current=r)},[e,r,o,s]),t.useEffect(()=>{a&&requestAnimationFrame(()=>{d(null)})},[a]),a}({disabled:!$,index:O,node:L,rect:K});return t.useEffect(()=>{P&&W.current.newIndex!==Q&&(W.current.newIndex=Q),b!==W.current.containerId&&(W.current.containerId=b),y!==W.current.items&&(W.current.items=y),V!==W.current.activeId&&(W.current.activeId=V)},[V,P,Q,b,y]),{active:k,activeIndex:m,attributes:X,rect:K,index:O,newIndex:Q,items:y,isOver:M,isSorting:P,isDragging:z,listeners:j,node:L,overIndex:S,over:F,setNodeRef:B,setDroppableNodeRef:T,setDraggableNodeRef:Y,transform:null!=ee?ee:J,transition:ee||Z&&W.current.newIndex===O?g:G&&!i.isKeyboardEvent(q)||!I?void 0:P||$?i.CSS.Transition.toString({...I,property:"transform"}):void 0}},exports.verticalListSortingStrategy=({activeIndex:e,activeNodeRect:t,index:r,rects:n,overIndex:i})=>{var o;const s=null!=(o=n[e])?o:t;if(!s)return null;if(r===e){const t=n[i];return t?{x:0,y:e<i?t.top+t.height-(s.top+s.height):t.top-s.top,...l}:null}const a=function(e,t,r){const n=e[t],i=e[t-1],o=e[t+1];return n?r<t?i?n.top-(i.top+i.height):o?o.top-(n.top+n.height):0:o?o.top-(n.top+n.height):i?n.top-(i.top+i.height):0:0}(n,r,e);return r>e&&r<=i?{x:0,y:-s.height-a,...l}:r<e&&r>=i?{x:0,y:s.height+a,...l}:{x:0,y:0,...l}}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),r=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,n=require("@dnd-kit/core"),i=require("@dnd-kit/utilities");function o(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function s(e,t){return e.reduce((e,r,n)=>{const i=t.get(r);return i&&(e[n]=i),e},Array(e.length))}function a(e){return null!==e&&e>=0}const d={scaleX:1,scaleY:1},c=({rects:e,activeIndex:t,overIndex:r,index:n})=>{const i=o(e,r,t),s=e[n],a=i[n];return a&&s?{x:a.left-s.left,y:a.top-s.top,scaleX:a.width/s.width,scaleY:a.height/s.height}:null},l={scaleX:1,scaleY:1},u=r.createContext({activeIndex:-1,containerId:"Sortable",disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:c}),f=({id:e,items:t,activeIndex:r,overIndex:n})=>o(t,r,n).indexOf(e),x=({containerId:e,isSorting:t,wasDragging:r,index:n,items:i,newIndex:o,previousItems:s,previousContainerId:a,transition:d})=>!(!d||!r||s!==i&&n===o||!t&&(o===n||e!==a)),p={duration:200,easing:"ease"},g=i.CSS.Transition.toString({property:"transform",duration:0,easing:"linear"}),v={roleDescription:"sortable"},h=[n.KeyboardCode.Down,n.KeyboardCode.Right,n.KeyboardCode.Up,n.KeyboardCode.Left];exports.SortableContext=function({children:e,id:o,items:a,strategy:d=c}){const{active:l,dragOverlay:f,droppableRects:x,over:p,measureDroppableContainers:g,measuringScheduled:v}=n.useDndContext(),h=i.useUniqueId("Sortable",o),I=Boolean(null!==f.rect),y=t.useMemo(()=>a.map(e=>"string"==typeof e?e:e.id),[a]),b=null!=l,m=l?y.indexOf(l.id):-1,w=p?y.indexOf(p.id):-1,C=t.useRef(y),S=(R=C.current,!(y.join()===R.join()));var R;const D=-1!==w&&-1===m||S;i.useIsomorphicLayoutEffect(()=>{S&&b&&!v&&g(y)},[S,y,b,g,v]),t.useEffect(()=>{C.current=y},[y]);const O=t.useMemo(()=>({activeIndex:m,containerId:h,disableTransforms:D,items:y,overIndex:w,useDragOverlay:I,sortedRects:s(y,x),strategy:d}),[m,h,D,y,w,x,I,d]);return r.createElement(u.Provider,{value:O},e)},exports.arrayMove=o,exports.arraySwap=function(e,t,r){const n=e.slice();return n[t]=e[r],n[r]=e[t],n},exports.defaultAnimateLayoutChanges=x,exports.defaultNewIndexGetter=f,exports.horizontalListSortingStrategy=({rects:e,activeNodeRect:t,activeIndex:r,overIndex:n,index:i})=>{var o;const s=null!=(o=e[r])?o:t;if(!s)return null;const a=function(e,t,r){const n=e[t],i=e[t-1],o=e[t+1];return n&&(i||o)?r<t?i?n.left-(i.left+i.width):o.left-(n.left+n.width):o?o.left-(n.left+n.width):n.left-(i.left+i.width):0}(e,i,r);if(i===r){const t=e[n];return t?{x:r<n?t.left+t.width-(s.left+s.width):t.left-s.left,y:0,...d}:null}return i>r&&i<=n?{x:-s.width-a,y:0,...d}:i<r&&i>=n?{x:s.width+a,y:0,...d}:{x:0,y:0,...d}},exports.rectSortingStrategy=c,exports.rectSwappingStrategy=({activeIndex:e,index:t,rects:r,overIndex:n})=>{let i,o;return t===e&&(i=r[t],o=r[n]),t===n&&(i=r[t],o=r[e]),o&&i?{x:o.left-i.left,y:o.top-i.top,scaleX:o.width/i.width,scaleY:o.height/i.height}:null},exports.sortableKeyboardCoordinates=(e,{context:{active:t,collisionRect:r,droppableRects:i,droppableContainers:o,over:s,scrollableAncestors:a}})=>{if(h.includes(e.code)){if(e.preventDefault(),!t||!r)return;const d=[];o.getEnabled().forEach(t=>{if(!t||(null==t?void 0:t.disabled))return;const i=null==t?void 0:t.rect.current;if(i)switch(e.code){case n.KeyboardCode.Down:r.top<i.top&&d.push(t);break;case n.KeyboardCode.Up:r.top>i.top&&d.push(t);break;case n.KeyboardCode.Left:r.left>i.left&&d.push(t);break;case n.KeyboardCode.Right:r.left<i.left&&d.push(t)}});const c=n.closestCorners({active:t,collisionRect:r,droppableRects:i,droppableContainers:d,pointerCoordinates:null});let l=n.getFirstCollision(c,"id");if(l===(null==s?void 0:s.id)&&c.length>1&&(l=c[1].id),null!=l){const e=o.get(l),t=null==e?void 0:e.node.current,i=null==e?void 0:e.rect.current;if(t&&i){const e=n.getScrollableAncestors(t).some((e,t)=>a[t]!==e)?{x:0,y:0}:{x:r.width-i.width,y:r.height-i.height};return{x:i.left-e.x,y:i.top-e.y}}}}},exports.useSortable=function({animateLayoutChanges:e=x,attributes:r,disabled:o,data:s,getNewIndex:d=f,id:c,strategy:l,resizeObserverConfig:h,transition:I=p}){const{items:y,containerId:b,activeIndex:m,disableTransforms:w,sortedRects:C,overIndex:S,useDragOverlay:R,strategy:D}=t.useContext(u),O=y.indexOf(c),N=t.useMemo(()=>({sortable:{containerId:b,index:O,items:y},...s}),[b,s,O,y]),E=t.useMemo(()=>y.slice(y.indexOf(c)),[y,c]),{rect:K,node:L,isOver:M,setNodeRef:T}=n.useDroppable({id:c,data:N,resizeObserverConfig:{updateMeasurementsFor:E,...h}}),{active:k,activatorEvent:q,activeNodeRect:A,attributes:X,setNodeRef:Y,listeners:j,isDragging:z,over:F,transform:U}=n.useDraggable({id:c,data:N,attributes:{...v,...r},disabled:o}),B=i.useCombinedRefs(T,Y),P=Boolean(k),_=P&&!w&&a(m)&&a(S),G=!R&&z,H=G&&_?U:null,J=_?null!=H?H:(null!=l?l:D)({rects:C,activeNodeRect:A,activeIndex:m,overIndex:S,index:O}):null,Q=a(m)&&a(S)?d({id:c,items:y,activeIndex:m,overIndex:S}):O,V=null==k?void 0:k.id,W=t.useRef({activeId:V,items:y,newIndex:Q,containerId:b}),Z=y!==W.current.items,$=e({active:k,containerId:b,isDragging:z,isSorting:P,id:c,index:O,items:y,newIndex:W.current.newIndex,previousItems:W.current.items,previousContainerId:W.current.containerId,transition:I,wasDragging:null!=W.current.activeId}),ee=function({disabled:e,index:r,node:o,rect:s}){const[a,d]=t.useState(null),c=t.useRef(r);return i.useIsomorphicLayoutEffect(()=>{if(!e&&r!==c.current&&o.current){const e=s.current;if(e){const t=n.getClientRect(o.current,{ignoreTransform:!0}),r={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(r.x||r.y)&&d(r)}}r!==c.current&&(c.current=r)},[e,r,o,s]),t.useEffect(()=>{a&&requestAnimationFrame(()=>{d(null)})},[a]),a}({disabled:!$,index:O,node:L,rect:K});return t.useEffect(()=>{P&&W.current.newIndex!==Q&&(W.current.newIndex=Q),b!==W.current.containerId&&(W.current.containerId=b),y!==W.current.items&&(W.current.items=y),V!==W.current.activeId&&(W.current.activeId=V)},[V,P,Q,b,y]),{active:k,activeIndex:m,attributes:X,rect:K,index:O,newIndex:Q,items:y,isOver:M,isSorting:P,isDragging:z,listeners:j,node:L,overIndex:S,over:F,setNodeRef:B,setDroppableNodeRef:T,setDraggableNodeRef:Y,transform:null!=ee?ee:J,transition:ee||Z&&W.current.newIndex===O?g:G&&!i.isKeyboardEvent(q)||!I?void 0:P||$?i.CSS.Transition.toString({...I,property:"transform"}):void 0}},exports.verticalListSortingStrategy=({activeIndex:e,activeNodeRect:t,index:r,rects:n,overIndex:i})=>{var o;const s=null!=(o=n[e])?o:t;if(!s)return null;if(r===e){const t=n[i];return t?{x:0,y:e<i?t.top+t.height-(s.top+s.height):t.top-s.top,...l}:null}const a=function(e,t,r){const n=e[t],i=e[t-1],o=e[t+1];return n?r<t?i?n.top-(i.top+i.height):o?o.top-(n.top+n.height):0:o?o.top-(n.top+n.height):i?n.top-(i.top+i.height):0:0}(n,r,e);return r>e&&r<=i?{x:0,y:-s.height-a,...l}:r<e&&r>=i?{x:0,y:s.height+a,...l}:{x:0,y:0,...l}}; | ||
//# sourceMappingURL=sortable.cjs.production.min.js.map |
@@ -570,5 +570,6 @@ import React, { useMemo, useRef, useEffect, useState, useContext } from 'react'; | ||
active, | ||
collisionRect, | ||
droppableRects, | ||
droppableContainers, | ||
collisionRect, | ||
over, | ||
scrollableAncestors | ||
@@ -598,3 +599,3 @@ } | ||
case KeyboardCode.Down: | ||
if (collisionRect.top + collisionRect.height <= rect.top) { | ||
if (collisionRect.top < rect.top) { | ||
filteredContainers.push(entry); | ||
@@ -606,3 +607,3 @@ } | ||
case KeyboardCode.Up: | ||
if (collisionRect.top >= rect.top + rect.height) { | ||
if (collisionRect.top > rect.top) { | ||
filteredContainers.push(entry); | ||
@@ -614,3 +615,3 @@ } | ||
case KeyboardCode.Left: | ||
if (collisionRect.left >= rect.left + rect.width) { | ||
if (collisionRect.left > rect.left) { | ||
filteredContainers.push(entry); | ||
@@ -622,3 +623,3 @@ } | ||
case KeyboardCode.Right: | ||
if (collisionRect.left + collisionRect.width <= rect.left) { | ||
if (collisionRect.left < rect.left) { | ||
filteredContainers.push(entry); | ||
@@ -637,4 +638,8 @@ } | ||
}); | ||
const closestId = getFirstCollision(collisions, 'id'); | ||
let closestId = getFirstCollision(collisions, 'id'); | ||
if (closestId === (over == null ? void 0 : over.id) && collisions.length > 1) { | ||
closestId = collisions[1].id; | ||
} | ||
if (closestId != null) { | ||
@@ -641,0 +646,0 @@ const newDroppable = droppableContainers.get(closestId); |
{ | ||
"name": "@dnd-kit/sortable", | ||
"version": "7.0.0-next-202221523720", | ||
"version": "7.0.0-next-202221724226", | ||
"description": "Official sortable preset and sensors for dnd kit", | ||
@@ -34,6 +34,6 @@ "author": "Claudéric Demers", | ||
"react": ">=16.8.0", | ||
"@dnd-kit/core": "^5.1.0-next-202221523720" | ||
"@dnd-kit/core": "^5.1.0-next-202221724226" | ||
}, | ||
"devDependencies": { | ||
"@dnd-kit/core": "^5.1.0-next-202221523720" | ||
"@dnd-kit/core": "^5.1.0-next-202221724226" | ||
}, | ||
@@ -40,0 +40,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
198570
1378