@almadar/ui 4.50.5 → 4.50.7
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 +121 -15
- package/dist/avl/index.js +121 -15
- package/dist/components/index.cjs +121 -15
- package/dist/components/index.js +121 -15
- package/dist/providers/index.cjs +121 -15
- package/dist/providers/index.js +121 -15
- package/dist/runtime/index.cjs +121 -15
- package/dist/runtime/index.js +121 -15
- package/package.json +1 -1
|
@@ -20124,10 +20124,18 @@ function useDataDnd(args) {
|
|
|
20124
20124
|
const target = isRoot ? null : parentRoot;
|
|
20125
20125
|
if (!target) {
|
|
20126
20126
|
zonesRef.current.set(zoneId, meta);
|
|
20127
|
-
|
|
20127
|
+
dndLog.debug("zone:register:self", { zoneId, group: meta.group, itemCount: meta.itemIds.length, isRoot });
|
|
20128
|
+
return () => {
|
|
20129
|
+
zonesRef.current.delete(zoneId);
|
|
20130
|
+
dndLog.debug("zone:unregister:self", { zoneId, group: meta.group });
|
|
20131
|
+
};
|
|
20128
20132
|
}
|
|
20129
20133
|
target.registerZone(zoneId, meta);
|
|
20130
|
-
|
|
20134
|
+
dndLog.debug("zone:register", { zoneId, group: meta.group, itemCount: meta.itemIds.length, dropEvent: meta.dropEvent, reorderEvent: meta.reorderEvent });
|
|
20135
|
+
return () => {
|
|
20136
|
+
target.unregisterZone(zoneId);
|
|
20137
|
+
dndLog.debug("zone:unregister", { zoneId, group: meta.group });
|
|
20138
|
+
};
|
|
20131
20139
|
}, [parentRoot, isRoot, zoneId, meta]);
|
|
20132
20140
|
const sensors = core$1.useSensors(
|
|
20133
20141
|
core$1.useSensor(core$1.PointerSensor, { activationConstraint: { distance: 5 } }),
|
|
@@ -20135,10 +20143,18 @@ function useDataDnd(args) {
|
|
|
20135
20143
|
);
|
|
20136
20144
|
const collisionDetection = React75__namespace.default.useCallback((args2) => {
|
|
20137
20145
|
const pointerCollisions = core$1.pointerWithin(args2);
|
|
20138
|
-
if (pointerCollisions.length > 0)
|
|
20146
|
+
if (pointerCollisions.length > 0) {
|
|
20147
|
+
dndLog.debug("collision:pointerWithin", { count: pointerCollisions.length, ids: pointerCollisions.map((c) => c.id) });
|
|
20148
|
+
return pointerCollisions;
|
|
20149
|
+
}
|
|
20139
20150
|
const rectCollisions = core$1.rectIntersection(args2);
|
|
20140
|
-
if (rectCollisions.length > 0)
|
|
20141
|
-
|
|
20151
|
+
if (rectCollisions.length > 0) {
|
|
20152
|
+
dndLog.debug("collision:rectIntersection", { count: rectCollisions.length, ids: rectCollisions.map((c) => c.id) });
|
|
20153
|
+
return rectCollisions;
|
|
20154
|
+
}
|
|
20155
|
+
const cornerCollisions = core$1.closestCorners(args2);
|
|
20156
|
+
dndLog.debug("collision:closestCorners", { count: cornerCollisions.length, ids: cornerCollisions.map((c) => c.id) });
|
|
20157
|
+
return cornerCollisions;
|
|
20142
20158
|
}, []);
|
|
20143
20159
|
const findZoneByItem = React75__namespace.default.useCallback(
|
|
20144
20160
|
(id) => {
|
|
@@ -20161,22 +20177,53 @@ function useDataDnd(args) {
|
|
|
20161
20177
|
const handleDragEnd = React75__namespace.default.useCallback(
|
|
20162
20178
|
(event) => {
|
|
20163
20179
|
const { active, over } = event;
|
|
20164
|
-
|
|
20180
|
+
const allZones = Array.from(zonesRef.current.entries()).map(([id, m]) => ({ id, group: m.group, items: m.itemIds.length }));
|
|
20181
|
+
dndLog.debug("dragEnd:received", {
|
|
20182
|
+
activeId: active.id,
|
|
20183
|
+
overId: over?.id,
|
|
20184
|
+
overData: over?.data?.current,
|
|
20185
|
+
zones: allZones
|
|
20186
|
+
});
|
|
20187
|
+
if (!over) {
|
|
20188
|
+
dndLog.warn("dragEnd:abort:no-over", { activeId: active.id, reason: "no droppable under pointer at drop time \u2192 item snaps back" });
|
|
20189
|
+
return;
|
|
20190
|
+
}
|
|
20165
20191
|
const sourceZone = findZoneByItem(active.id);
|
|
20166
20192
|
const overData = over.data?.current;
|
|
20167
20193
|
const targetGroup = overData?.dndGroup;
|
|
20168
|
-
|
|
20194
|
+
dndLog.debug("dragEnd:resolved", { sourceGroup: sourceZone?.group, targetGroup, overDataKeys: overData ? Object.keys(overData) : null });
|
|
20195
|
+
if (!sourceZone) {
|
|
20196
|
+
dndLog.warn("dragEnd:abort:no-source-zone", { activeId: active.id });
|
|
20197
|
+
return;
|
|
20198
|
+
}
|
|
20199
|
+
if (!targetGroup) {
|
|
20200
|
+
dndLog.warn("dragEnd:abort:no-target-group", { overId: over.id, overData });
|
|
20201
|
+
return;
|
|
20202
|
+
}
|
|
20169
20203
|
const targetZone = findZoneByGroup(targetGroup);
|
|
20170
|
-
if (!targetZone)
|
|
20204
|
+
if (!targetZone) {
|
|
20205
|
+
dndLog.warn("dragEnd:abort:target-zone-not-registered", { targetGroup });
|
|
20206
|
+
return;
|
|
20207
|
+
}
|
|
20171
20208
|
if (sourceZone.group !== targetZone.group) {
|
|
20172
20209
|
if (targetZone.dropEvent) {
|
|
20173
20210
|
const newIndex2 = targetZone.itemIds.indexOf(over.id);
|
|
20174
|
-
|
|
20211
|
+
const evt = `UI:${targetZone.dropEvent}`;
|
|
20212
|
+
dndLog.info("dragEnd:cross-container:emit", {
|
|
20213
|
+
event: evt,
|
|
20175
20214
|
id: String(active.id),
|
|
20176
20215
|
sourceGroup: sourceZone.group,
|
|
20177
20216
|
targetGroup: targetZone.group,
|
|
20178
20217
|
newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
|
|
20179
20218
|
});
|
|
20219
|
+
eventBus.emit(evt, {
|
|
20220
|
+
id: String(active.id),
|
|
20221
|
+
sourceGroup: sourceZone.group,
|
|
20222
|
+
targetGroup: targetZone.group,
|
|
20223
|
+
newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
|
|
20224
|
+
});
|
|
20225
|
+
} else {
|
|
20226
|
+
dndLog.warn("dragEnd:cross-container:no-dropEvent-on-target", { targetGroup: targetZone.group });
|
|
20180
20227
|
}
|
|
20181
20228
|
return;
|
|
20182
20229
|
}
|
|
@@ -20188,11 +20235,20 @@ function useDataDnd(args) {
|
|
|
20188
20235
|
setLocalOrder(reordered);
|
|
20189
20236
|
}
|
|
20190
20237
|
if (sourceZone.reorderEvent) {
|
|
20191
|
-
|
|
20238
|
+
const evt = `UI:${sourceZone.reorderEvent}`;
|
|
20239
|
+
dndLog.info("dragEnd:reorder:emit", {
|
|
20240
|
+
event: evt,
|
|
20192
20241
|
id: String(active.id),
|
|
20193
20242
|
oldIndex,
|
|
20194
20243
|
newIndex
|
|
20195
20244
|
});
|
|
20245
|
+
eventBus.emit(evt, {
|
|
20246
|
+
id: String(active.id),
|
|
20247
|
+
oldIndex,
|
|
20248
|
+
newIndex
|
|
20249
|
+
});
|
|
20250
|
+
} else {
|
|
20251
|
+
dndLog.debug("dragEnd:reorder:no-reorderEvent", { sourceGroup: sourceZone.group });
|
|
20196
20252
|
}
|
|
20197
20253
|
},
|
|
20198
20254
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
@@ -20233,15 +20289,20 @@ function useDataDnd(args) {
|
|
|
20233
20289
|
[sortableData, enabled]
|
|
20234
20290
|
);
|
|
20235
20291
|
const DropZoneShell = ({ children }) => {
|
|
20292
|
+
const droppableId = `dnd-zone-${zoneId}`;
|
|
20236
20293
|
const { setNodeRef, isOver } = core$1.useDroppable({
|
|
20237
|
-
id:
|
|
20294
|
+
id: droppableId,
|
|
20238
20295
|
data: sortableData
|
|
20239
20296
|
});
|
|
20297
|
+
React75__namespace.default.useEffect(() => {
|
|
20298
|
+
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver });
|
|
20299
|
+
}, [droppableId, isOver]);
|
|
20240
20300
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
20241
20301
|
exports.Box,
|
|
20242
20302
|
{
|
|
20243
20303
|
ref: setNodeRef,
|
|
20244
20304
|
"data-dnd-zone": ownGroup,
|
|
20305
|
+
"data-dnd-is-over": isOver ? "true" : "false",
|
|
20245
20306
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
20246
20307
|
children
|
|
20247
20308
|
}
|
|
@@ -20251,21 +20312,65 @@ function useDataDnd(args) {
|
|
|
20251
20312
|
() => ({ registerZone, unregisterZone }),
|
|
20252
20313
|
[registerZone, unregisterZone]
|
|
20253
20314
|
);
|
|
20315
|
+
const handleDragStart = React75__namespace.default.useCallback((event) => {
|
|
20316
|
+
const sourceZone = findZoneByItem(event.active.id);
|
|
20317
|
+
dndLog.info("dragStart", {
|
|
20318
|
+
activeId: event.active.id,
|
|
20319
|
+
activeData: event.active.data?.current,
|
|
20320
|
+
sourceGroup: sourceZone?.group,
|
|
20321
|
+
zoneCount: zonesRef.current.size
|
|
20322
|
+
});
|
|
20323
|
+
}, [findZoneByItem]);
|
|
20324
|
+
const handleDragOver = React75__namespace.default.useCallback((event) => {
|
|
20325
|
+
dndLog.debug("dragOver", {
|
|
20326
|
+
activeId: event.active.id,
|
|
20327
|
+
overId: event.over?.id,
|
|
20328
|
+
overData: event.over?.data?.current
|
|
20329
|
+
});
|
|
20330
|
+
}, []);
|
|
20331
|
+
const handleDragCancel = React75__namespace.default.useCallback((event) => {
|
|
20332
|
+
dndLog.warn("dragCancel", {
|
|
20333
|
+
activeId: event.active.id,
|
|
20334
|
+
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
20335
|
+
});
|
|
20336
|
+
}, []);
|
|
20254
20337
|
const wrapContainer = React75__namespace.default.useCallback(
|
|
20255
20338
|
(children) => {
|
|
20256
20339
|
if (!enabled) return children;
|
|
20257
20340
|
const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
|
|
20258
20341
|
if (!isZone) {
|
|
20259
20342
|
if (!isRoot) return children;
|
|
20260
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
20343
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
20344
|
+
core$1.DndContext,
|
|
20345
|
+
{
|
|
20346
|
+
sensors,
|
|
20347
|
+
collisionDetection,
|
|
20348
|
+
onDragStart: handleDragStart,
|
|
20349
|
+
onDragOver: handleDragOver,
|
|
20350
|
+
onDragEnd: handleDragEnd,
|
|
20351
|
+
onDragCancel: handleDragCancel,
|
|
20352
|
+
children
|
|
20353
|
+
}
|
|
20354
|
+
) });
|
|
20261
20355
|
}
|
|
20262
20356
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
|
|
20263
20357
|
if (isRoot) {
|
|
20264
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
20358
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
20359
|
+
core$1.DndContext,
|
|
20360
|
+
{
|
|
20361
|
+
sensors,
|
|
20362
|
+
collisionDetection,
|
|
20363
|
+
onDragStart: handleDragStart,
|
|
20364
|
+
onDragOver: handleDragOver,
|
|
20365
|
+
onDragEnd: handleDragEnd,
|
|
20366
|
+
onDragCancel: handleDragCancel,
|
|
20367
|
+
children: inner
|
|
20368
|
+
}
|
|
20369
|
+
) });
|
|
20265
20370
|
}
|
|
20266
20371
|
return inner;
|
|
20267
20372
|
},
|
|
20268
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
20373
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEnd, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
20269
20374
|
);
|
|
20270
20375
|
return {
|
|
20271
20376
|
enabled,
|
|
@@ -20275,12 +20380,13 @@ function useDataDnd(args) {
|
|
|
20275
20380
|
orderedItems
|
|
20276
20381
|
};
|
|
20277
20382
|
}
|
|
20278
|
-
var RootCtx;
|
|
20383
|
+
var dndLog, RootCtx;
|
|
20279
20384
|
var init_useDataDnd = __esm({
|
|
20280
20385
|
"components/molecules/useDataDnd.tsx"() {
|
|
20281
20386
|
"use client";
|
|
20282
20387
|
init_useEventBus();
|
|
20283
20388
|
init_Box();
|
|
20389
|
+
dndLog = logger.createLogger("almadar:ui:dnd");
|
|
20284
20390
|
RootCtx = React75__namespace.default.createContext(null);
|
|
20285
20391
|
}
|
|
20286
20392
|
});
|
package/dist/components/index.js
CHANGED
|
@@ -20078,10 +20078,18 @@ function useDataDnd(args) {
|
|
|
20078
20078
|
const target = isRoot ? null : parentRoot;
|
|
20079
20079
|
if (!target) {
|
|
20080
20080
|
zonesRef.current.set(zoneId, meta);
|
|
20081
|
-
|
|
20081
|
+
dndLog.debug("zone:register:self", { zoneId, group: meta.group, itemCount: meta.itemIds.length, isRoot });
|
|
20082
|
+
return () => {
|
|
20083
|
+
zonesRef.current.delete(zoneId);
|
|
20084
|
+
dndLog.debug("zone:unregister:self", { zoneId, group: meta.group });
|
|
20085
|
+
};
|
|
20082
20086
|
}
|
|
20083
20087
|
target.registerZone(zoneId, meta);
|
|
20084
|
-
|
|
20088
|
+
dndLog.debug("zone:register", { zoneId, group: meta.group, itemCount: meta.itemIds.length, dropEvent: meta.dropEvent, reorderEvent: meta.reorderEvent });
|
|
20089
|
+
return () => {
|
|
20090
|
+
target.unregisterZone(zoneId);
|
|
20091
|
+
dndLog.debug("zone:unregister", { zoneId, group: meta.group });
|
|
20092
|
+
};
|
|
20085
20093
|
}, [parentRoot, isRoot, zoneId, meta]);
|
|
20086
20094
|
const sensors = useSensors(
|
|
20087
20095
|
useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
|
|
@@ -20089,10 +20097,18 @@ function useDataDnd(args) {
|
|
|
20089
20097
|
);
|
|
20090
20098
|
const collisionDetection = React75__default.useCallback((args2) => {
|
|
20091
20099
|
const pointerCollisions = pointerWithin(args2);
|
|
20092
|
-
if (pointerCollisions.length > 0)
|
|
20100
|
+
if (pointerCollisions.length > 0) {
|
|
20101
|
+
dndLog.debug("collision:pointerWithin", { count: pointerCollisions.length, ids: pointerCollisions.map((c) => c.id) });
|
|
20102
|
+
return pointerCollisions;
|
|
20103
|
+
}
|
|
20093
20104
|
const rectCollisions = rectIntersection(args2);
|
|
20094
|
-
if (rectCollisions.length > 0)
|
|
20095
|
-
|
|
20105
|
+
if (rectCollisions.length > 0) {
|
|
20106
|
+
dndLog.debug("collision:rectIntersection", { count: rectCollisions.length, ids: rectCollisions.map((c) => c.id) });
|
|
20107
|
+
return rectCollisions;
|
|
20108
|
+
}
|
|
20109
|
+
const cornerCollisions = closestCorners(args2);
|
|
20110
|
+
dndLog.debug("collision:closestCorners", { count: cornerCollisions.length, ids: cornerCollisions.map((c) => c.id) });
|
|
20111
|
+
return cornerCollisions;
|
|
20096
20112
|
}, []);
|
|
20097
20113
|
const findZoneByItem = React75__default.useCallback(
|
|
20098
20114
|
(id) => {
|
|
@@ -20115,22 +20131,53 @@ function useDataDnd(args) {
|
|
|
20115
20131
|
const handleDragEnd = React75__default.useCallback(
|
|
20116
20132
|
(event) => {
|
|
20117
20133
|
const { active, over } = event;
|
|
20118
|
-
|
|
20134
|
+
const allZones = Array.from(zonesRef.current.entries()).map(([id, m]) => ({ id, group: m.group, items: m.itemIds.length }));
|
|
20135
|
+
dndLog.debug("dragEnd:received", {
|
|
20136
|
+
activeId: active.id,
|
|
20137
|
+
overId: over?.id,
|
|
20138
|
+
overData: over?.data?.current,
|
|
20139
|
+
zones: allZones
|
|
20140
|
+
});
|
|
20141
|
+
if (!over) {
|
|
20142
|
+
dndLog.warn("dragEnd:abort:no-over", { activeId: active.id, reason: "no droppable under pointer at drop time \u2192 item snaps back" });
|
|
20143
|
+
return;
|
|
20144
|
+
}
|
|
20119
20145
|
const sourceZone = findZoneByItem(active.id);
|
|
20120
20146
|
const overData = over.data?.current;
|
|
20121
20147
|
const targetGroup = overData?.dndGroup;
|
|
20122
|
-
|
|
20148
|
+
dndLog.debug("dragEnd:resolved", { sourceGroup: sourceZone?.group, targetGroup, overDataKeys: overData ? Object.keys(overData) : null });
|
|
20149
|
+
if (!sourceZone) {
|
|
20150
|
+
dndLog.warn("dragEnd:abort:no-source-zone", { activeId: active.id });
|
|
20151
|
+
return;
|
|
20152
|
+
}
|
|
20153
|
+
if (!targetGroup) {
|
|
20154
|
+
dndLog.warn("dragEnd:abort:no-target-group", { overId: over.id, overData });
|
|
20155
|
+
return;
|
|
20156
|
+
}
|
|
20123
20157
|
const targetZone = findZoneByGroup(targetGroup);
|
|
20124
|
-
if (!targetZone)
|
|
20158
|
+
if (!targetZone) {
|
|
20159
|
+
dndLog.warn("dragEnd:abort:target-zone-not-registered", { targetGroup });
|
|
20160
|
+
return;
|
|
20161
|
+
}
|
|
20125
20162
|
if (sourceZone.group !== targetZone.group) {
|
|
20126
20163
|
if (targetZone.dropEvent) {
|
|
20127
20164
|
const newIndex2 = targetZone.itemIds.indexOf(over.id);
|
|
20128
|
-
|
|
20165
|
+
const evt = `UI:${targetZone.dropEvent}`;
|
|
20166
|
+
dndLog.info("dragEnd:cross-container:emit", {
|
|
20167
|
+
event: evt,
|
|
20129
20168
|
id: String(active.id),
|
|
20130
20169
|
sourceGroup: sourceZone.group,
|
|
20131
20170
|
targetGroup: targetZone.group,
|
|
20132
20171
|
newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
|
|
20133
20172
|
});
|
|
20173
|
+
eventBus.emit(evt, {
|
|
20174
|
+
id: String(active.id),
|
|
20175
|
+
sourceGroup: sourceZone.group,
|
|
20176
|
+
targetGroup: targetZone.group,
|
|
20177
|
+
newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
|
|
20178
|
+
});
|
|
20179
|
+
} else {
|
|
20180
|
+
dndLog.warn("dragEnd:cross-container:no-dropEvent-on-target", { targetGroup: targetZone.group });
|
|
20134
20181
|
}
|
|
20135
20182
|
return;
|
|
20136
20183
|
}
|
|
@@ -20142,11 +20189,20 @@ function useDataDnd(args) {
|
|
|
20142
20189
|
setLocalOrder(reordered);
|
|
20143
20190
|
}
|
|
20144
20191
|
if (sourceZone.reorderEvent) {
|
|
20145
|
-
|
|
20192
|
+
const evt = `UI:${sourceZone.reorderEvent}`;
|
|
20193
|
+
dndLog.info("dragEnd:reorder:emit", {
|
|
20194
|
+
event: evt,
|
|
20146
20195
|
id: String(active.id),
|
|
20147
20196
|
oldIndex,
|
|
20148
20197
|
newIndex
|
|
20149
20198
|
});
|
|
20199
|
+
eventBus.emit(evt, {
|
|
20200
|
+
id: String(active.id),
|
|
20201
|
+
oldIndex,
|
|
20202
|
+
newIndex
|
|
20203
|
+
});
|
|
20204
|
+
} else {
|
|
20205
|
+
dndLog.debug("dragEnd:reorder:no-reorderEvent", { sourceGroup: sourceZone.group });
|
|
20150
20206
|
}
|
|
20151
20207
|
},
|
|
20152
20208
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
@@ -20187,15 +20243,20 @@ function useDataDnd(args) {
|
|
|
20187
20243
|
[sortableData, enabled]
|
|
20188
20244
|
);
|
|
20189
20245
|
const DropZoneShell = ({ children }) => {
|
|
20246
|
+
const droppableId = `dnd-zone-${zoneId}`;
|
|
20190
20247
|
const { setNodeRef, isOver } = useDroppable({
|
|
20191
|
-
id:
|
|
20248
|
+
id: droppableId,
|
|
20192
20249
|
data: sortableData
|
|
20193
20250
|
});
|
|
20251
|
+
React75__default.useEffect(() => {
|
|
20252
|
+
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver });
|
|
20253
|
+
}, [droppableId, isOver]);
|
|
20194
20254
|
return /* @__PURE__ */ jsx(
|
|
20195
20255
|
Box,
|
|
20196
20256
|
{
|
|
20197
20257
|
ref: setNodeRef,
|
|
20198
20258
|
"data-dnd-zone": ownGroup,
|
|
20259
|
+
"data-dnd-is-over": isOver ? "true" : "false",
|
|
20199
20260
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
20200
20261
|
children
|
|
20201
20262
|
}
|
|
@@ -20205,21 +20266,65 @@ function useDataDnd(args) {
|
|
|
20205
20266
|
() => ({ registerZone, unregisterZone }),
|
|
20206
20267
|
[registerZone, unregisterZone]
|
|
20207
20268
|
);
|
|
20269
|
+
const handleDragStart = React75__default.useCallback((event) => {
|
|
20270
|
+
const sourceZone = findZoneByItem(event.active.id);
|
|
20271
|
+
dndLog.info("dragStart", {
|
|
20272
|
+
activeId: event.active.id,
|
|
20273
|
+
activeData: event.active.data?.current,
|
|
20274
|
+
sourceGroup: sourceZone?.group,
|
|
20275
|
+
zoneCount: zonesRef.current.size
|
|
20276
|
+
});
|
|
20277
|
+
}, [findZoneByItem]);
|
|
20278
|
+
const handleDragOver = React75__default.useCallback((event) => {
|
|
20279
|
+
dndLog.debug("dragOver", {
|
|
20280
|
+
activeId: event.active.id,
|
|
20281
|
+
overId: event.over?.id,
|
|
20282
|
+
overData: event.over?.data?.current
|
|
20283
|
+
});
|
|
20284
|
+
}, []);
|
|
20285
|
+
const handleDragCancel = React75__default.useCallback((event) => {
|
|
20286
|
+
dndLog.warn("dragCancel", {
|
|
20287
|
+
activeId: event.active.id,
|
|
20288
|
+
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
20289
|
+
});
|
|
20290
|
+
}, []);
|
|
20208
20291
|
const wrapContainer = React75__default.useCallback(
|
|
20209
20292
|
(children) => {
|
|
20210
20293
|
if (!enabled) return children;
|
|
20211
20294
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
20212
20295
|
if (!isZone) {
|
|
20213
20296
|
if (!isRoot) return children;
|
|
20214
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(
|
|
20297
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(
|
|
20298
|
+
DndContext,
|
|
20299
|
+
{
|
|
20300
|
+
sensors,
|
|
20301
|
+
collisionDetection,
|
|
20302
|
+
onDragStart: handleDragStart,
|
|
20303
|
+
onDragOver: handleDragOver,
|
|
20304
|
+
onDragEnd: handleDragEnd,
|
|
20305
|
+
onDragCancel: handleDragCancel,
|
|
20306
|
+
children
|
|
20307
|
+
}
|
|
20308
|
+
) });
|
|
20215
20309
|
}
|
|
20216
20310
|
const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
|
|
20217
20311
|
if (isRoot) {
|
|
20218
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(
|
|
20312
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(
|
|
20313
|
+
DndContext,
|
|
20314
|
+
{
|
|
20315
|
+
sensors,
|
|
20316
|
+
collisionDetection,
|
|
20317
|
+
onDragStart: handleDragStart,
|
|
20318
|
+
onDragOver: handleDragOver,
|
|
20319
|
+
onDragEnd: handleDragEnd,
|
|
20320
|
+
onDragCancel: handleDragCancel,
|
|
20321
|
+
children: inner
|
|
20322
|
+
}
|
|
20323
|
+
) });
|
|
20219
20324
|
}
|
|
20220
20325
|
return inner;
|
|
20221
20326
|
},
|
|
20222
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
20327
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEnd, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
20223
20328
|
);
|
|
20224
20329
|
return {
|
|
20225
20330
|
enabled,
|
|
@@ -20229,12 +20334,13 @@ function useDataDnd(args) {
|
|
|
20229
20334
|
orderedItems
|
|
20230
20335
|
};
|
|
20231
20336
|
}
|
|
20232
|
-
var RootCtx;
|
|
20337
|
+
var dndLog, RootCtx;
|
|
20233
20338
|
var init_useDataDnd = __esm({
|
|
20234
20339
|
"components/molecules/useDataDnd.tsx"() {
|
|
20235
20340
|
"use client";
|
|
20236
20341
|
init_useEventBus();
|
|
20237
20342
|
init_Box();
|
|
20343
|
+
dndLog = createLogger("almadar:ui:dnd");
|
|
20238
20344
|
RootCtx = React75__default.createContext(null);
|
|
20239
20345
|
}
|
|
20240
20346
|
});
|