@almadar/ui 4.50.10 → 4.50.12
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/avl/index.cjs +48 -11
- package/dist/avl/index.js +48 -11
- package/dist/components/index.cjs +48 -11
- package/dist/components/index.js +48 -11
- package/dist/providers/index.cjs +48 -11
- package/dist/providers/index.js +48 -11
- package/dist/runtime/index.cjs +48 -11
- package/dist/runtime/index.js +48 -11
- package/package.json +1 -1
package/dist/avl/index.cjs
CHANGED
|
@@ -24947,6 +24947,7 @@ function useDataDnd(args) {
|
|
|
24947
24947
|
const unregisterZone = React93__namespace.default.useCallback((zoneId2) => {
|
|
24948
24948
|
zonesRef.current.delete(zoneId2);
|
|
24949
24949
|
}, []);
|
|
24950
|
+
const [activeDrag, setActiveDrag] = React93__namespace.default.useState(null);
|
|
24950
24951
|
const zoneId = React93__namespace.default.useId();
|
|
24951
24952
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
24952
24953
|
const meta = React93__namespace.default.useMemo(
|
|
@@ -25127,33 +25128,64 @@ function useDataDnd(args) {
|
|
|
25127
25128
|
id: droppableId,
|
|
25128
25129
|
data: sortableData
|
|
25129
25130
|
});
|
|
25131
|
+
const ctx = React93__namespace.default.useContext(RootCtx);
|
|
25132
|
+
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
25133
|
+
const showForeignPlaceholder = isOver && activeDrag2 != null && activeDrag2.sourceGroup !== ownGroup;
|
|
25134
|
+
dndLog.debug("dropzone:render", {
|
|
25135
|
+
group: ownGroup,
|
|
25136
|
+
isOver,
|
|
25137
|
+
activeDragSourceGroup: activeDrag2?.sourceGroup ?? null,
|
|
25138
|
+
activeDragHeight: activeDrag2?.height ?? null,
|
|
25139
|
+
showForeignPlaceholder,
|
|
25140
|
+
ctxAvailable: ctx != null
|
|
25141
|
+
});
|
|
25130
25142
|
React93__namespace.default.useEffect(() => {
|
|
25131
|
-
dndLog.
|
|
25132
|
-
}, [droppableId, isOver]);
|
|
25133
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
25143
|
+
dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
|
|
25144
|
+
}, [droppableId, isOver, showForeignPlaceholder]);
|
|
25145
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
25134
25146
|
Box,
|
|
25135
25147
|
{
|
|
25136
25148
|
ref: setNodeRef,
|
|
25137
25149
|
"data-dnd-zone": ownGroup,
|
|
25138
25150
|
"data-dnd-is-over": isOver ? "true" : "false",
|
|
25139
25151
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
25140
|
-
children
|
|
25152
|
+
children: [
|
|
25153
|
+
children,
|
|
25154
|
+
showForeignPlaceholder ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
25155
|
+
Box,
|
|
25156
|
+
{
|
|
25157
|
+
"data-dnd-placeholder": true,
|
|
25158
|
+
style: { height: activeDrag2.height },
|
|
25159
|
+
className: "border-2 border-dashed border-primary/60 bg-primary/5 rounded-md my-1 transition-all"
|
|
25160
|
+
}
|
|
25161
|
+
) : null
|
|
25162
|
+
]
|
|
25141
25163
|
}
|
|
25142
25164
|
);
|
|
25143
25165
|
};
|
|
25144
25166
|
const rootContextValue = React93__namespace.default.useMemo(
|
|
25145
|
-
() => ({ registerZone, unregisterZone }),
|
|
25146
|
-
[registerZone, unregisterZone]
|
|
25167
|
+
() => ({ registerZone, unregisterZone, activeDrag }),
|
|
25168
|
+
[registerZone, unregisterZone, activeDrag]
|
|
25147
25169
|
);
|
|
25148
25170
|
const handleDragStart = React93__namespace.default.useCallback((event) => {
|
|
25149
25171
|
const sourceZone = findZoneByItem(event.active.id);
|
|
25172
|
+
const rect = event.active.rect.current.initial;
|
|
25173
|
+
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
25174
|
+
if (sourceZone) {
|
|
25175
|
+
setActiveDrag({ sourceGroup: sourceZone.group, height });
|
|
25176
|
+
dndLog.info("dragStart:activeDrag:set", { sourceGroup: sourceZone.group, height, isRoot, hookZoneId: zoneId });
|
|
25177
|
+
} else {
|
|
25178
|
+
dndLog.warn("dragStart:no-source-zone", { activeId: event.active.id, zoneCount: zonesRef.current.size, isRoot });
|
|
25179
|
+
}
|
|
25150
25180
|
dndLog.info("dragStart", {
|
|
25151
25181
|
activeId: event.active.id,
|
|
25152
25182
|
activeData: event.active.data?.current,
|
|
25153
25183
|
sourceGroup: sourceZone?.group,
|
|
25154
|
-
|
|
25184
|
+
height,
|
|
25185
|
+
zoneCount: zonesRef.current.size,
|
|
25186
|
+
isRoot
|
|
25155
25187
|
});
|
|
25156
|
-
}, [findZoneByItem]);
|
|
25188
|
+
}, [findZoneByItem, isRoot, zoneId]);
|
|
25157
25189
|
const handleDragOver = React93__namespace.default.useCallback((event) => {
|
|
25158
25190
|
dndLog.debug("dragOver", {
|
|
25159
25191
|
activeId: event.active.id,
|
|
@@ -25162,11 +25194,16 @@ function useDataDnd(args) {
|
|
|
25162
25194
|
});
|
|
25163
25195
|
}, []);
|
|
25164
25196
|
const handleDragCancel = React93__namespace.default.useCallback((event) => {
|
|
25197
|
+
setActiveDrag(null);
|
|
25165
25198
|
dndLog.warn("dragCancel", {
|
|
25166
25199
|
activeId: event.active.id,
|
|
25167
25200
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
25168
25201
|
});
|
|
25169
25202
|
}, []);
|
|
25203
|
+
const handleDragEndWithCleanup = React93__namespace.default.useCallback((event) => {
|
|
25204
|
+
handleDragEnd(event);
|
|
25205
|
+
setActiveDrag(null);
|
|
25206
|
+
}, [handleDragEnd]);
|
|
25170
25207
|
const wrapContainer = React93__namespace.default.useCallback(
|
|
25171
25208
|
(children) => {
|
|
25172
25209
|
if (!enabled) return children;
|
|
@@ -25180,7 +25217,7 @@ function useDataDnd(args) {
|
|
|
25180
25217
|
collisionDetection,
|
|
25181
25218
|
onDragStart: handleDragStart,
|
|
25182
25219
|
onDragOver: handleDragOver,
|
|
25183
|
-
onDragEnd:
|
|
25220
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
25184
25221
|
onDragCancel: handleDragCancel,
|
|
25185
25222
|
children
|
|
25186
25223
|
}
|
|
@@ -25195,7 +25232,7 @@ function useDataDnd(args) {
|
|
|
25195
25232
|
collisionDetection,
|
|
25196
25233
|
onDragStart: handleDragStart,
|
|
25197
25234
|
onDragOver: handleDragOver,
|
|
25198
|
-
onDragEnd:
|
|
25235
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
25199
25236
|
onDragCancel: handleDragCancel,
|
|
25200
25237
|
children: inner
|
|
25201
25238
|
}
|
|
@@ -25203,7 +25240,7 @@ function useDataDnd(args) {
|
|
|
25203
25240
|
}
|
|
25204
25241
|
return inner;
|
|
25205
25242
|
},
|
|
25206
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver,
|
|
25243
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
25207
25244
|
);
|
|
25208
25245
|
return {
|
|
25209
25246
|
enabled,
|
package/dist/avl/index.js
CHANGED
|
@@ -24901,6 +24901,7 @@ function useDataDnd(args) {
|
|
|
24901
24901
|
const unregisterZone = React93__default.useCallback((zoneId2) => {
|
|
24902
24902
|
zonesRef.current.delete(zoneId2);
|
|
24903
24903
|
}, []);
|
|
24904
|
+
const [activeDrag, setActiveDrag] = React93__default.useState(null);
|
|
24904
24905
|
const zoneId = React93__default.useId();
|
|
24905
24906
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
24906
24907
|
const meta = React93__default.useMemo(
|
|
@@ -25081,33 +25082,64 @@ function useDataDnd(args) {
|
|
|
25081
25082
|
id: droppableId,
|
|
25082
25083
|
data: sortableData
|
|
25083
25084
|
});
|
|
25085
|
+
const ctx = React93__default.useContext(RootCtx);
|
|
25086
|
+
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
25087
|
+
const showForeignPlaceholder = isOver && activeDrag2 != null && activeDrag2.sourceGroup !== ownGroup;
|
|
25088
|
+
dndLog.debug("dropzone:render", {
|
|
25089
|
+
group: ownGroup,
|
|
25090
|
+
isOver,
|
|
25091
|
+
activeDragSourceGroup: activeDrag2?.sourceGroup ?? null,
|
|
25092
|
+
activeDragHeight: activeDrag2?.height ?? null,
|
|
25093
|
+
showForeignPlaceholder,
|
|
25094
|
+
ctxAvailable: ctx != null
|
|
25095
|
+
});
|
|
25084
25096
|
React93__default.useEffect(() => {
|
|
25085
|
-
dndLog.
|
|
25086
|
-
}, [droppableId, isOver]);
|
|
25087
|
-
return /* @__PURE__ */
|
|
25097
|
+
dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
|
|
25098
|
+
}, [droppableId, isOver, showForeignPlaceholder]);
|
|
25099
|
+
return /* @__PURE__ */ jsxs(
|
|
25088
25100
|
Box,
|
|
25089
25101
|
{
|
|
25090
25102
|
ref: setNodeRef,
|
|
25091
25103
|
"data-dnd-zone": ownGroup,
|
|
25092
25104
|
"data-dnd-is-over": isOver ? "true" : "false",
|
|
25093
25105
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
25094
|
-
children
|
|
25106
|
+
children: [
|
|
25107
|
+
children,
|
|
25108
|
+
showForeignPlaceholder ? /* @__PURE__ */ jsx(
|
|
25109
|
+
Box,
|
|
25110
|
+
{
|
|
25111
|
+
"data-dnd-placeholder": true,
|
|
25112
|
+
style: { height: activeDrag2.height },
|
|
25113
|
+
className: "border-2 border-dashed border-primary/60 bg-primary/5 rounded-md my-1 transition-all"
|
|
25114
|
+
}
|
|
25115
|
+
) : null
|
|
25116
|
+
]
|
|
25095
25117
|
}
|
|
25096
25118
|
);
|
|
25097
25119
|
};
|
|
25098
25120
|
const rootContextValue = React93__default.useMemo(
|
|
25099
|
-
() => ({ registerZone, unregisterZone }),
|
|
25100
|
-
[registerZone, unregisterZone]
|
|
25121
|
+
() => ({ registerZone, unregisterZone, activeDrag }),
|
|
25122
|
+
[registerZone, unregisterZone, activeDrag]
|
|
25101
25123
|
);
|
|
25102
25124
|
const handleDragStart = React93__default.useCallback((event) => {
|
|
25103
25125
|
const sourceZone = findZoneByItem(event.active.id);
|
|
25126
|
+
const rect = event.active.rect.current.initial;
|
|
25127
|
+
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
25128
|
+
if (sourceZone) {
|
|
25129
|
+
setActiveDrag({ sourceGroup: sourceZone.group, height });
|
|
25130
|
+
dndLog.info("dragStart:activeDrag:set", { sourceGroup: sourceZone.group, height, isRoot, hookZoneId: zoneId });
|
|
25131
|
+
} else {
|
|
25132
|
+
dndLog.warn("dragStart:no-source-zone", { activeId: event.active.id, zoneCount: zonesRef.current.size, isRoot });
|
|
25133
|
+
}
|
|
25104
25134
|
dndLog.info("dragStart", {
|
|
25105
25135
|
activeId: event.active.id,
|
|
25106
25136
|
activeData: event.active.data?.current,
|
|
25107
25137
|
sourceGroup: sourceZone?.group,
|
|
25108
|
-
|
|
25138
|
+
height,
|
|
25139
|
+
zoneCount: zonesRef.current.size,
|
|
25140
|
+
isRoot
|
|
25109
25141
|
});
|
|
25110
|
-
}, [findZoneByItem]);
|
|
25142
|
+
}, [findZoneByItem, isRoot, zoneId]);
|
|
25111
25143
|
const handleDragOver = React93__default.useCallback((event) => {
|
|
25112
25144
|
dndLog.debug("dragOver", {
|
|
25113
25145
|
activeId: event.active.id,
|
|
@@ -25116,11 +25148,16 @@ function useDataDnd(args) {
|
|
|
25116
25148
|
});
|
|
25117
25149
|
}, []);
|
|
25118
25150
|
const handleDragCancel = React93__default.useCallback((event) => {
|
|
25151
|
+
setActiveDrag(null);
|
|
25119
25152
|
dndLog.warn("dragCancel", {
|
|
25120
25153
|
activeId: event.active.id,
|
|
25121
25154
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
25122
25155
|
});
|
|
25123
25156
|
}, []);
|
|
25157
|
+
const handleDragEndWithCleanup = React93__default.useCallback((event) => {
|
|
25158
|
+
handleDragEnd(event);
|
|
25159
|
+
setActiveDrag(null);
|
|
25160
|
+
}, [handleDragEnd]);
|
|
25124
25161
|
const wrapContainer = React93__default.useCallback(
|
|
25125
25162
|
(children) => {
|
|
25126
25163
|
if (!enabled) return children;
|
|
@@ -25134,7 +25171,7 @@ function useDataDnd(args) {
|
|
|
25134
25171
|
collisionDetection,
|
|
25135
25172
|
onDragStart: handleDragStart,
|
|
25136
25173
|
onDragOver: handleDragOver,
|
|
25137
|
-
onDragEnd:
|
|
25174
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
25138
25175
|
onDragCancel: handleDragCancel,
|
|
25139
25176
|
children
|
|
25140
25177
|
}
|
|
@@ -25149,7 +25186,7 @@ function useDataDnd(args) {
|
|
|
25149
25186
|
collisionDetection,
|
|
25150
25187
|
onDragStart: handleDragStart,
|
|
25151
25188
|
onDragOver: handleDragOver,
|
|
25152
|
-
onDragEnd:
|
|
25189
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
25153
25190
|
onDragCancel: handleDragCancel,
|
|
25154
25191
|
children: inner
|
|
25155
25192
|
}
|
|
@@ -25157,7 +25194,7 @@ function useDataDnd(args) {
|
|
|
25157
25194
|
}
|
|
25158
25195
|
return inner;
|
|
25159
25196
|
},
|
|
25160
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver,
|
|
25197
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
25161
25198
|
);
|
|
25162
25199
|
return {
|
|
25163
25200
|
enabled,
|
|
@@ -20114,6 +20114,7 @@ function useDataDnd(args) {
|
|
|
20114
20114
|
const unregisterZone = React75__namespace.default.useCallback((zoneId2) => {
|
|
20115
20115
|
zonesRef.current.delete(zoneId2);
|
|
20116
20116
|
}, []);
|
|
20117
|
+
const [activeDrag, setActiveDrag] = React75__namespace.default.useState(null);
|
|
20117
20118
|
const zoneId = React75__namespace.default.useId();
|
|
20118
20119
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
20119
20120
|
const meta = React75__namespace.default.useMemo(
|
|
@@ -20294,33 +20295,64 @@ function useDataDnd(args) {
|
|
|
20294
20295
|
id: droppableId,
|
|
20295
20296
|
data: sortableData
|
|
20296
20297
|
});
|
|
20298
|
+
const ctx = React75__namespace.default.useContext(RootCtx);
|
|
20299
|
+
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
20300
|
+
const showForeignPlaceholder = isOver && activeDrag2 != null && activeDrag2.sourceGroup !== ownGroup;
|
|
20301
|
+
dndLog.debug("dropzone:render", {
|
|
20302
|
+
group: ownGroup,
|
|
20303
|
+
isOver,
|
|
20304
|
+
activeDragSourceGroup: activeDrag2?.sourceGroup ?? null,
|
|
20305
|
+
activeDragHeight: activeDrag2?.height ?? null,
|
|
20306
|
+
showForeignPlaceholder,
|
|
20307
|
+
ctxAvailable: ctx != null
|
|
20308
|
+
});
|
|
20297
20309
|
React75__namespace.default.useEffect(() => {
|
|
20298
|
-
dndLog.
|
|
20299
|
-
}, [droppableId, isOver]);
|
|
20300
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
20310
|
+
dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
|
|
20311
|
+
}, [droppableId, isOver, showForeignPlaceholder]);
|
|
20312
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20301
20313
|
exports.Box,
|
|
20302
20314
|
{
|
|
20303
20315
|
ref: setNodeRef,
|
|
20304
20316
|
"data-dnd-zone": ownGroup,
|
|
20305
20317
|
"data-dnd-is-over": isOver ? "true" : "false",
|
|
20306
20318
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
20307
|
-
children
|
|
20319
|
+
children: [
|
|
20320
|
+
children,
|
|
20321
|
+
showForeignPlaceholder ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
20322
|
+
exports.Box,
|
|
20323
|
+
{
|
|
20324
|
+
"data-dnd-placeholder": true,
|
|
20325
|
+
style: { height: activeDrag2.height },
|
|
20326
|
+
className: "border-2 border-dashed border-primary/60 bg-primary/5 rounded-md my-1 transition-all"
|
|
20327
|
+
}
|
|
20328
|
+
) : null
|
|
20329
|
+
]
|
|
20308
20330
|
}
|
|
20309
20331
|
);
|
|
20310
20332
|
};
|
|
20311
20333
|
const rootContextValue = React75__namespace.default.useMemo(
|
|
20312
|
-
() => ({ registerZone, unregisterZone }),
|
|
20313
|
-
[registerZone, unregisterZone]
|
|
20334
|
+
() => ({ registerZone, unregisterZone, activeDrag }),
|
|
20335
|
+
[registerZone, unregisterZone, activeDrag]
|
|
20314
20336
|
);
|
|
20315
20337
|
const handleDragStart = React75__namespace.default.useCallback((event) => {
|
|
20316
20338
|
const sourceZone = findZoneByItem(event.active.id);
|
|
20339
|
+
const rect = event.active.rect.current.initial;
|
|
20340
|
+
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
20341
|
+
if (sourceZone) {
|
|
20342
|
+
setActiveDrag({ sourceGroup: sourceZone.group, height });
|
|
20343
|
+
dndLog.info("dragStart:activeDrag:set", { sourceGroup: sourceZone.group, height, isRoot, hookZoneId: zoneId });
|
|
20344
|
+
} else {
|
|
20345
|
+
dndLog.warn("dragStart:no-source-zone", { activeId: event.active.id, zoneCount: zonesRef.current.size, isRoot });
|
|
20346
|
+
}
|
|
20317
20347
|
dndLog.info("dragStart", {
|
|
20318
20348
|
activeId: event.active.id,
|
|
20319
20349
|
activeData: event.active.data?.current,
|
|
20320
20350
|
sourceGroup: sourceZone?.group,
|
|
20321
|
-
|
|
20351
|
+
height,
|
|
20352
|
+
zoneCount: zonesRef.current.size,
|
|
20353
|
+
isRoot
|
|
20322
20354
|
});
|
|
20323
|
-
}, [findZoneByItem]);
|
|
20355
|
+
}, [findZoneByItem, isRoot, zoneId]);
|
|
20324
20356
|
const handleDragOver = React75__namespace.default.useCallback((event) => {
|
|
20325
20357
|
dndLog.debug("dragOver", {
|
|
20326
20358
|
activeId: event.active.id,
|
|
@@ -20329,11 +20361,16 @@ function useDataDnd(args) {
|
|
|
20329
20361
|
});
|
|
20330
20362
|
}, []);
|
|
20331
20363
|
const handleDragCancel = React75__namespace.default.useCallback((event) => {
|
|
20364
|
+
setActiveDrag(null);
|
|
20332
20365
|
dndLog.warn("dragCancel", {
|
|
20333
20366
|
activeId: event.active.id,
|
|
20334
20367
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
20335
20368
|
});
|
|
20336
20369
|
}, []);
|
|
20370
|
+
const handleDragEndWithCleanup = React75__namespace.default.useCallback((event) => {
|
|
20371
|
+
handleDragEnd(event);
|
|
20372
|
+
setActiveDrag(null);
|
|
20373
|
+
}, [handleDragEnd]);
|
|
20337
20374
|
const wrapContainer = React75__namespace.default.useCallback(
|
|
20338
20375
|
(children) => {
|
|
20339
20376
|
if (!enabled) return children;
|
|
@@ -20347,7 +20384,7 @@ function useDataDnd(args) {
|
|
|
20347
20384
|
collisionDetection,
|
|
20348
20385
|
onDragStart: handleDragStart,
|
|
20349
20386
|
onDragOver: handleDragOver,
|
|
20350
|
-
onDragEnd:
|
|
20387
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
20351
20388
|
onDragCancel: handleDragCancel,
|
|
20352
20389
|
children
|
|
20353
20390
|
}
|
|
@@ -20362,7 +20399,7 @@ function useDataDnd(args) {
|
|
|
20362
20399
|
collisionDetection,
|
|
20363
20400
|
onDragStart: handleDragStart,
|
|
20364
20401
|
onDragOver: handleDragOver,
|
|
20365
|
-
onDragEnd:
|
|
20402
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
20366
20403
|
onDragCancel: handleDragCancel,
|
|
20367
20404
|
children: inner
|
|
20368
20405
|
}
|
|
@@ -20370,7 +20407,7 @@ function useDataDnd(args) {
|
|
|
20370
20407
|
}
|
|
20371
20408
|
return inner;
|
|
20372
20409
|
},
|
|
20373
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver,
|
|
20410
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
20374
20411
|
);
|
|
20375
20412
|
return {
|
|
20376
20413
|
enabled,
|
package/dist/components/index.js
CHANGED
|
@@ -20068,6 +20068,7 @@ function useDataDnd(args) {
|
|
|
20068
20068
|
const unregisterZone = React75__default.useCallback((zoneId2) => {
|
|
20069
20069
|
zonesRef.current.delete(zoneId2);
|
|
20070
20070
|
}, []);
|
|
20071
|
+
const [activeDrag, setActiveDrag] = React75__default.useState(null);
|
|
20071
20072
|
const zoneId = React75__default.useId();
|
|
20072
20073
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
20073
20074
|
const meta = React75__default.useMemo(
|
|
@@ -20248,33 +20249,64 @@ function useDataDnd(args) {
|
|
|
20248
20249
|
id: droppableId,
|
|
20249
20250
|
data: sortableData
|
|
20250
20251
|
});
|
|
20252
|
+
const ctx = React75__default.useContext(RootCtx);
|
|
20253
|
+
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
20254
|
+
const showForeignPlaceholder = isOver && activeDrag2 != null && activeDrag2.sourceGroup !== ownGroup;
|
|
20255
|
+
dndLog.debug("dropzone:render", {
|
|
20256
|
+
group: ownGroup,
|
|
20257
|
+
isOver,
|
|
20258
|
+
activeDragSourceGroup: activeDrag2?.sourceGroup ?? null,
|
|
20259
|
+
activeDragHeight: activeDrag2?.height ?? null,
|
|
20260
|
+
showForeignPlaceholder,
|
|
20261
|
+
ctxAvailable: ctx != null
|
|
20262
|
+
});
|
|
20251
20263
|
React75__default.useEffect(() => {
|
|
20252
|
-
dndLog.
|
|
20253
|
-
}, [droppableId, isOver]);
|
|
20254
|
-
return /* @__PURE__ */
|
|
20264
|
+
dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
|
|
20265
|
+
}, [droppableId, isOver, showForeignPlaceholder]);
|
|
20266
|
+
return /* @__PURE__ */ jsxs(
|
|
20255
20267
|
Box,
|
|
20256
20268
|
{
|
|
20257
20269
|
ref: setNodeRef,
|
|
20258
20270
|
"data-dnd-zone": ownGroup,
|
|
20259
20271
|
"data-dnd-is-over": isOver ? "true" : "false",
|
|
20260
20272
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
20261
|
-
children
|
|
20273
|
+
children: [
|
|
20274
|
+
children,
|
|
20275
|
+
showForeignPlaceholder ? /* @__PURE__ */ jsx(
|
|
20276
|
+
Box,
|
|
20277
|
+
{
|
|
20278
|
+
"data-dnd-placeholder": true,
|
|
20279
|
+
style: { height: activeDrag2.height },
|
|
20280
|
+
className: "border-2 border-dashed border-primary/60 bg-primary/5 rounded-md my-1 transition-all"
|
|
20281
|
+
}
|
|
20282
|
+
) : null
|
|
20283
|
+
]
|
|
20262
20284
|
}
|
|
20263
20285
|
);
|
|
20264
20286
|
};
|
|
20265
20287
|
const rootContextValue = React75__default.useMemo(
|
|
20266
|
-
() => ({ registerZone, unregisterZone }),
|
|
20267
|
-
[registerZone, unregisterZone]
|
|
20288
|
+
() => ({ registerZone, unregisterZone, activeDrag }),
|
|
20289
|
+
[registerZone, unregisterZone, activeDrag]
|
|
20268
20290
|
);
|
|
20269
20291
|
const handleDragStart = React75__default.useCallback((event) => {
|
|
20270
20292
|
const sourceZone = findZoneByItem(event.active.id);
|
|
20293
|
+
const rect = event.active.rect.current.initial;
|
|
20294
|
+
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
20295
|
+
if (sourceZone) {
|
|
20296
|
+
setActiveDrag({ sourceGroup: sourceZone.group, height });
|
|
20297
|
+
dndLog.info("dragStart:activeDrag:set", { sourceGroup: sourceZone.group, height, isRoot, hookZoneId: zoneId });
|
|
20298
|
+
} else {
|
|
20299
|
+
dndLog.warn("dragStart:no-source-zone", { activeId: event.active.id, zoneCount: zonesRef.current.size, isRoot });
|
|
20300
|
+
}
|
|
20271
20301
|
dndLog.info("dragStart", {
|
|
20272
20302
|
activeId: event.active.id,
|
|
20273
20303
|
activeData: event.active.data?.current,
|
|
20274
20304
|
sourceGroup: sourceZone?.group,
|
|
20275
|
-
|
|
20305
|
+
height,
|
|
20306
|
+
zoneCount: zonesRef.current.size,
|
|
20307
|
+
isRoot
|
|
20276
20308
|
});
|
|
20277
|
-
}, [findZoneByItem]);
|
|
20309
|
+
}, [findZoneByItem, isRoot, zoneId]);
|
|
20278
20310
|
const handleDragOver = React75__default.useCallback((event) => {
|
|
20279
20311
|
dndLog.debug("dragOver", {
|
|
20280
20312
|
activeId: event.active.id,
|
|
@@ -20283,11 +20315,16 @@ function useDataDnd(args) {
|
|
|
20283
20315
|
});
|
|
20284
20316
|
}, []);
|
|
20285
20317
|
const handleDragCancel = React75__default.useCallback((event) => {
|
|
20318
|
+
setActiveDrag(null);
|
|
20286
20319
|
dndLog.warn("dragCancel", {
|
|
20287
20320
|
activeId: event.active.id,
|
|
20288
20321
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
20289
20322
|
});
|
|
20290
20323
|
}, []);
|
|
20324
|
+
const handleDragEndWithCleanup = React75__default.useCallback((event) => {
|
|
20325
|
+
handleDragEnd(event);
|
|
20326
|
+
setActiveDrag(null);
|
|
20327
|
+
}, [handleDragEnd]);
|
|
20291
20328
|
const wrapContainer = React75__default.useCallback(
|
|
20292
20329
|
(children) => {
|
|
20293
20330
|
if (!enabled) return children;
|
|
@@ -20301,7 +20338,7 @@ function useDataDnd(args) {
|
|
|
20301
20338
|
collisionDetection,
|
|
20302
20339
|
onDragStart: handleDragStart,
|
|
20303
20340
|
onDragOver: handleDragOver,
|
|
20304
|
-
onDragEnd:
|
|
20341
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
20305
20342
|
onDragCancel: handleDragCancel,
|
|
20306
20343
|
children
|
|
20307
20344
|
}
|
|
@@ -20316,7 +20353,7 @@ function useDataDnd(args) {
|
|
|
20316
20353
|
collisionDetection,
|
|
20317
20354
|
onDragStart: handleDragStart,
|
|
20318
20355
|
onDragOver: handleDragOver,
|
|
20319
|
-
onDragEnd:
|
|
20356
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
20320
20357
|
onDragCancel: handleDragCancel,
|
|
20321
20358
|
children: inner
|
|
20322
20359
|
}
|
|
@@ -20324,7 +20361,7 @@ function useDataDnd(args) {
|
|
|
20324
20361
|
}
|
|
20325
20362
|
return inner;
|
|
20326
20363
|
},
|
|
20327
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver,
|
|
20364
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
20328
20365
|
);
|
|
20329
20366
|
return {
|
|
20330
20367
|
enabled,
|
package/dist/providers/index.cjs
CHANGED
|
@@ -21359,6 +21359,7 @@ function useDataDnd(args) {
|
|
|
21359
21359
|
const unregisterZone = React81__namespace.default.useCallback((zoneId2) => {
|
|
21360
21360
|
zonesRef.current.delete(zoneId2);
|
|
21361
21361
|
}, []);
|
|
21362
|
+
const [activeDrag, setActiveDrag] = React81__namespace.default.useState(null);
|
|
21362
21363
|
const zoneId = React81__namespace.default.useId();
|
|
21363
21364
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21364
21365
|
const meta = React81__namespace.default.useMemo(
|
|
@@ -21539,33 +21540,64 @@ function useDataDnd(args) {
|
|
|
21539
21540
|
id: droppableId,
|
|
21540
21541
|
data: sortableData
|
|
21541
21542
|
});
|
|
21543
|
+
const ctx = React81__namespace.default.useContext(RootCtx);
|
|
21544
|
+
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
21545
|
+
const showForeignPlaceholder = isOver && activeDrag2 != null && activeDrag2.sourceGroup !== ownGroup;
|
|
21546
|
+
dndLog.debug("dropzone:render", {
|
|
21547
|
+
group: ownGroup,
|
|
21548
|
+
isOver,
|
|
21549
|
+
activeDragSourceGroup: activeDrag2?.sourceGroup ?? null,
|
|
21550
|
+
activeDragHeight: activeDrag2?.height ?? null,
|
|
21551
|
+
showForeignPlaceholder,
|
|
21552
|
+
ctxAvailable: ctx != null
|
|
21553
|
+
});
|
|
21542
21554
|
React81__namespace.default.useEffect(() => {
|
|
21543
|
-
dndLog.
|
|
21544
|
-
}, [droppableId, isOver]);
|
|
21545
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
21555
|
+
dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
|
|
21556
|
+
}, [droppableId, isOver, showForeignPlaceholder]);
|
|
21557
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21546
21558
|
Box,
|
|
21547
21559
|
{
|
|
21548
21560
|
ref: setNodeRef,
|
|
21549
21561
|
"data-dnd-zone": ownGroup,
|
|
21550
21562
|
"data-dnd-is-over": isOver ? "true" : "false",
|
|
21551
21563
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
21552
|
-
children
|
|
21564
|
+
children: [
|
|
21565
|
+
children,
|
|
21566
|
+
showForeignPlaceholder ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
21567
|
+
Box,
|
|
21568
|
+
{
|
|
21569
|
+
"data-dnd-placeholder": true,
|
|
21570
|
+
style: { height: activeDrag2.height },
|
|
21571
|
+
className: "border-2 border-dashed border-primary/60 bg-primary/5 rounded-md my-1 transition-all"
|
|
21572
|
+
}
|
|
21573
|
+
) : null
|
|
21574
|
+
]
|
|
21553
21575
|
}
|
|
21554
21576
|
);
|
|
21555
21577
|
};
|
|
21556
21578
|
const rootContextValue = React81__namespace.default.useMemo(
|
|
21557
|
-
() => ({ registerZone, unregisterZone }),
|
|
21558
|
-
[registerZone, unregisterZone]
|
|
21579
|
+
() => ({ registerZone, unregisterZone, activeDrag }),
|
|
21580
|
+
[registerZone, unregisterZone, activeDrag]
|
|
21559
21581
|
);
|
|
21560
21582
|
const handleDragStart = React81__namespace.default.useCallback((event) => {
|
|
21561
21583
|
const sourceZone = findZoneByItem(event.active.id);
|
|
21584
|
+
const rect = event.active.rect.current.initial;
|
|
21585
|
+
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
21586
|
+
if (sourceZone) {
|
|
21587
|
+
setActiveDrag({ sourceGroup: sourceZone.group, height });
|
|
21588
|
+
dndLog.info("dragStart:activeDrag:set", { sourceGroup: sourceZone.group, height, isRoot, hookZoneId: zoneId });
|
|
21589
|
+
} else {
|
|
21590
|
+
dndLog.warn("dragStart:no-source-zone", { activeId: event.active.id, zoneCount: zonesRef.current.size, isRoot });
|
|
21591
|
+
}
|
|
21562
21592
|
dndLog.info("dragStart", {
|
|
21563
21593
|
activeId: event.active.id,
|
|
21564
21594
|
activeData: event.active.data?.current,
|
|
21565
21595
|
sourceGroup: sourceZone?.group,
|
|
21566
|
-
|
|
21596
|
+
height,
|
|
21597
|
+
zoneCount: zonesRef.current.size,
|
|
21598
|
+
isRoot
|
|
21567
21599
|
});
|
|
21568
|
-
}, [findZoneByItem]);
|
|
21600
|
+
}, [findZoneByItem, isRoot, zoneId]);
|
|
21569
21601
|
const handleDragOver = React81__namespace.default.useCallback((event) => {
|
|
21570
21602
|
dndLog.debug("dragOver", {
|
|
21571
21603
|
activeId: event.active.id,
|
|
@@ -21574,11 +21606,16 @@ function useDataDnd(args) {
|
|
|
21574
21606
|
});
|
|
21575
21607
|
}, []);
|
|
21576
21608
|
const handleDragCancel = React81__namespace.default.useCallback((event) => {
|
|
21609
|
+
setActiveDrag(null);
|
|
21577
21610
|
dndLog.warn("dragCancel", {
|
|
21578
21611
|
activeId: event.active.id,
|
|
21579
21612
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
21580
21613
|
});
|
|
21581
21614
|
}, []);
|
|
21615
|
+
const handleDragEndWithCleanup = React81__namespace.default.useCallback((event) => {
|
|
21616
|
+
handleDragEnd(event);
|
|
21617
|
+
setActiveDrag(null);
|
|
21618
|
+
}, [handleDragEnd]);
|
|
21582
21619
|
const wrapContainer = React81__namespace.default.useCallback(
|
|
21583
21620
|
(children) => {
|
|
21584
21621
|
if (!enabled) return children;
|
|
@@ -21592,7 +21629,7 @@ function useDataDnd(args) {
|
|
|
21592
21629
|
collisionDetection,
|
|
21593
21630
|
onDragStart: handleDragStart,
|
|
21594
21631
|
onDragOver: handleDragOver,
|
|
21595
|
-
onDragEnd:
|
|
21632
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
21596
21633
|
onDragCancel: handleDragCancel,
|
|
21597
21634
|
children
|
|
21598
21635
|
}
|
|
@@ -21607,7 +21644,7 @@ function useDataDnd(args) {
|
|
|
21607
21644
|
collisionDetection,
|
|
21608
21645
|
onDragStart: handleDragStart,
|
|
21609
21646
|
onDragOver: handleDragOver,
|
|
21610
|
-
onDragEnd:
|
|
21647
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
21611
21648
|
onDragCancel: handleDragCancel,
|
|
21612
21649
|
children: inner
|
|
21613
21650
|
}
|
|
@@ -21615,7 +21652,7 @@ function useDataDnd(args) {
|
|
|
21615
21652
|
}
|
|
21616
21653
|
return inner;
|
|
21617
21654
|
},
|
|
21618
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver,
|
|
21655
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
21619
21656
|
);
|
|
21620
21657
|
return {
|
|
21621
21658
|
enabled,
|
package/dist/providers/index.js
CHANGED
|
@@ -21313,6 +21313,7 @@ function useDataDnd(args) {
|
|
|
21313
21313
|
const unregisterZone = React81__default.useCallback((zoneId2) => {
|
|
21314
21314
|
zonesRef.current.delete(zoneId2);
|
|
21315
21315
|
}, []);
|
|
21316
|
+
const [activeDrag, setActiveDrag] = React81__default.useState(null);
|
|
21316
21317
|
const zoneId = React81__default.useId();
|
|
21317
21318
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21318
21319
|
const meta = React81__default.useMemo(
|
|
@@ -21493,33 +21494,64 @@ function useDataDnd(args) {
|
|
|
21493
21494
|
id: droppableId,
|
|
21494
21495
|
data: sortableData
|
|
21495
21496
|
});
|
|
21497
|
+
const ctx = React81__default.useContext(RootCtx);
|
|
21498
|
+
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
21499
|
+
const showForeignPlaceholder = isOver && activeDrag2 != null && activeDrag2.sourceGroup !== ownGroup;
|
|
21500
|
+
dndLog.debug("dropzone:render", {
|
|
21501
|
+
group: ownGroup,
|
|
21502
|
+
isOver,
|
|
21503
|
+
activeDragSourceGroup: activeDrag2?.sourceGroup ?? null,
|
|
21504
|
+
activeDragHeight: activeDrag2?.height ?? null,
|
|
21505
|
+
showForeignPlaceholder,
|
|
21506
|
+
ctxAvailable: ctx != null
|
|
21507
|
+
});
|
|
21496
21508
|
React81__default.useEffect(() => {
|
|
21497
|
-
dndLog.
|
|
21498
|
-
}, [droppableId, isOver]);
|
|
21499
|
-
return /* @__PURE__ */
|
|
21509
|
+
dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
|
|
21510
|
+
}, [droppableId, isOver, showForeignPlaceholder]);
|
|
21511
|
+
return /* @__PURE__ */ jsxs(
|
|
21500
21512
|
Box,
|
|
21501
21513
|
{
|
|
21502
21514
|
ref: setNodeRef,
|
|
21503
21515
|
"data-dnd-zone": ownGroup,
|
|
21504
21516
|
"data-dnd-is-over": isOver ? "true" : "false",
|
|
21505
21517
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
21506
|
-
children
|
|
21518
|
+
children: [
|
|
21519
|
+
children,
|
|
21520
|
+
showForeignPlaceholder ? /* @__PURE__ */ jsx(
|
|
21521
|
+
Box,
|
|
21522
|
+
{
|
|
21523
|
+
"data-dnd-placeholder": true,
|
|
21524
|
+
style: { height: activeDrag2.height },
|
|
21525
|
+
className: "border-2 border-dashed border-primary/60 bg-primary/5 rounded-md my-1 transition-all"
|
|
21526
|
+
}
|
|
21527
|
+
) : null
|
|
21528
|
+
]
|
|
21507
21529
|
}
|
|
21508
21530
|
);
|
|
21509
21531
|
};
|
|
21510
21532
|
const rootContextValue = React81__default.useMemo(
|
|
21511
|
-
() => ({ registerZone, unregisterZone }),
|
|
21512
|
-
[registerZone, unregisterZone]
|
|
21533
|
+
() => ({ registerZone, unregisterZone, activeDrag }),
|
|
21534
|
+
[registerZone, unregisterZone, activeDrag]
|
|
21513
21535
|
);
|
|
21514
21536
|
const handleDragStart = React81__default.useCallback((event) => {
|
|
21515
21537
|
const sourceZone = findZoneByItem(event.active.id);
|
|
21538
|
+
const rect = event.active.rect.current.initial;
|
|
21539
|
+
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
21540
|
+
if (sourceZone) {
|
|
21541
|
+
setActiveDrag({ sourceGroup: sourceZone.group, height });
|
|
21542
|
+
dndLog.info("dragStart:activeDrag:set", { sourceGroup: sourceZone.group, height, isRoot, hookZoneId: zoneId });
|
|
21543
|
+
} else {
|
|
21544
|
+
dndLog.warn("dragStart:no-source-zone", { activeId: event.active.id, zoneCount: zonesRef.current.size, isRoot });
|
|
21545
|
+
}
|
|
21516
21546
|
dndLog.info("dragStart", {
|
|
21517
21547
|
activeId: event.active.id,
|
|
21518
21548
|
activeData: event.active.data?.current,
|
|
21519
21549
|
sourceGroup: sourceZone?.group,
|
|
21520
|
-
|
|
21550
|
+
height,
|
|
21551
|
+
zoneCount: zonesRef.current.size,
|
|
21552
|
+
isRoot
|
|
21521
21553
|
});
|
|
21522
|
-
}, [findZoneByItem]);
|
|
21554
|
+
}, [findZoneByItem, isRoot, zoneId]);
|
|
21523
21555
|
const handleDragOver = React81__default.useCallback((event) => {
|
|
21524
21556
|
dndLog.debug("dragOver", {
|
|
21525
21557
|
activeId: event.active.id,
|
|
@@ -21528,11 +21560,16 @@ function useDataDnd(args) {
|
|
|
21528
21560
|
});
|
|
21529
21561
|
}, []);
|
|
21530
21562
|
const handleDragCancel = React81__default.useCallback((event) => {
|
|
21563
|
+
setActiveDrag(null);
|
|
21531
21564
|
dndLog.warn("dragCancel", {
|
|
21532
21565
|
activeId: event.active.id,
|
|
21533
21566
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
21534
21567
|
});
|
|
21535
21568
|
}, []);
|
|
21569
|
+
const handleDragEndWithCleanup = React81__default.useCallback((event) => {
|
|
21570
|
+
handleDragEnd(event);
|
|
21571
|
+
setActiveDrag(null);
|
|
21572
|
+
}, [handleDragEnd]);
|
|
21536
21573
|
const wrapContainer = React81__default.useCallback(
|
|
21537
21574
|
(children) => {
|
|
21538
21575
|
if (!enabled) return children;
|
|
@@ -21546,7 +21583,7 @@ function useDataDnd(args) {
|
|
|
21546
21583
|
collisionDetection,
|
|
21547
21584
|
onDragStart: handleDragStart,
|
|
21548
21585
|
onDragOver: handleDragOver,
|
|
21549
|
-
onDragEnd:
|
|
21586
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
21550
21587
|
onDragCancel: handleDragCancel,
|
|
21551
21588
|
children
|
|
21552
21589
|
}
|
|
@@ -21561,7 +21598,7 @@ function useDataDnd(args) {
|
|
|
21561
21598
|
collisionDetection,
|
|
21562
21599
|
onDragStart: handleDragStart,
|
|
21563
21600
|
onDragOver: handleDragOver,
|
|
21564
|
-
onDragEnd:
|
|
21601
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
21565
21602
|
onDragCancel: handleDragCancel,
|
|
21566
21603
|
children: inner
|
|
21567
21604
|
}
|
|
@@ -21569,7 +21606,7 @@ function useDataDnd(args) {
|
|
|
21569
21606
|
}
|
|
21570
21607
|
return inner;
|
|
21571
21608
|
},
|
|
21572
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver,
|
|
21609
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
21573
21610
|
);
|
|
21574
21611
|
return {
|
|
21575
21612
|
enabled,
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -21128,6 +21128,7 @@ function useDataDnd(args) {
|
|
|
21128
21128
|
const unregisterZone = React80__namespace.default.useCallback((zoneId2) => {
|
|
21129
21129
|
zonesRef.current.delete(zoneId2);
|
|
21130
21130
|
}, []);
|
|
21131
|
+
const [activeDrag, setActiveDrag] = React80__namespace.default.useState(null);
|
|
21131
21132
|
const zoneId = React80__namespace.default.useId();
|
|
21132
21133
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21133
21134
|
const meta = React80__namespace.default.useMemo(
|
|
@@ -21308,33 +21309,64 @@ function useDataDnd(args) {
|
|
|
21308
21309
|
id: droppableId,
|
|
21309
21310
|
data: sortableData
|
|
21310
21311
|
});
|
|
21312
|
+
const ctx = React80__namespace.default.useContext(RootCtx);
|
|
21313
|
+
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
21314
|
+
const showForeignPlaceholder = isOver && activeDrag2 != null && activeDrag2.sourceGroup !== ownGroup;
|
|
21315
|
+
dndLog.debug("dropzone:render", {
|
|
21316
|
+
group: ownGroup,
|
|
21317
|
+
isOver,
|
|
21318
|
+
activeDragSourceGroup: activeDrag2?.sourceGroup ?? null,
|
|
21319
|
+
activeDragHeight: activeDrag2?.height ?? null,
|
|
21320
|
+
showForeignPlaceholder,
|
|
21321
|
+
ctxAvailable: ctx != null
|
|
21322
|
+
});
|
|
21311
21323
|
React80__namespace.default.useEffect(() => {
|
|
21312
|
-
dndLog.
|
|
21313
|
-
}, [droppableId, isOver]);
|
|
21314
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
21324
|
+
dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
|
|
21325
|
+
}, [droppableId, isOver, showForeignPlaceholder]);
|
|
21326
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21315
21327
|
Box,
|
|
21316
21328
|
{
|
|
21317
21329
|
ref: setNodeRef,
|
|
21318
21330
|
"data-dnd-zone": ownGroup,
|
|
21319
21331
|
"data-dnd-is-over": isOver ? "true" : "false",
|
|
21320
21332
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
21321
|
-
children
|
|
21333
|
+
children: [
|
|
21334
|
+
children,
|
|
21335
|
+
showForeignPlaceholder ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
21336
|
+
Box,
|
|
21337
|
+
{
|
|
21338
|
+
"data-dnd-placeholder": true,
|
|
21339
|
+
style: { height: activeDrag2.height },
|
|
21340
|
+
className: "border-2 border-dashed border-primary/60 bg-primary/5 rounded-md my-1 transition-all"
|
|
21341
|
+
}
|
|
21342
|
+
) : null
|
|
21343
|
+
]
|
|
21322
21344
|
}
|
|
21323
21345
|
);
|
|
21324
21346
|
};
|
|
21325
21347
|
const rootContextValue = React80__namespace.default.useMemo(
|
|
21326
|
-
() => ({ registerZone, unregisterZone }),
|
|
21327
|
-
[registerZone, unregisterZone]
|
|
21348
|
+
() => ({ registerZone, unregisterZone, activeDrag }),
|
|
21349
|
+
[registerZone, unregisterZone, activeDrag]
|
|
21328
21350
|
);
|
|
21329
21351
|
const handleDragStart = React80__namespace.default.useCallback((event) => {
|
|
21330
21352
|
const sourceZone = findZoneByItem(event.active.id);
|
|
21353
|
+
const rect = event.active.rect.current.initial;
|
|
21354
|
+
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
21355
|
+
if (sourceZone) {
|
|
21356
|
+
setActiveDrag({ sourceGroup: sourceZone.group, height });
|
|
21357
|
+
dndLog.info("dragStart:activeDrag:set", { sourceGroup: sourceZone.group, height, isRoot, hookZoneId: zoneId });
|
|
21358
|
+
} else {
|
|
21359
|
+
dndLog.warn("dragStart:no-source-zone", { activeId: event.active.id, zoneCount: zonesRef.current.size, isRoot });
|
|
21360
|
+
}
|
|
21331
21361
|
dndLog.info("dragStart", {
|
|
21332
21362
|
activeId: event.active.id,
|
|
21333
21363
|
activeData: event.active.data?.current,
|
|
21334
21364
|
sourceGroup: sourceZone?.group,
|
|
21335
|
-
|
|
21365
|
+
height,
|
|
21366
|
+
zoneCount: zonesRef.current.size,
|
|
21367
|
+
isRoot
|
|
21336
21368
|
});
|
|
21337
|
-
}, [findZoneByItem]);
|
|
21369
|
+
}, [findZoneByItem, isRoot, zoneId]);
|
|
21338
21370
|
const handleDragOver = React80__namespace.default.useCallback((event) => {
|
|
21339
21371
|
dndLog.debug("dragOver", {
|
|
21340
21372
|
activeId: event.active.id,
|
|
@@ -21343,11 +21375,16 @@ function useDataDnd(args) {
|
|
|
21343
21375
|
});
|
|
21344
21376
|
}, []);
|
|
21345
21377
|
const handleDragCancel = React80__namespace.default.useCallback((event) => {
|
|
21378
|
+
setActiveDrag(null);
|
|
21346
21379
|
dndLog.warn("dragCancel", {
|
|
21347
21380
|
activeId: event.active.id,
|
|
21348
21381
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
21349
21382
|
});
|
|
21350
21383
|
}, []);
|
|
21384
|
+
const handleDragEndWithCleanup = React80__namespace.default.useCallback((event) => {
|
|
21385
|
+
handleDragEnd(event);
|
|
21386
|
+
setActiveDrag(null);
|
|
21387
|
+
}, [handleDragEnd]);
|
|
21351
21388
|
const wrapContainer = React80__namespace.default.useCallback(
|
|
21352
21389
|
(children) => {
|
|
21353
21390
|
if (!enabled) return children;
|
|
@@ -21361,7 +21398,7 @@ function useDataDnd(args) {
|
|
|
21361
21398
|
collisionDetection,
|
|
21362
21399
|
onDragStart: handleDragStart,
|
|
21363
21400
|
onDragOver: handleDragOver,
|
|
21364
|
-
onDragEnd:
|
|
21401
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
21365
21402
|
onDragCancel: handleDragCancel,
|
|
21366
21403
|
children
|
|
21367
21404
|
}
|
|
@@ -21376,7 +21413,7 @@ function useDataDnd(args) {
|
|
|
21376
21413
|
collisionDetection,
|
|
21377
21414
|
onDragStart: handleDragStart,
|
|
21378
21415
|
onDragOver: handleDragOver,
|
|
21379
|
-
onDragEnd:
|
|
21416
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
21380
21417
|
onDragCancel: handleDragCancel,
|
|
21381
21418
|
children: inner
|
|
21382
21419
|
}
|
|
@@ -21384,7 +21421,7 @@ function useDataDnd(args) {
|
|
|
21384
21421
|
}
|
|
21385
21422
|
return inner;
|
|
21386
21423
|
},
|
|
21387
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver,
|
|
21424
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
21388
21425
|
);
|
|
21389
21426
|
return {
|
|
21390
21427
|
enabled,
|
package/dist/runtime/index.js
CHANGED
|
@@ -21082,6 +21082,7 @@ function useDataDnd(args) {
|
|
|
21082
21082
|
const unregisterZone = React80__default.useCallback((zoneId2) => {
|
|
21083
21083
|
zonesRef.current.delete(zoneId2);
|
|
21084
21084
|
}, []);
|
|
21085
|
+
const [activeDrag, setActiveDrag] = React80__default.useState(null);
|
|
21085
21086
|
const zoneId = React80__default.useId();
|
|
21086
21087
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21087
21088
|
const meta = React80__default.useMemo(
|
|
@@ -21262,33 +21263,64 @@ function useDataDnd(args) {
|
|
|
21262
21263
|
id: droppableId,
|
|
21263
21264
|
data: sortableData
|
|
21264
21265
|
});
|
|
21266
|
+
const ctx = React80__default.useContext(RootCtx);
|
|
21267
|
+
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
21268
|
+
const showForeignPlaceholder = isOver && activeDrag2 != null && activeDrag2.sourceGroup !== ownGroup;
|
|
21269
|
+
dndLog.debug("dropzone:render", {
|
|
21270
|
+
group: ownGroup,
|
|
21271
|
+
isOver,
|
|
21272
|
+
activeDragSourceGroup: activeDrag2?.sourceGroup ?? null,
|
|
21273
|
+
activeDragHeight: activeDrag2?.height ?? null,
|
|
21274
|
+
showForeignPlaceholder,
|
|
21275
|
+
ctxAvailable: ctx != null
|
|
21276
|
+
});
|
|
21265
21277
|
React80__default.useEffect(() => {
|
|
21266
|
-
dndLog.
|
|
21267
|
-
}, [droppableId, isOver]);
|
|
21268
|
-
return /* @__PURE__ */
|
|
21278
|
+
dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
|
|
21279
|
+
}, [droppableId, isOver, showForeignPlaceholder]);
|
|
21280
|
+
return /* @__PURE__ */ jsxs(
|
|
21269
21281
|
Box,
|
|
21270
21282
|
{
|
|
21271
21283
|
ref: setNodeRef,
|
|
21272
21284
|
"data-dnd-zone": ownGroup,
|
|
21273
21285
|
"data-dnd-is-over": isOver ? "true" : "false",
|
|
21274
21286
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
21275
|
-
children
|
|
21287
|
+
children: [
|
|
21288
|
+
children,
|
|
21289
|
+
showForeignPlaceholder ? /* @__PURE__ */ jsx(
|
|
21290
|
+
Box,
|
|
21291
|
+
{
|
|
21292
|
+
"data-dnd-placeholder": true,
|
|
21293
|
+
style: { height: activeDrag2.height },
|
|
21294
|
+
className: "border-2 border-dashed border-primary/60 bg-primary/5 rounded-md my-1 transition-all"
|
|
21295
|
+
}
|
|
21296
|
+
) : null
|
|
21297
|
+
]
|
|
21276
21298
|
}
|
|
21277
21299
|
);
|
|
21278
21300
|
};
|
|
21279
21301
|
const rootContextValue = React80__default.useMemo(
|
|
21280
|
-
() => ({ registerZone, unregisterZone }),
|
|
21281
|
-
[registerZone, unregisterZone]
|
|
21302
|
+
() => ({ registerZone, unregisterZone, activeDrag }),
|
|
21303
|
+
[registerZone, unregisterZone, activeDrag]
|
|
21282
21304
|
);
|
|
21283
21305
|
const handleDragStart = React80__default.useCallback((event) => {
|
|
21284
21306
|
const sourceZone = findZoneByItem(event.active.id);
|
|
21307
|
+
const rect = event.active.rect.current.initial;
|
|
21308
|
+
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
21309
|
+
if (sourceZone) {
|
|
21310
|
+
setActiveDrag({ sourceGroup: sourceZone.group, height });
|
|
21311
|
+
dndLog.info("dragStart:activeDrag:set", { sourceGroup: sourceZone.group, height, isRoot, hookZoneId: zoneId });
|
|
21312
|
+
} else {
|
|
21313
|
+
dndLog.warn("dragStart:no-source-zone", { activeId: event.active.id, zoneCount: zonesRef.current.size, isRoot });
|
|
21314
|
+
}
|
|
21285
21315
|
dndLog.info("dragStart", {
|
|
21286
21316
|
activeId: event.active.id,
|
|
21287
21317
|
activeData: event.active.data?.current,
|
|
21288
21318
|
sourceGroup: sourceZone?.group,
|
|
21289
|
-
|
|
21319
|
+
height,
|
|
21320
|
+
zoneCount: zonesRef.current.size,
|
|
21321
|
+
isRoot
|
|
21290
21322
|
});
|
|
21291
|
-
}, [findZoneByItem]);
|
|
21323
|
+
}, [findZoneByItem, isRoot, zoneId]);
|
|
21292
21324
|
const handleDragOver = React80__default.useCallback((event) => {
|
|
21293
21325
|
dndLog.debug("dragOver", {
|
|
21294
21326
|
activeId: event.active.id,
|
|
@@ -21297,11 +21329,16 @@ function useDataDnd(args) {
|
|
|
21297
21329
|
});
|
|
21298
21330
|
}, []);
|
|
21299
21331
|
const handleDragCancel = React80__default.useCallback((event) => {
|
|
21332
|
+
setActiveDrag(null);
|
|
21300
21333
|
dndLog.warn("dragCancel", {
|
|
21301
21334
|
activeId: event.active.id,
|
|
21302
21335
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
21303
21336
|
});
|
|
21304
21337
|
}, []);
|
|
21338
|
+
const handleDragEndWithCleanup = React80__default.useCallback((event) => {
|
|
21339
|
+
handleDragEnd(event);
|
|
21340
|
+
setActiveDrag(null);
|
|
21341
|
+
}, [handleDragEnd]);
|
|
21305
21342
|
const wrapContainer = React80__default.useCallback(
|
|
21306
21343
|
(children) => {
|
|
21307
21344
|
if (!enabled) return children;
|
|
@@ -21315,7 +21352,7 @@ function useDataDnd(args) {
|
|
|
21315
21352
|
collisionDetection,
|
|
21316
21353
|
onDragStart: handleDragStart,
|
|
21317
21354
|
onDragOver: handleDragOver,
|
|
21318
|
-
onDragEnd:
|
|
21355
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
21319
21356
|
onDragCancel: handleDragCancel,
|
|
21320
21357
|
children
|
|
21321
21358
|
}
|
|
@@ -21330,7 +21367,7 @@ function useDataDnd(args) {
|
|
|
21330
21367
|
collisionDetection,
|
|
21331
21368
|
onDragStart: handleDragStart,
|
|
21332
21369
|
onDragOver: handleDragOver,
|
|
21333
|
-
onDragEnd:
|
|
21370
|
+
onDragEnd: handleDragEndWithCleanup,
|
|
21334
21371
|
onDragCancel: handleDragCancel,
|
|
21335
21372
|
children: inner
|
|
21336
21373
|
}
|
|
@@ -21338,7 +21375,7 @@ function useDataDnd(args) {
|
|
|
21338
21375
|
}
|
|
21339
21376
|
return inner;
|
|
21340
21377
|
},
|
|
21341
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver,
|
|
21378
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEndWithCleanup, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
21342
21379
|
);
|
|
21343
21380
|
return {
|
|
21344
21381
|
enabled,
|