@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/runtime/index.cjs
CHANGED
|
@@ -21138,10 +21138,18 @@ function useDataDnd(args) {
|
|
|
21138
21138
|
const target = isRoot ? null : parentRoot;
|
|
21139
21139
|
if (!target) {
|
|
21140
21140
|
zonesRef.current.set(zoneId, meta);
|
|
21141
|
-
|
|
21141
|
+
dndLog.debug("zone:register:self", { zoneId, group: meta.group, itemCount: meta.itemIds.length, isRoot });
|
|
21142
|
+
return () => {
|
|
21143
|
+
zonesRef.current.delete(zoneId);
|
|
21144
|
+
dndLog.debug("zone:unregister:self", { zoneId, group: meta.group });
|
|
21145
|
+
};
|
|
21142
21146
|
}
|
|
21143
21147
|
target.registerZone(zoneId, meta);
|
|
21144
|
-
|
|
21148
|
+
dndLog.debug("zone:register", { zoneId, group: meta.group, itemCount: meta.itemIds.length, dropEvent: meta.dropEvent, reorderEvent: meta.reorderEvent });
|
|
21149
|
+
return () => {
|
|
21150
|
+
target.unregisterZone(zoneId);
|
|
21151
|
+
dndLog.debug("zone:unregister", { zoneId, group: meta.group });
|
|
21152
|
+
};
|
|
21145
21153
|
}, [parentRoot, isRoot, zoneId, meta]);
|
|
21146
21154
|
const sensors = core$1.useSensors(
|
|
21147
21155
|
core$1.useSensor(core$1.PointerSensor, { activationConstraint: { distance: 5 } }),
|
|
@@ -21149,10 +21157,18 @@ function useDataDnd(args) {
|
|
|
21149
21157
|
);
|
|
21150
21158
|
const collisionDetection = React80__namespace.default.useCallback((args2) => {
|
|
21151
21159
|
const pointerCollisions = core$1.pointerWithin(args2);
|
|
21152
|
-
if (pointerCollisions.length > 0)
|
|
21160
|
+
if (pointerCollisions.length > 0) {
|
|
21161
|
+
dndLog.debug("collision:pointerWithin", { count: pointerCollisions.length, ids: pointerCollisions.map((c) => c.id) });
|
|
21162
|
+
return pointerCollisions;
|
|
21163
|
+
}
|
|
21153
21164
|
const rectCollisions = core$1.rectIntersection(args2);
|
|
21154
|
-
if (rectCollisions.length > 0)
|
|
21155
|
-
|
|
21165
|
+
if (rectCollisions.length > 0) {
|
|
21166
|
+
dndLog.debug("collision:rectIntersection", { count: rectCollisions.length, ids: rectCollisions.map((c) => c.id) });
|
|
21167
|
+
return rectCollisions;
|
|
21168
|
+
}
|
|
21169
|
+
const cornerCollisions = core$1.closestCorners(args2);
|
|
21170
|
+
dndLog.debug("collision:closestCorners", { count: cornerCollisions.length, ids: cornerCollisions.map((c) => c.id) });
|
|
21171
|
+
return cornerCollisions;
|
|
21156
21172
|
}, []);
|
|
21157
21173
|
const findZoneByItem = React80__namespace.default.useCallback(
|
|
21158
21174
|
(id) => {
|
|
@@ -21175,22 +21191,53 @@ function useDataDnd(args) {
|
|
|
21175
21191
|
const handleDragEnd = React80__namespace.default.useCallback(
|
|
21176
21192
|
(event) => {
|
|
21177
21193
|
const { active, over } = event;
|
|
21178
|
-
|
|
21194
|
+
const allZones = Array.from(zonesRef.current.entries()).map(([id, m]) => ({ id, group: m.group, items: m.itemIds.length }));
|
|
21195
|
+
dndLog.debug("dragEnd:received", {
|
|
21196
|
+
activeId: active.id,
|
|
21197
|
+
overId: over?.id,
|
|
21198
|
+
overData: over?.data?.current,
|
|
21199
|
+
zones: allZones
|
|
21200
|
+
});
|
|
21201
|
+
if (!over) {
|
|
21202
|
+
dndLog.warn("dragEnd:abort:no-over", { activeId: active.id, reason: "no droppable under pointer at drop time \u2192 item snaps back" });
|
|
21203
|
+
return;
|
|
21204
|
+
}
|
|
21179
21205
|
const sourceZone = findZoneByItem(active.id);
|
|
21180
21206
|
const overData = over.data?.current;
|
|
21181
21207
|
const targetGroup = overData?.dndGroup;
|
|
21182
|
-
|
|
21208
|
+
dndLog.debug("dragEnd:resolved", { sourceGroup: sourceZone?.group, targetGroup, overDataKeys: overData ? Object.keys(overData) : null });
|
|
21209
|
+
if (!sourceZone) {
|
|
21210
|
+
dndLog.warn("dragEnd:abort:no-source-zone", { activeId: active.id });
|
|
21211
|
+
return;
|
|
21212
|
+
}
|
|
21213
|
+
if (!targetGroup) {
|
|
21214
|
+
dndLog.warn("dragEnd:abort:no-target-group", { overId: over.id, overData });
|
|
21215
|
+
return;
|
|
21216
|
+
}
|
|
21183
21217
|
const targetZone = findZoneByGroup(targetGroup);
|
|
21184
|
-
if (!targetZone)
|
|
21218
|
+
if (!targetZone) {
|
|
21219
|
+
dndLog.warn("dragEnd:abort:target-zone-not-registered", { targetGroup });
|
|
21220
|
+
return;
|
|
21221
|
+
}
|
|
21185
21222
|
if (sourceZone.group !== targetZone.group) {
|
|
21186
21223
|
if (targetZone.dropEvent) {
|
|
21187
21224
|
const newIndex2 = targetZone.itemIds.indexOf(over.id);
|
|
21188
|
-
|
|
21225
|
+
const evt = `UI:${targetZone.dropEvent}`;
|
|
21226
|
+
dndLog.info("dragEnd:cross-container:emit", {
|
|
21227
|
+
event: evt,
|
|
21228
|
+
id: String(active.id),
|
|
21229
|
+
sourceGroup: sourceZone.group,
|
|
21230
|
+
targetGroup: targetZone.group,
|
|
21231
|
+
newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
|
|
21232
|
+
});
|
|
21233
|
+
eventBus.emit(evt, {
|
|
21189
21234
|
id: String(active.id),
|
|
21190
21235
|
sourceGroup: sourceZone.group,
|
|
21191
21236
|
targetGroup: targetZone.group,
|
|
21192
21237
|
newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
|
|
21193
21238
|
});
|
|
21239
|
+
} else {
|
|
21240
|
+
dndLog.warn("dragEnd:cross-container:no-dropEvent-on-target", { targetGroup: targetZone.group });
|
|
21194
21241
|
}
|
|
21195
21242
|
return;
|
|
21196
21243
|
}
|
|
@@ -21202,11 +21249,20 @@ function useDataDnd(args) {
|
|
|
21202
21249
|
setLocalOrder(reordered);
|
|
21203
21250
|
}
|
|
21204
21251
|
if (sourceZone.reorderEvent) {
|
|
21205
|
-
|
|
21252
|
+
const evt = `UI:${sourceZone.reorderEvent}`;
|
|
21253
|
+
dndLog.info("dragEnd:reorder:emit", {
|
|
21254
|
+
event: evt,
|
|
21206
21255
|
id: String(active.id),
|
|
21207
21256
|
oldIndex,
|
|
21208
21257
|
newIndex
|
|
21209
21258
|
});
|
|
21259
|
+
eventBus.emit(evt, {
|
|
21260
|
+
id: String(active.id),
|
|
21261
|
+
oldIndex,
|
|
21262
|
+
newIndex
|
|
21263
|
+
});
|
|
21264
|
+
} else {
|
|
21265
|
+
dndLog.debug("dragEnd:reorder:no-reorderEvent", { sourceGroup: sourceZone.group });
|
|
21210
21266
|
}
|
|
21211
21267
|
},
|
|
21212
21268
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
@@ -21247,15 +21303,20 @@ function useDataDnd(args) {
|
|
|
21247
21303
|
[sortableData, enabled]
|
|
21248
21304
|
);
|
|
21249
21305
|
const DropZoneShell = ({ children }) => {
|
|
21306
|
+
const droppableId = `dnd-zone-${zoneId}`;
|
|
21250
21307
|
const { setNodeRef, isOver } = core$1.useDroppable({
|
|
21251
|
-
id:
|
|
21308
|
+
id: droppableId,
|
|
21252
21309
|
data: sortableData
|
|
21253
21310
|
});
|
|
21311
|
+
React80__namespace.default.useEffect(() => {
|
|
21312
|
+
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver });
|
|
21313
|
+
}, [droppableId, isOver]);
|
|
21254
21314
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21255
21315
|
Box,
|
|
21256
21316
|
{
|
|
21257
21317
|
ref: setNodeRef,
|
|
21258
21318
|
"data-dnd-zone": ownGroup,
|
|
21319
|
+
"data-dnd-is-over": isOver ? "true" : "false",
|
|
21259
21320
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
21260
21321
|
children
|
|
21261
21322
|
}
|
|
@@ -21265,21 +21326,65 @@ function useDataDnd(args) {
|
|
|
21265
21326
|
() => ({ registerZone, unregisterZone }),
|
|
21266
21327
|
[registerZone, unregisterZone]
|
|
21267
21328
|
);
|
|
21329
|
+
const handleDragStart = React80__namespace.default.useCallback((event) => {
|
|
21330
|
+
const sourceZone = findZoneByItem(event.active.id);
|
|
21331
|
+
dndLog.info("dragStart", {
|
|
21332
|
+
activeId: event.active.id,
|
|
21333
|
+
activeData: event.active.data?.current,
|
|
21334
|
+
sourceGroup: sourceZone?.group,
|
|
21335
|
+
zoneCount: zonesRef.current.size
|
|
21336
|
+
});
|
|
21337
|
+
}, [findZoneByItem]);
|
|
21338
|
+
const handleDragOver = React80__namespace.default.useCallback((event) => {
|
|
21339
|
+
dndLog.debug("dragOver", {
|
|
21340
|
+
activeId: event.active.id,
|
|
21341
|
+
overId: event.over?.id,
|
|
21342
|
+
overData: event.over?.data?.current
|
|
21343
|
+
});
|
|
21344
|
+
}, []);
|
|
21345
|
+
const handleDragCancel = React80__namespace.default.useCallback((event) => {
|
|
21346
|
+
dndLog.warn("dragCancel", {
|
|
21347
|
+
activeId: event.active.id,
|
|
21348
|
+
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
21349
|
+
});
|
|
21350
|
+
}, []);
|
|
21268
21351
|
const wrapContainer = React80__namespace.default.useCallback(
|
|
21269
21352
|
(children) => {
|
|
21270
21353
|
if (!enabled) return children;
|
|
21271
21354
|
const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
|
|
21272
21355
|
if (!isZone) {
|
|
21273
21356
|
if (!isRoot) return children;
|
|
21274
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21357
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21358
|
+
core$1.DndContext,
|
|
21359
|
+
{
|
|
21360
|
+
sensors,
|
|
21361
|
+
collisionDetection,
|
|
21362
|
+
onDragStart: handleDragStart,
|
|
21363
|
+
onDragOver: handleDragOver,
|
|
21364
|
+
onDragEnd: handleDragEnd,
|
|
21365
|
+
onDragCancel: handleDragCancel,
|
|
21366
|
+
children
|
|
21367
|
+
}
|
|
21368
|
+
) });
|
|
21275
21369
|
}
|
|
21276
21370
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
|
|
21277
21371
|
if (isRoot) {
|
|
21278
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21372
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21373
|
+
core$1.DndContext,
|
|
21374
|
+
{
|
|
21375
|
+
sensors,
|
|
21376
|
+
collisionDetection,
|
|
21377
|
+
onDragStart: handleDragStart,
|
|
21378
|
+
onDragOver: handleDragOver,
|
|
21379
|
+
onDragEnd: handleDragEnd,
|
|
21380
|
+
onDragCancel: handleDragCancel,
|
|
21381
|
+
children: inner
|
|
21382
|
+
}
|
|
21383
|
+
) });
|
|
21279
21384
|
}
|
|
21280
21385
|
return inner;
|
|
21281
21386
|
},
|
|
21282
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
21387
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEnd, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
21283
21388
|
);
|
|
21284
21389
|
return {
|
|
21285
21390
|
enabled,
|
|
@@ -21289,12 +21394,13 @@ function useDataDnd(args) {
|
|
|
21289
21394
|
orderedItems
|
|
21290
21395
|
};
|
|
21291
21396
|
}
|
|
21292
|
-
var RootCtx;
|
|
21397
|
+
var dndLog, RootCtx;
|
|
21293
21398
|
var init_useDataDnd = __esm({
|
|
21294
21399
|
"components/molecules/useDataDnd.tsx"() {
|
|
21295
21400
|
"use client";
|
|
21296
21401
|
init_useEventBus();
|
|
21297
21402
|
init_Box();
|
|
21403
|
+
dndLog = logger.createLogger("almadar:ui:dnd");
|
|
21298
21404
|
RootCtx = React80__namespace.default.createContext(null);
|
|
21299
21405
|
}
|
|
21300
21406
|
});
|
package/dist/runtime/index.js
CHANGED
|
@@ -21092,10 +21092,18 @@ function useDataDnd(args) {
|
|
|
21092
21092
|
const target = isRoot ? null : parentRoot;
|
|
21093
21093
|
if (!target) {
|
|
21094
21094
|
zonesRef.current.set(zoneId, meta);
|
|
21095
|
-
|
|
21095
|
+
dndLog.debug("zone:register:self", { zoneId, group: meta.group, itemCount: meta.itemIds.length, isRoot });
|
|
21096
|
+
return () => {
|
|
21097
|
+
zonesRef.current.delete(zoneId);
|
|
21098
|
+
dndLog.debug("zone:unregister:self", { zoneId, group: meta.group });
|
|
21099
|
+
};
|
|
21096
21100
|
}
|
|
21097
21101
|
target.registerZone(zoneId, meta);
|
|
21098
|
-
|
|
21102
|
+
dndLog.debug("zone:register", { zoneId, group: meta.group, itemCount: meta.itemIds.length, dropEvent: meta.dropEvent, reorderEvent: meta.reorderEvent });
|
|
21103
|
+
return () => {
|
|
21104
|
+
target.unregisterZone(zoneId);
|
|
21105
|
+
dndLog.debug("zone:unregister", { zoneId, group: meta.group });
|
|
21106
|
+
};
|
|
21099
21107
|
}, [parentRoot, isRoot, zoneId, meta]);
|
|
21100
21108
|
const sensors = useSensors(
|
|
21101
21109
|
useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
|
|
@@ -21103,10 +21111,18 @@ function useDataDnd(args) {
|
|
|
21103
21111
|
);
|
|
21104
21112
|
const collisionDetection = React80__default.useCallback((args2) => {
|
|
21105
21113
|
const pointerCollisions = pointerWithin(args2);
|
|
21106
|
-
if (pointerCollisions.length > 0)
|
|
21114
|
+
if (pointerCollisions.length > 0) {
|
|
21115
|
+
dndLog.debug("collision:pointerWithin", { count: pointerCollisions.length, ids: pointerCollisions.map((c) => c.id) });
|
|
21116
|
+
return pointerCollisions;
|
|
21117
|
+
}
|
|
21107
21118
|
const rectCollisions = rectIntersection(args2);
|
|
21108
|
-
if (rectCollisions.length > 0)
|
|
21109
|
-
|
|
21119
|
+
if (rectCollisions.length > 0) {
|
|
21120
|
+
dndLog.debug("collision:rectIntersection", { count: rectCollisions.length, ids: rectCollisions.map((c) => c.id) });
|
|
21121
|
+
return rectCollisions;
|
|
21122
|
+
}
|
|
21123
|
+
const cornerCollisions = closestCorners(args2);
|
|
21124
|
+
dndLog.debug("collision:closestCorners", { count: cornerCollisions.length, ids: cornerCollisions.map((c) => c.id) });
|
|
21125
|
+
return cornerCollisions;
|
|
21110
21126
|
}, []);
|
|
21111
21127
|
const findZoneByItem = React80__default.useCallback(
|
|
21112
21128
|
(id) => {
|
|
@@ -21129,22 +21145,53 @@ function useDataDnd(args) {
|
|
|
21129
21145
|
const handleDragEnd = React80__default.useCallback(
|
|
21130
21146
|
(event) => {
|
|
21131
21147
|
const { active, over } = event;
|
|
21132
|
-
|
|
21148
|
+
const allZones = Array.from(zonesRef.current.entries()).map(([id, m]) => ({ id, group: m.group, items: m.itemIds.length }));
|
|
21149
|
+
dndLog.debug("dragEnd:received", {
|
|
21150
|
+
activeId: active.id,
|
|
21151
|
+
overId: over?.id,
|
|
21152
|
+
overData: over?.data?.current,
|
|
21153
|
+
zones: allZones
|
|
21154
|
+
});
|
|
21155
|
+
if (!over) {
|
|
21156
|
+
dndLog.warn("dragEnd:abort:no-over", { activeId: active.id, reason: "no droppable under pointer at drop time \u2192 item snaps back" });
|
|
21157
|
+
return;
|
|
21158
|
+
}
|
|
21133
21159
|
const sourceZone = findZoneByItem(active.id);
|
|
21134
21160
|
const overData = over.data?.current;
|
|
21135
21161
|
const targetGroup = overData?.dndGroup;
|
|
21136
|
-
|
|
21162
|
+
dndLog.debug("dragEnd:resolved", { sourceGroup: sourceZone?.group, targetGroup, overDataKeys: overData ? Object.keys(overData) : null });
|
|
21163
|
+
if (!sourceZone) {
|
|
21164
|
+
dndLog.warn("dragEnd:abort:no-source-zone", { activeId: active.id });
|
|
21165
|
+
return;
|
|
21166
|
+
}
|
|
21167
|
+
if (!targetGroup) {
|
|
21168
|
+
dndLog.warn("dragEnd:abort:no-target-group", { overId: over.id, overData });
|
|
21169
|
+
return;
|
|
21170
|
+
}
|
|
21137
21171
|
const targetZone = findZoneByGroup(targetGroup);
|
|
21138
|
-
if (!targetZone)
|
|
21172
|
+
if (!targetZone) {
|
|
21173
|
+
dndLog.warn("dragEnd:abort:target-zone-not-registered", { targetGroup });
|
|
21174
|
+
return;
|
|
21175
|
+
}
|
|
21139
21176
|
if (sourceZone.group !== targetZone.group) {
|
|
21140
21177
|
if (targetZone.dropEvent) {
|
|
21141
21178
|
const newIndex2 = targetZone.itemIds.indexOf(over.id);
|
|
21142
|
-
|
|
21179
|
+
const evt = `UI:${targetZone.dropEvent}`;
|
|
21180
|
+
dndLog.info("dragEnd:cross-container:emit", {
|
|
21181
|
+
event: evt,
|
|
21182
|
+
id: String(active.id),
|
|
21183
|
+
sourceGroup: sourceZone.group,
|
|
21184
|
+
targetGroup: targetZone.group,
|
|
21185
|
+
newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
|
|
21186
|
+
});
|
|
21187
|
+
eventBus.emit(evt, {
|
|
21143
21188
|
id: String(active.id),
|
|
21144
21189
|
sourceGroup: sourceZone.group,
|
|
21145
21190
|
targetGroup: targetZone.group,
|
|
21146
21191
|
newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
|
|
21147
21192
|
});
|
|
21193
|
+
} else {
|
|
21194
|
+
dndLog.warn("dragEnd:cross-container:no-dropEvent-on-target", { targetGroup: targetZone.group });
|
|
21148
21195
|
}
|
|
21149
21196
|
return;
|
|
21150
21197
|
}
|
|
@@ -21156,11 +21203,20 @@ function useDataDnd(args) {
|
|
|
21156
21203
|
setLocalOrder(reordered);
|
|
21157
21204
|
}
|
|
21158
21205
|
if (sourceZone.reorderEvent) {
|
|
21159
|
-
|
|
21206
|
+
const evt = `UI:${sourceZone.reorderEvent}`;
|
|
21207
|
+
dndLog.info("dragEnd:reorder:emit", {
|
|
21208
|
+
event: evt,
|
|
21160
21209
|
id: String(active.id),
|
|
21161
21210
|
oldIndex,
|
|
21162
21211
|
newIndex
|
|
21163
21212
|
});
|
|
21213
|
+
eventBus.emit(evt, {
|
|
21214
|
+
id: String(active.id),
|
|
21215
|
+
oldIndex,
|
|
21216
|
+
newIndex
|
|
21217
|
+
});
|
|
21218
|
+
} else {
|
|
21219
|
+
dndLog.debug("dragEnd:reorder:no-reorderEvent", { sourceGroup: sourceZone.group });
|
|
21164
21220
|
}
|
|
21165
21221
|
},
|
|
21166
21222
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
@@ -21201,15 +21257,20 @@ function useDataDnd(args) {
|
|
|
21201
21257
|
[sortableData, enabled]
|
|
21202
21258
|
);
|
|
21203
21259
|
const DropZoneShell = ({ children }) => {
|
|
21260
|
+
const droppableId = `dnd-zone-${zoneId}`;
|
|
21204
21261
|
const { setNodeRef, isOver } = useDroppable({
|
|
21205
|
-
id:
|
|
21262
|
+
id: droppableId,
|
|
21206
21263
|
data: sortableData
|
|
21207
21264
|
});
|
|
21265
|
+
React80__default.useEffect(() => {
|
|
21266
|
+
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver });
|
|
21267
|
+
}, [droppableId, isOver]);
|
|
21208
21268
|
return /* @__PURE__ */ jsx(
|
|
21209
21269
|
Box,
|
|
21210
21270
|
{
|
|
21211
21271
|
ref: setNodeRef,
|
|
21212
21272
|
"data-dnd-zone": ownGroup,
|
|
21273
|
+
"data-dnd-is-over": isOver ? "true" : "false",
|
|
21213
21274
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
21214
21275
|
children
|
|
21215
21276
|
}
|
|
@@ -21219,21 +21280,65 @@ function useDataDnd(args) {
|
|
|
21219
21280
|
() => ({ registerZone, unregisterZone }),
|
|
21220
21281
|
[registerZone, unregisterZone]
|
|
21221
21282
|
);
|
|
21283
|
+
const handleDragStart = React80__default.useCallback((event) => {
|
|
21284
|
+
const sourceZone = findZoneByItem(event.active.id);
|
|
21285
|
+
dndLog.info("dragStart", {
|
|
21286
|
+
activeId: event.active.id,
|
|
21287
|
+
activeData: event.active.data?.current,
|
|
21288
|
+
sourceGroup: sourceZone?.group,
|
|
21289
|
+
zoneCount: zonesRef.current.size
|
|
21290
|
+
});
|
|
21291
|
+
}, [findZoneByItem]);
|
|
21292
|
+
const handleDragOver = React80__default.useCallback((event) => {
|
|
21293
|
+
dndLog.debug("dragOver", {
|
|
21294
|
+
activeId: event.active.id,
|
|
21295
|
+
overId: event.over?.id,
|
|
21296
|
+
overData: event.over?.data?.current
|
|
21297
|
+
});
|
|
21298
|
+
}, []);
|
|
21299
|
+
const handleDragCancel = React80__default.useCallback((event) => {
|
|
21300
|
+
dndLog.warn("dragCancel", {
|
|
21301
|
+
activeId: event.active.id,
|
|
21302
|
+
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
21303
|
+
});
|
|
21304
|
+
}, []);
|
|
21222
21305
|
const wrapContainer = React80__default.useCallback(
|
|
21223
21306
|
(children) => {
|
|
21224
21307
|
if (!enabled) return children;
|
|
21225
21308
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
21226
21309
|
if (!isZone) {
|
|
21227
21310
|
if (!isRoot) return children;
|
|
21228
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(
|
|
21311
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(
|
|
21312
|
+
DndContext,
|
|
21313
|
+
{
|
|
21314
|
+
sensors,
|
|
21315
|
+
collisionDetection,
|
|
21316
|
+
onDragStart: handleDragStart,
|
|
21317
|
+
onDragOver: handleDragOver,
|
|
21318
|
+
onDragEnd: handleDragEnd,
|
|
21319
|
+
onDragCancel: handleDragCancel,
|
|
21320
|
+
children
|
|
21321
|
+
}
|
|
21322
|
+
) });
|
|
21229
21323
|
}
|
|
21230
21324
|
const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
|
|
21231
21325
|
if (isRoot) {
|
|
21232
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(
|
|
21326
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(
|
|
21327
|
+
DndContext,
|
|
21328
|
+
{
|
|
21329
|
+
sensors,
|
|
21330
|
+
collisionDetection,
|
|
21331
|
+
onDragStart: handleDragStart,
|
|
21332
|
+
onDragOver: handleDragOver,
|
|
21333
|
+
onDragEnd: handleDragEnd,
|
|
21334
|
+
onDragCancel: handleDragCancel,
|
|
21335
|
+
children: inner
|
|
21336
|
+
}
|
|
21337
|
+
) });
|
|
21233
21338
|
}
|
|
21234
21339
|
return inner;
|
|
21235
21340
|
},
|
|
21236
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
21341
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEnd, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
21237
21342
|
);
|
|
21238
21343
|
return {
|
|
21239
21344
|
enabled,
|
|
@@ -21243,12 +21348,13 @@ function useDataDnd(args) {
|
|
|
21243
21348
|
orderedItems
|
|
21244
21349
|
};
|
|
21245
21350
|
}
|
|
21246
|
-
var RootCtx;
|
|
21351
|
+
var dndLog, RootCtx;
|
|
21247
21352
|
var init_useDataDnd = __esm({
|
|
21248
21353
|
"components/molecules/useDataDnd.tsx"() {
|
|
21249
21354
|
"use client";
|
|
21250
21355
|
init_useEventBus();
|
|
21251
21356
|
init_Box();
|
|
21357
|
+
dndLog = createLogger("almadar:ui:dnd");
|
|
21252
21358
|
RootCtx = React80__default.createContext(null);
|
|
21253
21359
|
}
|
|
21254
21360
|
});
|