@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
package/dist/providers/index.cjs
CHANGED
|
@@ -21369,10 +21369,18 @@ function useDataDnd(args) {
|
|
|
21369
21369
|
const target = isRoot ? null : parentRoot;
|
|
21370
21370
|
if (!target) {
|
|
21371
21371
|
zonesRef.current.set(zoneId, meta);
|
|
21372
|
-
|
|
21372
|
+
dndLog.debug("zone:register:self", { zoneId, group: meta.group, itemCount: meta.itemIds.length, isRoot });
|
|
21373
|
+
return () => {
|
|
21374
|
+
zonesRef.current.delete(zoneId);
|
|
21375
|
+
dndLog.debug("zone:unregister:self", { zoneId, group: meta.group });
|
|
21376
|
+
};
|
|
21373
21377
|
}
|
|
21374
21378
|
target.registerZone(zoneId, meta);
|
|
21375
|
-
|
|
21379
|
+
dndLog.debug("zone:register", { zoneId, group: meta.group, itemCount: meta.itemIds.length, dropEvent: meta.dropEvent, reorderEvent: meta.reorderEvent });
|
|
21380
|
+
return () => {
|
|
21381
|
+
target.unregisterZone(zoneId);
|
|
21382
|
+
dndLog.debug("zone:unregister", { zoneId, group: meta.group });
|
|
21383
|
+
};
|
|
21376
21384
|
}, [parentRoot, isRoot, zoneId, meta]);
|
|
21377
21385
|
const sensors = core$1.useSensors(
|
|
21378
21386
|
core$1.useSensor(core$1.PointerSensor, { activationConstraint: { distance: 5 } }),
|
|
@@ -21380,10 +21388,18 @@ function useDataDnd(args) {
|
|
|
21380
21388
|
);
|
|
21381
21389
|
const collisionDetection = React81__namespace.default.useCallback((args2) => {
|
|
21382
21390
|
const pointerCollisions = core$1.pointerWithin(args2);
|
|
21383
|
-
if (pointerCollisions.length > 0)
|
|
21391
|
+
if (pointerCollisions.length > 0) {
|
|
21392
|
+
dndLog.debug("collision:pointerWithin", { count: pointerCollisions.length, ids: pointerCollisions.map((c) => c.id) });
|
|
21393
|
+
return pointerCollisions;
|
|
21394
|
+
}
|
|
21384
21395
|
const rectCollisions = core$1.rectIntersection(args2);
|
|
21385
|
-
if (rectCollisions.length > 0)
|
|
21386
|
-
|
|
21396
|
+
if (rectCollisions.length > 0) {
|
|
21397
|
+
dndLog.debug("collision:rectIntersection", { count: rectCollisions.length, ids: rectCollisions.map((c) => c.id) });
|
|
21398
|
+
return rectCollisions;
|
|
21399
|
+
}
|
|
21400
|
+
const cornerCollisions = core$1.closestCorners(args2);
|
|
21401
|
+
dndLog.debug("collision:closestCorners", { count: cornerCollisions.length, ids: cornerCollisions.map((c) => c.id) });
|
|
21402
|
+
return cornerCollisions;
|
|
21387
21403
|
}, []);
|
|
21388
21404
|
const findZoneByItem = React81__namespace.default.useCallback(
|
|
21389
21405
|
(id) => {
|
|
@@ -21406,22 +21422,53 @@ function useDataDnd(args) {
|
|
|
21406
21422
|
const handleDragEnd = React81__namespace.default.useCallback(
|
|
21407
21423
|
(event) => {
|
|
21408
21424
|
const { active, over } = event;
|
|
21409
|
-
|
|
21425
|
+
const allZones = Array.from(zonesRef.current.entries()).map(([id, m]) => ({ id, group: m.group, items: m.itemIds.length }));
|
|
21426
|
+
dndLog.debug("dragEnd:received", {
|
|
21427
|
+
activeId: active.id,
|
|
21428
|
+
overId: over?.id,
|
|
21429
|
+
overData: over?.data?.current,
|
|
21430
|
+
zones: allZones
|
|
21431
|
+
});
|
|
21432
|
+
if (!over) {
|
|
21433
|
+
dndLog.warn("dragEnd:abort:no-over", { activeId: active.id, reason: "no droppable under pointer at drop time \u2192 item snaps back" });
|
|
21434
|
+
return;
|
|
21435
|
+
}
|
|
21410
21436
|
const sourceZone = findZoneByItem(active.id);
|
|
21411
21437
|
const overData = over.data?.current;
|
|
21412
21438
|
const targetGroup = overData?.dndGroup;
|
|
21413
|
-
|
|
21439
|
+
dndLog.debug("dragEnd:resolved", { sourceGroup: sourceZone?.group, targetGroup, overDataKeys: overData ? Object.keys(overData) : null });
|
|
21440
|
+
if (!sourceZone) {
|
|
21441
|
+
dndLog.warn("dragEnd:abort:no-source-zone", { activeId: active.id });
|
|
21442
|
+
return;
|
|
21443
|
+
}
|
|
21444
|
+
if (!targetGroup) {
|
|
21445
|
+
dndLog.warn("dragEnd:abort:no-target-group", { overId: over.id, overData });
|
|
21446
|
+
return;
|
|
21447
|
+
}
|
|
21414
21448
|
const targetZone = findZoneByGroup(targetGroup);
|
|
21415
|
-
if (!targetZone)
|
|
21449
|
+
if (!targetZone) {
|
|
21450
|
+
dndLog.warn("dragEnd:abort:target-zone-not-registered", { targetGroup });
|
|
21451
|
+
return;
|
|
21452
|
+
}
|
|
21416
21453
|
if (sourceZone.group !== targetZone.group) {
|
|
21417
21454
|
if (targetZone.dropEvent) {
|
|
21418
21455
|
const newIndex2 = targetZone.itemIds.indexOf(over.id);
|
|
21419
|
-
|
|
21456
|
+
const evt = `UI:${targetZone.dropEvent}`;
|
|
21457
|
+
dndLog.info("dragEnd:cross-container:emit", {
|
|
21458
|
+
event: evt,
|
|
21459
|
+
id: String(active.id),
|
|
21460
|
+
sourceGroup: sourceZone.group,
|
|
21461
|
+
targetGroup: targetZone.group,
|
|
21462
|
+
newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
|
|
21463
|
+
});
|
|
21464
|
+
eventBus.emit(evt, {
|
|
21420
21465
|
id: String(active.id),
|
|
21421
21466
|
sourceGroup: sourceZone.group,
|
|
21422
21467
|
targetGroup: targetZone.group,
|
|
21423
21468
|
newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
|
|
21424
21469
|
});
|
|
21470
|
+
} else {
|
|
21471
|
+
dndLog.warn("dragEnd:cross-container:no-dropEvent-on-target", { targetGroup: targetZone.group });
|
|
21425
21472
|
}
|
|
21426
21473
|
return;
|
|
21427
21474
|
}
|
|
@@ -21433,11 +21480,20 @@ function useDataDnd(args) {
|
|
|
21433
21480
|
setLocalOrder(reordered);
|
|
21434
21481
|
}
|
|
21435
21482
|
if (sourceZone.reorderEvent) {
|
|
21436
|
-
|
|
21483
|
+
const evt = `UI:${sourceZone.reorderEvent}`;
|
|
21484
|
+
dndLog.info("dragEnd:reorder:emit", {
|
|
21485
|
+
event: evt,
|
|
21437
21486
|
id: String(active.id),
|
|
21438
21487
|
oldIndex,
|
|
21439
21488
|
newIndex
|
|
21440
21489
|
});
|
|
21490
|
+
eventBus.emit(evt, {
|
|
21491
|
+
id: String(active.id),
|
|
21492
|
+
oldIndex,
|
|
21493
|
+
newIndex
|
|
21494
|
+
});
|
|
21495
|
+
} else {
|
|
21496
|
+
dndLog.debug("dragEnd:reorder:no-reorderEvent", { sourceGroup: sourceZone.group });
|
|
21441
21497
|
}
|
|
21442
21498
|
},
|
|
21443
21499
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
@@ -21478,15 +21534,20 @@ function useDataDnd(args) {
|
|
|
21478
21534
|
[sortableData, enabled]
|
|
21479
21535
|
);
|
|
21480
21536
|
const DropZoneShell = ({ children }) => {
|
|
21537
|
+
const droppableId = `dnd-zone-${zoneId}`;
|
|
21481
21538
|
const { setNodeRef, isOver } = core$1.useDroppable({
|
|
21482
|
-
id:
|
|
21539
|
+
id: droppableId,
|
|
21483
21540
|
data: sortableData
|
|
21484
21541
|
});
|
|
21542
|
+
React81__namespace.default.useEffect(() => {
|
|
21543
|
+
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver });
|
|
21544
|
+
}, [droppableId, isOver]);
|
|
21485
21545
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21486
21546
|
Box,
|
|
21487
21547
|
{
|
|
21488
21548
|
ref: setNodeRef,
|
|
21489
21549
|
"data-dnd-zone": ownGroup,
|
|
21550
|
+
"data-dnd-is-over": isOver ? "true" : "false",
|
|
21490
21551
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
21491
21552
|
children
|
|
21492
21553
|
}
|
|
@@ -21496,21 +21557,65 @@ function useDataDnd(args) {
|
|
|
21496
21557
|
() => ({ registerZone, unregisterZone }),
|
|
21497
21558
|
[registerZone, unregisterZone]
|
|
21498
21559
|
);
|
|
21560
|
+
const handleDragStart = React81__namespace.default.useCallback((event) => {
|
|
21561
|
+
const sourceZone = findZoneByItem(event.active.id);
|
|
21562
|
+
dndLog.info("dragStart", {
|
|
21563
|
+
activeId: event.active.id,
|
|
21564
|
+
activeData: event.active.data?.current,
|
|
21565
|
+
sourceGroup: sourceZone?.group,
|
|
21566
|
+
zoneCount: zonesRef.current.size
|
|
21567
|
+
});
|
|
21568
|
+
}, [findZoneByItem]);
|
|
21569
|
+
const handleDragOver = React81__namespace.default.useCallback((event) => {
|
|
21570
|
+
dndLog.debug("dragOver", {
|
|
21571
|
+
activeId: event.active.id,
|
|
21572
|
+
overId: event.over?.id,
|
|
21573
|
+
overData: event.over?.data?.current
|
|
21574
|
+
});
|
|
21575
|
+
}, []);
|
|
21576
|
+
const handleDragCancel = React81__namespace.default.useCallback((event) => {
|
|
21577
|
+
dndLog.warn("dragCancel", {
|
|
21578
|
+
activeId: event.active.id,
|
|
21579
|
+
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
21580
|
+
});
|
|
21581
|
+
}, []);
|
|
21499
21582
|
const wrapContainer = React81__namespace.default.useCallback(
|
|
21500
21583
|
(children) => {
|
|
21501
21584
|
if (!enabled) return children;
|
|
21502
21585
|
const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
|
|
21503
21586
|
if (!isZone) {
|
|
21504
21587
|
if (!isRoot) return children;
|
|
21505
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21588
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21589
|
+
core$1.DndContext,
|
|
21590
|
+
{
|
|
21591
|
+
sensors,
|
|
21592
|
+
collisionDetection,
|
|
21593
|
+
onDragStart: handleDragStart,
|
|
21594
|
+
onDragOver: handleDragOver,
|
|
21595
|
+
onDragEnd: handleDragEnd,
|
|
21596
|
+
onDragCancel: handleDragCancel,
|
|
21597
|
+
children
|
|
21598
|
+
}
|
|
21599
|
+
) });
|
|
21506
21600
|
}
|
|
21507
21601
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
|
|
21508
21602
|
if (isRoot) {
|
|
21509
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21603
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21604
|
+
core$1.DndContext,
|
|
21605
|
+
{
|
|
21606
|
+
sensors,
|
|
21607
|
+
collisionDetection,
|
|
21608
|
+
onDragStart: handleDragStart,
|
|
21609
|
+
onDragOver: handleDragOver,
|
|
21610
|
+
onDragEnd: handleDragEnd,
|
|
21611
|
+
onDragCancel: handleDragCancel,
|
|
21612
|
+
children: inner
|
|
21613
|
+
}
|
|
21614
|
+
) });
|
|
21510
21615
|
}
|
|
21511
21616
|
return inner;
|
|
21512
21617
|
},
|
|
21513
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
21618
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEnd, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
21514
21619
|
);
|
|
21515
21620
|
return {
|
|
21516
21621
|
enabled,
|
|
@@ -21520,12 +21625,13 @@ function useDataDnd(args) {
|
|
|
21520
21625
|
orderedItems
|
|
21521
21626
|
};
|
|
21522
21627
|
}
|
|
21523
|
-
var RootCtx;
|
|
21628
|
+
var dndLog, RootCtx;
|
|
21524
21629
|
var init_useDataDnd = __esm({
|
|
21525
21630
|
"components/molecules/useDataDnd.tsx"() {
|
|
21526
21631
|
"use client";
|
|
21527
21632
|
init_useEventBus();
|
|
21528
21633
|
init_Box();
|
|
21634
|
+
dndLog = logger.createLogger("almadar:ui:dnd");
|
|
21529
21635
|
RootCtx = React81__namespace.default.createContext(null);
|
|
21530
21636
|
}
|
|
21531
21637
|
});
|
package/dist/providers/index.js
CHANGED
|
@@ -21323,10 +21323,18 @@ function useDataDnd(args) {
|
|
|
21323
21323
|
const target = isRoot ? null : parentRoot;
|
|
21324
21324
|
if (!target) {
|
|
21325
21325
|
zonesRef.current.set(zoneId, meta);
|
|
21326
|
-
|
|
21326
|
+
dndLog.debug("zone:register:self", { zoneId, group: meta.group, itemCount: meta.itemIds.length, isRoot });
|
|
21327
|
+
return () => {
|
|
21328
|
+
zonesRef.current.delete(zoneId);
|
|
21329
|
+
dndLog.debug("zone:unregister:self", { zoneId, group: meta.group });
|
|
21330
|
+
};
|
|
21327
21331
|
}
|
|
21328
21332
|
target.registerZone(zoneId, meta);
|
|
21329
|
-
|
|
21333
|
+
dndLog.debug("zone:register", { zoneId, group: meta.group, itemCount: meta.itemIds.length, dropEvent: meta.dropEvent, reorderEvent: meta.reorderEvent });
|
|
21334
|
+
return () => {
|
|
21335
|
+
target.unregisterZone(zoneId);
|
|
21336
|
+
dndLog.debug("zone:unregister", { zoneId, group: meta.group });
|
|
21337
|
+
};
|
|
21330
21338
|
}, [parentRoot, isRoot, zoneId, meta]);
|
|
21331
21339
|
const sensors = useSensors(
|
|
21332
21340
|
useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
|
|
@@ -21334,10 +21342,18 @@ function useDataDnd(args) {
|
|
|
21334
21342
|
);
|
|
21335
21343
|
const collisionDetection = React81__default.useCallback((args2) => {
|
|
21336
21344
|
const pointerCollisions = pointerWithin(args2);
|
|
21337
|
-
if (pointerCollisions.length > 0)
|
|
21345
|
+
if (pointerCollisions.length > 0) {
|
|
21346
|
+
dndLog.debug("collision:pointerWithin", { count: pointerCollisions.length, ids: pointerCollisions.map((c) => c.id) });
|
|
21347
|
+
return pointerCollisions;
|
|
21348
|
+
}
|
|
21338
21349
|
const rectCollisions = rectIntersection(args2);
|
|
21339
|
-
if (rectCollisions.length > 0)
|
|
21340
|
-
|
|
21350
|
+
if (rectCollisions.length > 0) {
|
|
21351
|
+
dndLog.debug("collision:rectIntersection", { count: rectCollisions.length, ids: rectCollisions.map((c) => c.id) });
|
|
21352
|
+
return rectCollisions;
|
|
21353
|
+
}
|
|
21354
|
+
const cornerCollisions = closestCorners(args2);
|
|
21355
|
+
dndLog.debug("collision:closestCorners", { count: cornerCollisions.length, ids: cornerCollisions.map((c) => c.id) });
|
|
21356
|
+
return cornerCollisions;
|
|
21341
21357
|
}, []);
|
|
21342
21358
|
const findZoneByItem = React81__default.useCallback(
|
|
21343
21359
|
(id) => {
|
|
@@ -21360,22 +21376,53 @@ function useDataDnd(args) {
|
|
|
21360
21376
|
const handleDragEnd = React81__default.useCallback(
|
|
21361
21377
|
(event) => {
|
|
21362
21378
|
const { active, over } = event;
|
|
21363
|
-
|
|
21379
|
+
const allZones = Array.from(zonesRef.current.entries()).map(([id, m]) => ({ id, group: m.group, items: m.itemIds.length }));
|
|
21380
|
+
dndLog.debug("dragEnd:received", {
|
|
21381
|
+
activeId: active.id,
|
|
21382
|
+
overId: over?.id,
|
|
21383
|
+
overData: over?.data?.current,
|
|
21384
|
+
zones: allZones
|
|
21385
|
+
});
|
|
21386
|
+
if (!over) {
|
|
21387
|
+
dndLog.warn("dragEnd:abort:no-over", { activeId: active.id, reason: "no droppable under pointer at drop time \u2192 item snaps back" });
|
|
21388
|
+
return;
|
|
21389
|
+
}
|
|
21364
21390
|
const sourceZone = findZoneByItem(active.id);
|
|
21365
21391
|
const overData = over.data?.current;
|
|
21366
21392
|
const targetGroup = overData?.dndGroup;
|
|
21367
|
-
|
|
21393
|
+
dndLog.debug("dragEnd:resolved", { sourceGroup: sourceZone?.group, targetGroup, overDataKeys: overData ? Object.keys(overData) : null });
|
|
21394
|
+
if (!sourceZone) {
|
|
21395
|
+
dndLog.warn("dragEnd:abort:no-source-zone", { activeId: active.id });
|
|
21396
|
+
return;
|
|
21397
|
+
}
|
|
21398
|
+
if (!targetGroup) {
|
|
21399
|
+
dndLog.warn("dragEnd:abort:no-target-group", { overId: over.id, overData });
|
|
21400
|
+
return;
|
|
21401
|
+
}
|
|
21368
21402
|
const targetZone = findZoneByGroup(targetGroup);
|
|
21369
|
-
if (!targetZone)
|
|
21403
|
+
if (!targetZone) {
|
|
21404
|
+
dndLog.warn("dragEnd:abort:target-zone-not-registered", { targetGroup });
|
|
21405
|
+
return;
|
|
21406
|
+
}
|
|
21370
21407
|
if (sourceZone.group !== targetZone.group) {
|
|
21371
21408
|
if (targetZone.dropEvent) {
|
|
21372
21409
|
const newIndex2 = targetZone.itemIds.indexOf(over.id);
|
|
21373
|
-
|
|
21410
|
+
const evt = `UI:${targetZone.dropEvent}`;
|
|
21411
|
+
dndLog.info("dragEnd:cross-container:emit", {
|
|
21412
|
+
event: evt,
|
|
21413
|
+
id: String(active.id),
|
|
21414
|
+
sourceGroup: sourceZone.group,
|
|
21415
|
+
targetGroup: targetZone.group,
|
|
21416
|
+
newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
|
|
21417
|
+
});
|
|
21418
|
+
eventBus.emit(evt, {
|
|
21374
21419
|
id: String(active.id),
|
|
21375
21420
|
sourceGroup: sourceZone.group,
|
|
21376
21421
|
targetGroup: targetZone.group,
|
|
21377
21422
|
newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
|
|
21378
21423
|
});
|
|
21424
|
+
} else {
|
|
21425
|
+
dndLog.warn("dragEnd:cross-container:no-dropEvent-on-target", { targetGroup: targetZone.group });
|
|
21379
21426
|
}
|
|
21380
21427
|
return;
|
|
21381
21428
|
}
|
|
@@ -21387,11 +21434,20 @@ function useDataDnd(args) {
|
|
|
21387
21434
|
setLocalOrder(reordered);
|
|
21388
21435
|
}
|
|
21389
21436
|
if (sourceZone.reorderEvent) {
|
|
21390
|
-
|
|
21437
|
+
const evt = `UI:${sourceZone.reorderEvent}`;
|
|
21438
|
+
dndLog.info("dragEnd:reorder:emit", {
|
|
21439
|
+
event: evt,
|
|
21391
21440
|
id: String(active.id),
|
|
21392
21441
|
oldIndex,
|
|
21393
21442
|
newIndex
|
|
21394
21443
|
});
|
|
21444
|
+
eventBus.emit(evt, {
|
|
21445
|
+
id: String(active.id),
|
|
21446
|
+
oldIndex,
|
|
21447
|
+
newIndex
|
|
21448
|
+
});
|
|
21449
|
+
} else {
|
|
21450
|
+
dndLog.debug("dragEnd:reorder:no-reorderEvent", { sourceGroup: sourceZone.group });
|
|
21395
21451
|
}
|
|
21396
21452
|
},
|
|
21397
21453
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
@@ -21432,15 +21488,20 @@ function useDataDnd(args) {
|
|
|
21432
21488
|
[sortableData, enabled]
|
|
21433
21489
|
);
|
|
21434
21490
|
const DropZoneShell = ({ children }) => {
|
|
21491
|
+
const droppableId = `dnd-zone-${zoneId}`;
|
|
21435
21492
|
const { setNodeRef, isOver } = useDroppable({
|
|
21436
|
-
id:
|
|
21493
|
+
id: droppableId,
|
|
21437
21494
|
data: sortableData
|
|
21438
21495
|
});
|
|
21496
|
+
React81__default.useEffect(() => {
|
|
21497
|
+
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver });
|
|
21498
|
+
}, [droppableId, isOver]);
|
|
21439
21499
|
return /* @__PURE__ */ jsx(
|
|
21440
21500
|
Box,
|
|
21441
21501
|
{
|
|
21442
21502
|
ref: setNodeRef,
|
|
21443
21503
|
"data-dnd-zone": ownGroup,
|
|
21504
|
+
"data-dnd-is-over": isOver ? "true" : "false",
|
|
21444
21505
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
21445
21506
|
children
|
|
21446
21507
|
}
|
|
@@ -21450,21 +21511,65 @@ function useDataDnd(args) {
|
|
|
21450
21511
|
() => ({ registerZone, unregisterZone }),
|
|
21451
21512
|
[registerZone, unregisterZone]
|
|
21452
21513
|
);
|
|
21514
|
+
const handleDragStart = React81__default.useCallback((event) => {
|
|
21515
|
+
const sourceZone = findZoneByItem(event.active.id);
|
|
21516
|
+
dndLog.info("dragStart", {
|
|
21517
|
+
activeId: event.active.id,
|
|
21518
|
+
activeData: event.active.data?.current,
|
|
21519
|
+
sourceGroup: sourceZone?.group,
|
|
21520
|
+
zoneCount: zonesRef.current.size
|
|
21521
|
+
});
|
|
21522
|
+
}, [findZoneByItem]);
|
|
21523
|
+
const handleDragOver = React81__default.useCallback((event) => {
|
|
21524
|
+
dndLog.debug("dragOver", {
|
|
21525
|
+
activeId: event.active.id,
|
|
21526
|
+
overId: event.over?.id,
|
|
21527
|
+
overData: event.over?.data?.current
|
|
21528
|
+
});
|
|
21529
|
+
}, []);
|
|
21530
|
+
const handleDragCancel = React81__default.useCallback((event) => {
|
|
21531
|
+
dndLog.warn("dragCancel", {
|
|
21532
|
+
activeId: event.active.id,
|
|
21533
|
+
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
21534
|
+
});
|
|
21535
|
+
}, []);
|
|
21453
21536
|
const wrapContainer = React81__default.useCallback(
|
|
21454
21537
|
(children) => {
|
|
21455
21538
|
if (!enabled) return children;
|
|
21456
21539
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
21457
21540
|
if (!isZone) {
|
|
21458
21541
|
if (!isRoot) return children;
|
|
21459
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(
|
|
21542
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(
|
|
21543
|
+
DndContext,
|
|
21544
|
+
{
|
|
21545
|
+
sensors,
|
|
21546
|
+
collisionDetection,
|
|
21547
|
+
onDragStart: handleDragStart,
|
|
21548
|
+
onDragOver: handleDragOver,
|
|
21549
|
+
onDragEnd: handleDragEnd,
|
|
21550
|
+
onDragCancel: handleDragCancel,
|
|
21551
|
+
children
|
|
21552
|
+
}
|
|
21553
|
+
) });
|
|
21460
21554
|
}
|
|
21461
21555
|
const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
|
|
21462
21556
|
if (isRoot) {
|
|
21463
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(
|
|
21557
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(
|
|
21558
|
+
DndContext,
|
|
21559
|
+
{
|
|
21560
|
+
sensors,
|
|
21561
|
+
collisionDetection,
|
|
21562
|
+
onDragStart: handleDragStart,
|
|
21563
|
+
onDragOver: handleDragOver,
|
|
21564
|
+
onDragEnd: handleDragEnd,
|
|
21565
|
+
onDragCancel: handleDragCancel,
|
|
21566
|
+
children: inner
|
|
21567
|
+
}
|
|
21568
|
+
) });
|
|
21464
21569
|
}
|
|
21465
21570
|
return inner;
|
|
21466
21571
|
},
|
|
21467
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
21572
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEnd, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
21468
21573
|
);
|
|
21469
21574
|
return {
|
|
21470
21575
|
enabled,
|
|
@@ -21474,12 +21579,13 @@ function useDataDnd(args) {
|
|
|
21474
21579
|
orderedItems
|
|
21475
21580
|
};
|
|
21476
21581
|
}
|
|
21477
|
-
var RootCtx;
|
|
21582
|
+
var dndLog, RootCtx;
|
|
21478
21583
|
var init_useDataDnd = __esm({
|
|
21479
21584
|
"components/molecules/useDataDnd.tsx"() {
|
|
21480
21585
|
"use client";
|
|
21481
21586
|
init_useEventBus();
|
|
21482
21587
|
init_Box();
|
|
21588
|
+
dndLog = createLogger("almadar:ui:dnd");
|
|
21483
21589
|
RootCtx = React81__default.createContext(null);
|
|
21484
21590
|
}
|
|
21485
21591
|
});
|