@react-stately/dnd 3.3.1-nightly.4624 → 3.3.2-nightly.4629
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/useDraggableCollectionState.main.js +3 -3
- package/dist/useDraggableCollectionState.mjs +3 -3
- package/dist/useDraggableCollectionState.module.js +3 -3
- package/dist/useDroppableCollectionState.main.js +23 -23
- package/dist/useDroppableCollectionState.mjs +23 -23
- package/dist/useDroppableCollectionState.module.js +23 -23
- package/package.json +4 -4
|
@@ -57,20 +57,20 @@ function $481a240e3d51b276$export$29efd034f1d79f81(props) {
|
|
|
57
57
|
draggedKey.current = key;
|
|
58
58
|
selectionManager.setFocused(false);
|
|
59
59
|
setDragging(true);
|
|
60
|
-
if (typeof onDragStart ===
|
|
60
|
+
if (typeof onDragStart === 'function') onDragStart({
|
|
61
61
|
...event,
|
|
62
62
|
keys: keys
|
|
63
63
|
});
|
|
64
64
|
},
|
|
65
65
|
moveDrag (event) {
|
|
66
|
-
if (typeof onDragMove ===
|
|
66
|
+
if (typeof onDragMove === 'function') onDragMove({
|
|
67
67
|
...event,
|
|
68
68
|
keys: draggingKeys.current
|
|
69
69
|
});
|
|
70
70
|
},
|
|
71
71
|
endDrag (event) {
|
|
72
72
|
let { isInternal: isInternal } = event;
|
|
73
|
-
if (typeof onDragEnd ===
|
|
73
|
+
if (typeof onDragEnd === 'function') onDragEnd({
|
|
74
74
|
...event,
|
|
75
75
|
keys: draggingKeys.current,
|
|
76
76
|
isInternal: isInternal
|
|
@@ -51,20 +51,20 @@ function $b45bbbaf0c3785df$export$29efd034f1d79f81(props) {
|
|
|
51
51
|
draggedKey.current = key;
|
|
52
52
|
selectionManager.setFocused(false);
|
|
53
53
|
setDragging(true);
|
|
54
|
-
if (typeof onDragStart ===
|
|
54
|
+
if (typeof onDragStart === 'function') onDragStart({
|
|
55
55
|
...event,
|
|
56
56
|
keys: keys
|
|
57
57
|
});
|
|
58
58
|
},
|
|
59
59
|
moveDrag (event) {
|
|
60
|
-
if (typeof onDragMove ===
|
|
60
|
+
if (typeof onDragMove === 'function') onDragMove({
|
|
61
61
|
...event,
|
|
62
62
|
keys: draggingKeys.current
|
|
63
63
|
});
|
|
64
64
|
},
|
|
65
65
|
endDrag (event) {
|
|
66
66
|
let { isInternal: isInternal } = event;
|
|
67
|
-
if (typeof onDragEnd ===
|
|
67
|
+
if (typeof onDragEnd === 'function') onDragEnd({
|
|
68
68
|
...event,
|
|
69
69
|
keys: draggingKeys.current,
|
|
70
70
|
isInternal: isInternal
|
|
@@ -51,20 +51,20 @@ function $b45bbbaf0c3785df$export$29efd034f1d79f81(props) {
|
|
|
51
51
|
draggedKey.current = key;
|
|
52
52
|
selectionManager.setFocused(false);
|
|
53
53
|
setDragging(true);
|
|
54
|
-
if (typeof onDragStart ===
|
|
54
|
+
if (typeof onDragStart === 'function') onDragStart({
|
|
55
55
|
...event,
|
|
56
56
|
keys: keys
|
|
57
57
|
});
|
|
58
58
|
},
|
|
59
59
|
moveDrag (event) {
|
|
60
|
-
if (typeof onDragMove ===
|
|
60
|
+
if (typeof onDragMove === 'function') onDragMove({
|
|
61
61
|
...event,
|
|
62
62
|
keys: draggingKeys.current
|
|
63
63
|
});
|
|
64
64
|
},
|
|
65
65
|
endDrag (event) {
|
|
66
66
|
let { isInternal: isInternal } = event;
|
|
67
|
-
if (typeof onDragEnd ===
|
|
67
|
+
if (typeof onDragEnd === 'function') onDragEnd({
|
|
68
68
|
...event,
|
|
69
69
|
keys: draggingKeys.current,
|
|
70
70
|
isInternal: isInternal
|
|
@@ -18,42 +18,42 @@ $parcel$export(module.exports, "useDroppableCollectionState", () => $6ce4cbfbe5e
|
|
|
18
18
|
* governing permissions and limitations under the License.
|
|
19
19
|
*/
|
|
20
20
|
function $6ce4cbfbe5e354f1$export$926850f6ecef79d0(props) {
|
|
21
|
-
let { acceptedDragTypes: acceptedDragTypes =
|
|
21
|
+
let { acceptedDragTypes: acceptedDragTypes = 'all', isDisabled: isDisabled, onInsert: onInsert, onRootDrop: onRootDrop, onItemDrop: onItemDrop, onReorder: onReorder, shouldAcceptItemDrop: shouldAcceptItemDrop, collection: collection, selectionManager: selectionManager, onDropEnter: onDropEnter, getDropOperation: getDropOperation, onDrop: onDrop } = props;
|
|
22
22
|
let [target, setTarget] = (0, $ax21c$react.useState)(null);
|
|
23
23
|
let targetRef = (0, $ax21c$react.useRef)(null);
|
|
24
24
|
let getOppositeTarget = (target)=>{
|
|
25
|
-
if (target.dropPosition ===
|
|
25
|
+
if (target.dropPosition === 'before') {
|
|
26
26
|
let key = collection.getKeyBefore(target.key);
|
|
27
27
|
return key != null ? {
|
|
28
|
-
type:
|
|
28
|
+
type: 'item',
|
|
29
29
|
key: key,
|
|
30
|
-
dropPosition:
|
|
30
|
+
dropPosition: 'after'
|
|
31
31
|
} : null;
|
|
32
|
-
} else if (target.dropPosition ===
|
|
32
|
+
} else if (target.dropPosition === 'after') {
|
|
33
33
|
let key = collection.getKeyAfter(target.key);
|
|
34
34
|
return key != null ? {
|
|
35
|
-
type:
|
|
35
|
+
type: 'item',
|
|
36
36
|
key: key,
|
|
37
|
-
dropPosition:
|
|
37
|
+
dropPosition: 'before'
|
|
38
38
|
} : null;
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
let defaultGetDropOperation = (0, $ax21c$react.useCallback)((e)=>{
|
|
42
|
-
if (isDisabled) return
|
|
42
|
+
if (isDisabled) return 'cancel';
|
|
43
43
|
let { target: target, types: types, allowedOperations: allowedOperations, isInternal: isInternal, draggingKeys: draggingKeys } = e;
|
|
44
|
-
if (acceptedDragTypes ===
|
|
45
|
-
let isValidInsert = onInsert && target.type ===
|
|
46
|
-
let isValidReorder = onReorder && target.type ===
|
|
44
|
+
if (acceptedDragTypes === 'all' || acceptedDragTypes.some((type)=>types.has(type))) {
|
|
45
|
+
let isValidInsert = onInsert && target.type === 'item' && !isInternal && (target.dropPosition === 'before' || target.dropPosition === 'after');
|
|
46
|
+
let isValidReorder = onReorder && target.type === 'item' && isInternal && (target.dropPosition === 'before' || target.dropPosition === 'after');
|
|
47
47
|
// Feedback was that internal root drop was weird so preventing that from happening
|
|
48
|
-
let isValidRootDrop = onRootDrop && target.type ===
|
|
48
|
+
let isValidRootDrop = onRootDrop && target.type === 'root' && !isInternal;
|
|
49
49
|
// Automatically prevent items (i.e. folders) from being dropped on themselves.
|
|
50
|
-
let isValidOnItemDrop = onItemDrop && target.type ===
|
|
50
|
+
let isValidOnItemDrop = onItemDrop && target.type === 'item' && target.dropPosition === 'on' && !(isInternal && draggingKeys.has(target.key)) && (!shouldAcceptItemDrop || shouldAcceptItemDrop(target, types));
|
|
51
51
|
if (onDrop || isValidInsert || isValidReorder || isValidRootDrop || isValidOnItemDrop) {
|
|
52
52
|
if (getDropOperation) return getDropOperation(target, types, allowedOperations);
|
|
53
53
|
else return allowedOperations[0];
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
return
|
|
56
|
+
return 'cancel';
|
|
57
57
|
}, [
|
|
58
58
|
isDisabled,
|
|
59
59
|
acceptedDragTypes,
|
|
@@ -73,14 +73,14 @@ function $6ce4cbfbe5e354f1$export$926850f6ecef79d0(props) {
|
|
|
73
73
|
setTarget (newTarget) {
|
|
74
74
|
if (this.isDropTarget(newTarget)) return;
|
|
75
75
|
let target = targetRef.current;
|
|
76
|
-
if (target && typeof props.onDropExit ===
|
|
77
|
-
type:
|
|
76
|
+
if (target && typeof props.onDropExit === 'function') props.onDropExit({
|
|
77
|
+
type: 'dropexit',
|
|
78
78
|
x: 0,
|
|
79
79
|
y: 0,
|
|
80
80
|
target: target
|
|
81
81
|
});
|
|
82
|
-
if (newTarget && typeof onDropEnter ===
|
|
83
|
-
type:
|
|
82
|
+
if (newTarget && typeof onDropEnter === 'function') onDropEnter({
|
|
83
|
+
type: 'dropenter',
|
|
84
84
|
x: 0,
|
|
85
85
|
y: 0,
|
|
86
86
|
target: newTarget
|
|
@@ -92,7 +92,7 @@ function $6ce4cbfbe5e354f1$export$926850f6ecef79d0(props) {
|
|
|
92
92
|
let target = targetRef.current;
|
|
93
93
|
if ($6ce4cbfbe5e354f1$var$isEqualDropTarget(dropTarget, target)) return true;
|
|
94
94
|
// Check if the targets point at the same point between two items, one referring before, and the other after.
|
|
95
|
-
if ((dropTarget === null || dropTarget === void 0 ? void 0 : dropTarget.type) ===
|
|
95
|
+
if ((dropTarget === null || dropTarget === void 0 ? void 0 : dropTarget.type) === 'item' && (target === null || target === void 0 ? void 0 : target.type) === 'item' && dropTarget.key !== target.key && dropTarget.dropPosition !== target.dropPosition && dropTarget.dropPosition !== 'on' && target.dropPosition !== 'on') return $6ce4cbfbe5e354f1$var$isEqualDropTarget(getOppositeTarget(dropTarget), target) || $6ce4cbfbe5e354f1$var$isEqualDropTarget(dropTarget, getOppositeTarget(target));
|
|
96
96
|
return false;
|
|
97
97
|
},
|
|
98
98
|
getDropOperation (e) {
|
|
@@ -103,10 +103,10 @@ function $6ce4cbfbe5e354f1$export$926850f6ecef79d0(props) {
|
|
|
103
103
|
function $6ce4cbfbe5e354f1$var$isEqualDropTarget(a, b) {
|
|
104
104
|
if (!a) return !b;
|
|
105
105
|
switch(a.type){
|
|
106
|
-
case
|
|
107
|
-
return (b === null || b === void 0 ? void 0 : b.type) ===
|
|
108
|
-
case
|
|
109
|
-
return (b === null || b === void 0 ? void 0 : b.type) ===
|
|
106
|
+
case 'root':
|
|
107
|
+
return (b === null || b === void 0 ? void 0 : b.type) === 'root';
|
|
108
|
+
case 'item':
|
|
109
|
+
return (b === null || b === void 0 ? void 0 : b.type) === 'item' && (b === null || b === void 0 ? void 0 : b.key) === a.key && (b === null || b === void 0 ? void 0 : b.dropPosition) === a.dropPosition;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -12,42 +12,42 @@ import {useState as $lyPoT$useState, useRef as $lyPoT$useRef, useCallback as $ly
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
function $e672e8bc247525d1$export$926850f6ecef79d0(props) {
|
|
15
|
-
let { acceptedDragTypes: acceptedDragTypes =
|
|
15
|
+
let { acceptedDragTypes: acceptedDragTypes = 'all', isDisabled: isDisabled, onInsert: onInsert, onRootDrop: onRootDrop, onItemDrop: onItemDrop, onReorder: onReorder, shouldAcceptItemDrop: shouldAcceptItemDrop, collection: collection, selectionManager: selectionManager, onDropEnter: onDropEnter, getDropOperation: getDropOperation, onDrop: onDrop } = props;
|
|
16
16
|
let [target, setTarget] = (0, $lyPoT$useState)(null);
|
|
17
17
|
let targetRef = (0, $lyPoT$useRef)(null);
|
|
18
18
|
let getOppositeTarget = (target)=>{
|
|
19
|
-
if (target.dropPosition ===
|
|
19
|
+
if (target.dropPosition === 'before') {
|
|
20
20
|
let key = collection.getKeyBefore(target.key);
|
|
21
21
|
return key != null ? {
|
|
22
|
-
type:
|
|
22
|
+
type: 'item',
|
|
23
23
|
key: key,
|
|
24
|
-
dropPosition:
|
|
24
|
+
dropPosition: 'after'
|
|
25
25
|
} : null;
|
|
26
|
-
} else if (target.dropPosition ===
|
|
26
|
+
} else if (target.dropPosition === 'after') {
|
|
27
27
|
let key = collection.getKeyAfter(target.key);
|
|
28
28
|
return key != null ? {
|
|
29
|
-
type:
|
|
29
|
+
type: 'item',
|
|
30
30
|
key: key,
|
|
31
|
-
dropPosition:
|
|
31
|
+
dropPosition: 'before'
|
|
32
32
|
} : null;
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
let defaultGetDropOperation = (0, $lyPoT$useCallback)((e)=>{
|
|
36
|
-
if (isDisabled) return
|
|
36
|
+
if (isDisabled) return 'cancel';
|
|
37
37
|
let { target: target, types: types, allowedOperations: allowedOperations, isInternal: isInternal, draggingKeys: draggingKeys } = e;
|
|
38
|
-
if (acceptedDragTypes ===
|
|
39
|
-
let isValidInsert = onInsert && target.type ===
|
|
40
|
-
let isValidReorder = onReorder && target.type ===
|
|
38
|
+
if (acceptedDragTypes === 'all' || acceptedDragTypes.some((type)=>types.has(type))) {
|
|
39
|
+
let isValidInsert = onInsert && target.type === 'item' && !isInternal && (target.dropPosition === 'before' || target.dropPosition === 'after');
|
|
40
|
+
let isValidReorder = onReorder && target.type === 'item' && isInternal && (target.dropPosition === 'before' || target.dropPosition === 'after');
|
|
41
41
|
// Feedback was that internal root drop was weird so preventing that from happening
|
|
42
|
-
let isValidRootDrop = onRootDrop && target.type ===
|
|
42
|
+
let isValidRootDrop = onRootDrop && target.type === 'root' && !isInternal;
|
|
43
43
|
// Automatically prevent items (i.e. folders) from being dropped on themselves.
|
|
44
|
-
let isValidOnItemDrop = onItemDrop && target.type ===
|
|
44
|
+
let isValidOnItemDrop = onItemDrop && target.type === 'item' && target.dropPosition === 'on' && !(isInternal && draggingKeys.has(target.key)) && (!shouldAcceptItemDrop || shouldAcceptItemDrop(target, types));
|
|
45
45
|
if (onDrop || isValidInsert || isValidReorder || isValidRootDrop || isValidOnItemDrop) {
|
|
46
46
|
if (getDropOperation) return getDropOperation(target, types, allowedOperations);
|
|
47
47
|
else return allowedOperations[0];
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
return
|
|
50
|
+
return 'cancel';
|
|
51
51
|
}, [
|
|
52
52
|
isDisabled,
|
|
53
53
|
acceptedDragTypes,
|
|
@@ -67,14 +67,14 @@ function $e672e8bc247525d1$export$926850f6ecef79d0(props) {
|
|
|
67
67
|
setTarget (newTarget) {
|
|
68
68
|
if (this.isDropTarget(newTarget)) return;
|
|
69
69
|
let target = targetRef.current;
|
|
70
|
-
if (target && typeof props.onDropExit ===
|
|
71
|
-
type:
|
|
70
|
+
if (target && typeof props.onDropExit === 'function') props.onDropExit({
|
|
71
|
+
type: 'dropexit',
|
|
72
72
|
x: 0,
|
|
73
73
|
y: 0,
|
|
74
74
|
target: target
|
|
75
75
|
});
|
|
76
|
-
if (newTarget && typeof onDropEnter ===
|
|
77
|
-
type:
|
|
76
|
+
if (newTarget && typeof onDropEnter === 'function') onDropEnter({
|
|
77
|
+
type: 'dropenter',
|
|
78
78
|
x: 0,
|
|
79
79
|
y: 0,
|
|
80
80
|
target: newTarget
|
|
@@ -86,7 +86,7 @@ function $e672e8bc247525d1$export$926850f6ecef79d0(props) {
|
|
|
86
86
|
let target = targetRef.current;
|
|
87
87
|
if ($e672e8bc247525d1$var$isEqualDropTarget(dropTarget, target)) return true;
|
|
88
88
|
// Check if the targets point at the same point between two items, one referring before, and the other after.
|
|
89
|
-
if ((dropTarget === null || dropTarget === void 0 ? void 0 : dropTarget.type) ===
|
|
89
|
+
if ((dropTarget === null || dropTarget === void 0 ? void 0 : dropTarget.type) === 'item' && (target === null || target === void 0 ? void 0 : target.type) === 'item' && dropTarget.key !== target.key && dropTarget.dropPosition !== target.dropPosition && dropTarget.dropPosition !== 'on' && target.dropPosition !== 'on') return $e672e8bc247525d1$var$isEqualDropTarget(getOppositeTarget(dropTarget), target) || $e672e8bc247525d1$var$isEqualDropTarget(dropTarget, getOppositeTarget(target));
|
|
90
90
|
return false;
|
|
91
91
|
},
|
|
92
92
|
getDropOperation (e) {
|
|
@@ -97,10 +97,10 @@ function $e672e8bc247525d1$export$926850f6ecef79d0(props) {
|
|
|
97
97
|
function $e672e8bc247525d1$var$isEqualDropTarget(a, b) {
|
|
98
98
|
if (!a) return !b;
|
|
99
99
|
switch(a.type){
|
|
100
|
-
case
|
|
101
|
-
return (b === null || b === void 0 ? void 0 : b.type) ===
|
|
102
|
-
case
|
|
103
|
-
return (b === null || b === void 0 ? void 0 : b.type) ===
|
|
100
|
+
case 'root':
|
|
101
|
+
return (b === null || b === void 0 ? void 0 : b.type) === 'root';
|
|
102
|
+
case 'item':
|
|
103
|
+
return (b === null || b === void 0 ? void 0 : b.type) === 'item' && (b === null || b === void 0 ? void 0 : b.key) === a.key && (b === null || b === void 0 ? void 0 : b.dropPosition) === a.dropPosition;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -12,42 +12,42 @@ import {useState as $lyPoT$useState, useRef as $lyPoT$useRef, useCallback as $ly
|
|
|
12
12
|
* governing permissions and limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
function $e672e8bc247525d1$export$926850f6ecef79d0(props) {
|
|
15
|
-
let { acceptedDragTypes: acceptedDragTypes =
|
|
15
|
+
let { acceptedDragTypes: acceptedDragTypes = 'all', isDisabled: isDisabled, onInsert: onInsert, onRootDrop: onRootDrop, onItemDrop: onItemDrop, onReorder: onReorder, shouldAcceptItemDrop: shouldAcceptItemDrop, collection: collection, selectionManager: selectionManager, onDropEnter: onDropEnter, getDropOperation: getDropOperation, onDrop: onDrop } = props;
|
|
16
16
|
let [target, setTarget] = (0, $lyPoT$useState)(null);
|
|
17
17
|
let targetRef = (0, $lyPoT$useRef)(null);
|
|
18
18
|
let getOppositeTarget = (target)=>{
|
|
19
|
-
if (target.dropPosition ===
|
|
19
|
+
if (target.dropPosition === 'before') {
|
|
20
20
|
let key = collection.getKeyBefore(target.key);
|
|
21
21
|
return key != null ? {
|
|
22
|
-
type:
|
|
22
|
+
type: 'item',
|
|
23
23
|
key: key,
|
|
24
|
-
dropPosition:
|
|
24
|
+
dropPosition: 'after'
|
|
25
25
|
} : null;
|
|
26
|
-
} else if (target.dropPosition ===
|
|
26
|
+
} else if (target.dropPosition === 'after') {
|
|
27
27
|
let key = collection.getKeyAfter(target.key);
|
|
28
28
|
return key != null ? {
|
|
29
|
-
type:
|
|
29
|
+
type: 'item',
|
|
30
30
|
key: key,
|
|
31
|
-
dropPosition:
|
|
31
|
+
dropPosition: 'before'
|
|
32
32
|
} : null;
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
let defaultGetDropOperation = (0, $lyPoT$useCallback)((e)=>{
|
|
36
|
-
if (isDisabled) return
|
|
36
|
+
if (isDisabled) return 'cancel';
|
|
37
37
|
let { target: target, types: types, allowedOperations: allowedOperations, isInternal: isInternal, draggingKeys: draggingKeys } = e;
|
|
38
|
-
if (acceptedDragTypes ===
|
|
39
|
-
let isValidInsert = onInsert && target.type ===
|
|
40
|
-
let isValidReorder = onReorder && target.type ===
|
|
38
|
+
if (acceptedDragTypes === 'all' || acceptedDragTypes.some((type)=>types.has(type))) {
|
|
39
|
+
let isValidInsert = onInsert && target.type === 'item' && !isInternal && (target.dropPosition === 'before' || target.dropPosition === 'after');
|
|
40
|
+
let isValidReorder = onReorder && target.type === 'item' && isInternal && (target.dropPosition === 'before' || target.dropPosition === 'after');
|
|
41
41
|
// Feedback was that internal root drop was weird so preventing that from happening
|
|
42
|
-
let isValidRootDrop = onRootDrop && target.type ===
|
|
42
|
+
let isValidRootDrop = onRootDrop && target.type === 'root' && !isInternal;
|
|
43
43
|
// Automatically prevent items (i.e. folders) from being dropped on themselves.
|
|
44
|
-
let isValidOnItemDrop = onItemDrop && target.type ===
|
|
44
|
+
let isValidOnItemDrop = onItemDrop && target.type === 'item' && target.dropPosition === 'on' && !(isInternal && draggingKeys.has(target.key)) && (!shouldAcceptItemDrop || shouldAcceptItemDrop(target, types));
|
|
45
45
|
if (onDrop || isValidInsert || isValidReorder || isValidRootDrop || isValidOnItemDrop) {
|
|
46
46
|
if (getDropOperation) return getDropOperation(target, types, allowedOperations);
|
|
47
47
|
else return allowedOperations[0];
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
return
|
|
50
|
+
return 'cancel';
|
|
51
51
|
}, [
|
|
52
52
|
isDisabled,
|
|
53
53
|
acceptedDragTypes,
|
|
@@ -67,14 +67,14 @@ function $e672e8bc247525d1$export$926850f6ecef79d0(props) {
|
|
|
67
67
|
setTarget (newTarget) {
|
|
68
68
|
if (this.isDropTarget(newTarget)) return;
|
|
69
69
|
let target = targetRef.current;
|
|
70
|
-
if (target && typeof props.onDropExit ===
|
|
71
|
-
type:
|
|
70
|
+
if (target && typeof props.onDropExit === 'function') props.onDropExit({
|
|
71
|
+
type: 'dropexit',
|
|
72
72
|
x: 0,
|
|
73
73
|
y: 0,
|
|
74
74
|
target: target
|
|
75
75
|
});
|
|
76
|
-
if (newTarget && typeof onDropEnter ===
|
|
77
|
-
type:
|
|
76
|
+
if (newTarget && typeof onDropEnter === 'function') onDropEnter({
|
|
77
|
+
type: 'dropenter',
|
|
78
78
|
x: 0,
|
|
79
79
|
y: 0,
|
|
80
80
|
target: newTarget
|
|
@@ -86,7 +86,7 @@ function $e672e8bc247525d1$export$926850f6ecef79d0(props) {
|
|
|
86
86
|
let target = targetRef.current;
|
|
87
87
|
if ($e672e8bc247525d1$var$isEqualDropTarget(dropTarget, target)) return true;
|
|
88
88
|
// Check if the targets point at the same point between two items, one referring before, and the other after.
|
|
89
|
-
if ((dropTarget === null || dropTarget === void 0 ? void 0 : dropTarget.type) ===
|
|
89
|
+
if ((dropTarget === null || dropTarget === void 0 ? void 0 : dropTarget.type) === 'item' && (target === null || target === void 0 ? void 0 : target.type) === 'item' && dropTarget.key !== target.key && dropTarget.dropPosition !== target.dropPosition && dropTarget.dropPosition !== 'on' && target.dropPosition !== 'on') return $e672e8bc247525d1$var$isEqualDropTarget(getOppositeTarget(dropTarget), target) || $e672e8bc247525d1$var$isEqualDropTarget(dropTarget, getOppositeTarget(target));
|
|
90
90
|
return false;
|
|
91
91
|
},
|
|
92
92
|
getDropOperation (e) {
|
|
@@ -97,10 +97,10 @@ function $e672e8bc247525d1$export$926850f6ecef79d0(props) {
|
|
|
97
97
|
function $e672e8bc247525d1$var$isEqualDropTarget(a, b) {
|
|
98
98
|
if (!a) return !b;
|
|
99
99
|
switch(a.type){
|
|
100
|
-
case
|
|
101
|
-
return (b === null || b === void 0 ? void 0 : b.type) ===
|
|
102
|
-
case
|
|
103
|
-
return (b === null || b === void 0 ? void 0 : b.type) ===
|
|
100
|
+
case 'root':
|
|
101
|
+
return (b === null || b === void 0 ? void 0 : b.type) === 'root';
|
|
102
|
+
case 'item':
|
|
103
|
+
return (b === null || b === void 0 ? void 0 : b.type) === 'item' && (b === null || b === void 0 ? void 0 : b.key) === a.key && (b === null || b === void 0 ? void 0 : b.dropPosition) === a.dropPosition;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-stately/dnd",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2-nightly.4629+c34886769",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-stately/selection": "3.0.0-nightly.
|
|
26
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
25
|
+
"@react-stately/selection": "3.0.0-nightly.2917+c34886769",
|
|
26
|
+
"@react-types/shared": "3.0.0-nightly.2917+c34886769",
|
|
27
27
|
"@swc/helpers": "^0.5.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "c34886769d3e69bb56553a02eead6a0fd877e754"
|
|
36
36
|
}
|