@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/avl/index.cjs
CHANGED
|
@@ -24957,10 +24957,18 @@ function useDataDnd(args) {
|
|
|
24957
24957
|
const target = isRoot ? null : parentRoot;
|
|
24958
24958
|
if (!target) {
|
|
24959
24959
|
zonesRef.current.set(zoneId, meta);
|
|
24960
|
-
|
|
24960
|
+
dndLog.debug("zone:register:self", { zoneId, group: meta.group, itemCount: meta.itemIds.length, isRoot });
|
|
24961
|
+
return () => {
|
|
24962
|
+
zonesRef.current.delete(zoneId);
|
|
24963
|
+
dndLog.debug("zone:unregister:self", { zoneId, group: meta.group });
|
|
24964
|
+
};
|
|
24961
24965
|
}
|
|
24962
24966
|
target.registerZone(zoneId, meta);
|
|
24963
|
-
|
|
24967
|
+
dndLog.debug("zone:register", { zoneId, group: meta.group, itemCount: meta.itemIds.length, dropEvent: meta.dropEvent, reorderEvent: meta.reorderEvent });
|
|
24968
|
+
return () => {
|
|
24969
|
+
target.unregisterZone(zoneId);
|
|
24970
|
+
dndLog.debug("zone:unregister", { zoneId, group: meta.group });
|
|
24971
|
+
};
|
|
24964
24972
|
}, [parentRoot, isRoot, zoneId, meta]);
|
|
24965
24973
|
const sensors = core$1.useSensors(
|
|
24966
24974
|
core$1.useSensor(core$1.PointerSensor, { activationConstraint: { distance: 5 } }),
|
|
@@ -24968,10 +24976,18 @@ function useDataDnd(args) {
|
|
|
24968
24976
|
);
|
|
24969
24977
|
const collisionDetection = React93__namespace.default.useCallback((args2) => {
|
|
24970
24978
|
const pointerCollisions = core$1.pointerWithin(args2);
|
|
24971
|
-
if (pointerCollisions.length > 0)
|
|
24979
|
+
if (pointerCollisions.length > 0) {
|
|
24980
|
+
dndLog.debug("collision:pointerWithin", { count: pointerCollisions.length, ids: pointerCollisions.map((c) => c.id) });
|
|
24981
|
+
return pointerCollisions;
|
|
24982
|
+
}
|
|
24972
24983
|
const rectCollisions = core$1.rectIntersection(args2);
|
|
24973
|
-
if (rectCollisions.length > 0)
|
|
24974
|
-
|
|
24984
|
+
if (rectCollisions.length > 0) {
|
|
24985
|
+
dndLog.debug("collision:rectIntersection", { count: rectCollisions.length, ids: rectCollisions.map((c) => c.id) });
|
|
24986
|
+
return rectCollisions;
|
|
24987
|
+
}
|
|
24988
|
+
const cornerCollisions = core$1.closestCorners(args2);
|
|
24989
|
+
dndLog.debug("collision:closestCorners", { count: cornerCollisions.length, ids: cornerCollisions.map((c) => c.id) });
|
|
24990
|
+
return cornerCollisions;
|
|
24975
24991
|
}, []);
|
|
24976
24992
|
const findZoneByItem = React93__namespace.default.useCallback(
|
|
24977
24993
|
(id) => {
|
|
@@ -24994,22 +25010,53 @@ function useDataDnd(args) {
|
|
|
24994
25010
|
const handleDragEnd = React93__namespace.default.useCallback(
|
|
24995
25011
|
(event) => {
|
|
24996
25012
|
const { active, over } = event;
|
|
24997
|
-
|
|
25013
|
+
const allZones = Array.from(zonesRef.current.entries()).map(([id, m]) => ({ id, group: m.group, items: m.itemIds.length }));
|
|
25014
|
+
dndLog.debug("dragEnd:received", {
|
|
25015
|
+
activeId: active.id,
|
|
25016
|
+
overId: over?.id,
|
|
25017
|
+
overData: over?.data?.current,
|
|
25018
|
+
zones: allZones
|
|
25019
|
+
});
|
|
25020
|
+
if (!over) {
|
|
25021
|
+
dndLog.warn("dragEnd:abort:no-over", { activeId: active.id, reason: "no droppable under pointer at drop time \u2192 item snaps back" });
|
|
25022
|
+
return;
|
|
25023
|
+
}
|
|
24998
25024
|
const sourceZone = findZoneByItem(active.id);
|
|
24999
25025
|
const overData = over.data?.current;
|
|
25000
25026
|
const targetGroup = overData?.dndGroup;
|
|
25001
|
-
|
|
25027
|
+
dndLog.debug("dragEnd:resolved", { sourceGroup: sourceZone?.group, targetGroup, overDataKeys: overData ? Object.keys(overData) : null });
|
|
25028
|
+
if (!sourceZone) {
|
|
25029
|
+
dndLog.warn("dragEnd:abort:no-source-zone", { activeId: active.id });
|
|
25030
|
+
return;
|
|
25031
|
+
}
|
|
25032
|
+
if (!targetGroup) {
|
|
25033
|
+
dndLog.warn("dragEnd:abort:no-target-group", { overId: over.id, overData });
|
|
25034
|
+
return;
|
|
25035
|
+
}
|
|
25002
25036
|
const targetZone = findZoneByGroup(targetGroup);
|
|
25003
|
-
if (!targetZone)
|
|
25037
|
+
if (!targetZone) {
|
|
25038
|
+
dndLog.warn("dragEnd:abort:target-zone-not-registered", { targetGroup });
|
|
25039
|
+
return;
|
|
25040
|
+
}
|
|
25004
25041
|
if (sourceZone.group !== targetZone.group) {
|
|
25005
25042
|
if (targetZone.dropEvent) {
|
|
25006
25043
|
const newIndex2 = targetZone.itemIds.indexOf(over.id);
|
|
25007
|
-
|
|
25044
|
+
const evt = `UI:${targetZone.dropEvent}`;
|
|
25045
|
+
dndLog.info("dragEnd:cross-container:emit", {
|
|
25046
|
+
event: evt,
|
|
25008
25047
|
id: String(active.id),
|
|
25009
25048
|
sourceGroup: sourceZone.group,
|
|
25010
25049
|
targetGroup: targetZone.group,
|
|
25011
25050
|
newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
|
|
25012
25051
|
});
|
|
25052
|
+
eventBus.emit(evt, {
|
|
25053
|
+
id: String(active.id),
|
|
25054
|
+
sourceGroup: sourceZone.group,
|
|
25055
|
+
targetGroup: targetZone.group,
|
|
25056
|
+
newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
|
|
25057
|
+
});
|
|
25058
|
+
} else {
|
|
25059
|
+
dndLog.warn("dragEnd:cross-container:no-dropEvent-on-target", { targetGroup: targetZone.group });
|
|
25013
25060
|
}
|
|
25014
25061
|
return;
|
|
25015
25062
|
}
|
|
@@ -25021,11 +25068,20 @@ function useDataDnd(args) {
|
|
|
25021
25068
|
setLocalOrder(reordered);
|
|
25022
25069
|
}
|
|
25023
25070
|
if (sourceZone.reorderEvent) {
|
|
25024
|
-
|
|
25071
|
+
const evt = `UI:${sourceZone.reorderEvent}`;
|
|
25072
|
+
dndLog.info("dragEnd:reorder:emit", {
|
|
25073
|
+
event: evt,
|
|
25025
25074
|
id: String(active.id),
|
|
25026
25075
|
oldIndex,
|
|
25027
25076
|
newIndex
|
|
25028
25077
|
});
|
|
25078
|
+
eventBus.emit(evt, {
|
|
25079
|
+
id: String(active.id),
|
|
25080
|
+
oldIndex,
|
|
25081
|
+
newIndex
|
|
25082
|
+
});
|
|
25083
|
+
} else {
|
|
25084
|
+
dndLog.debug("dragEnd:reorder:no-reorderEvent", { sourceGroup: sourceZone.group });
|
|
25029
25085
|
}
|
|
25030
25086
|
},
|
|
25031
25087
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
@@ -25066,15 +25122,20 @@ function useDataDnd(args) {
|
|
|
25066
25122
|
[sortableData, enabled]
|
|
25067
25123
|
);
|
|
25068
25124
|
const DropZoneShell = ({ children }) => {
|
|
25125
|
+
const droppableId = `dnd-zone-${zoneId}`;
|
|
25069
25126
|
const { setNodeRef, isOver } = core$1.useDroppable({
|
|
25070
|
-
id:
|
|
25127
|
+
id: droppableId,
|
|
25071
25128
|
data: sortableData
|
|
25072
25129
|
});
|
|
25130
|
+
React93__namespace.default.useEffect(() => {
|
|
25131
|
+
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver });
|
|
25132
|
+
}, [droppableId, isOver]);
|
|
25073
25133
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
25074
25134
|
Box,
|
|
25075
25135
|
{
|
|
25076
25136
|
ref: setNodeRef,
|
|
25077
25137
|
"data-dnd-zone": ownGroup,
|
|
25138
|
+
"data-dnd-is-over": isOver ? "true" : "false",
|
|
25078
25139
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
25079
25140
|
children
|
|
25080
25141
|
}
|
|
@@ -25084,21 +25145,65 @@ function useDataDnd(args) {
|
|
|
25084
25145
|
() => ({ registerZone, unregisterZone }),
|
|
25085
25146
|
[registerZone, unregisterZone]
|
|
25086
25147
|
);
|
|
25148
|
+
const handleDragStart = React93__namespace.default.useCallback((event) => {
|
|
25149
|
+
const sourceZone = findZoneByItem(event.active.id);
|
|
25150
|
+
dndLog.info("dragStart", {
|
|
25151
|
+
activeId: event.active.id,
|
|
25152
|
+
activeData: event.active.data?.current,
|
|
25153
|
+
sourceGroup: sourceZone?.group,
|
|
25154
|
+
zoneCount: zonesRef.current.size
|
|
25155
|
+
});
|
|
25156
|
+
}, [findZoneByItem]);
|
|
25157
|
+
const handleDragOver = React93__namespace.default.useCallback((event) => {
|
|
25158
|
+
dndLog.debug("dragOver", {
|
|
25159
|
+
activeId: event.active.id,
|
|
25160
|
+
overId: event.over?.id,
|
|
25161
|
+
overData: event.over?.data?.current
|
|
25162
|
+
});
|
|
25163
|
+
}, []);
|
|
25164
|
+
const handleDragCancel = React93__namespace.default.useCallback((event) => {
|
|
25165
|
+
dndLog.warn("dragCancel", {
|
|
25166
|
+
activeId: event.active.id,
|
|
25167
|
+
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
25168
|
+
});
|
|
25169
|
+
}, []);
|
|
25087
25170
|
const wrapContainer = React93__namespace.default.useCallback(
|
|
25088
25171
|
(children) => {
|
|
25089
25172
|
if (!enabled) return children;
|
|
25090
25173
|
const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
|
|
25091
25174
|
if (!isZone) {
|
|
25092
25175
|
if (!isRoot) return children;
|
|
25093
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
25176
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
25177
|
+
core$1.DndContext,
|
|
25178
|
+
{
|
|
25179
|
+
sensors,
|
|
25180
|
+
collisionDetection,
|
|
25181
|
+
onDragStart: handleDragStart,
|
|
25182
|
+
onDragOver: handleDragOver,
|
|
25183
|
+
onDragEnd: handleDragEnd,
|
|
25184
|
+
onDragCancel: handleDragCancel,
|
|
25185
|
+
children
|
|
25186
|
+
}
|
|
25187
|
+
) });
|
|
25094
25188
|
}
|
|
25095
25189
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
|
|
25096
25190
|
if (isRoot) {
|
|
25097
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
25191
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
25192
|
+
core$1.DndContext,
|
|
25193
|
+
{
|
|
25194
|
+
sensors,
|
|
25195
|
+
collisionDetection,
|
|
25196
|
+
onDragStart: handleDragStart,
|
|
25197
|
+
onDragOver: handleDragOver,
|
|
25198
|
+
onDragEnd: handleDragEnd,
|
|
25199
|
+
onDragCancel: handleDragCancel,
|
|
25200
|
+
children: inner
|
|
25201
|
+
}
|
|
25202
|
+
) });
|
|
25098
25203
|
}
|
|
25099
25204
|
return inner;
|
|
25100
25205
|
},
|
|
25101
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
25206
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEnd, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
25102
25207
|
);
|
|
25103
25208
|
return {
|
|
25104
25209
|
enabled,
|
|
@@ -25108,12 +25213,13 @@ function useDataDnd(args) {
|
|
|
25108
25213
|
orderedItems
|
|
25109
25214
|
};
|
|
25110
25215
|
}
|
|
25111
|
-
var RootCtx;
|
|
25216
|
+
var dndLog, RootCtx;
|
|
25112
25217
|
var init_useDataDnd = __esm({
|
|
25113
25218
|
"components/molecules/useDataDnd.tsx"() {
|
|
25114
25219
|
"use client";
|
|
25115
25220
|
init_useEventBus();
|
|
25116
25221
|
init_Box();
|
|
25222
|
+
dndLog = logger.createLogger("almadar:ui:dnd");
|
|
25117
25223
|
RootCtx = React93__namespace.default.createContext(null);
|
|
25118
25224
|
}
|
|
25119
25225
|
});
|
package/dist/avl/index.js
CHANGED
|
@@ -24911,10 +24911,18 @@ function useDataDnd(args) {
|
|
|
24911
24911
|
const target = isRoot ? null : parentRoot;
|
|
24912
24912
|
if (!target) {
|
|
24913
24913
|
zonesRef.current.set(zoneId, meta);
|
|
24914
|
-
|
|
24914
|
+
dndLog.debug("zone:register:self", { zoneId, group: meta.group, itemCount: meta.itemIds.length, isRoot });
|
|
24915
|
+
return () => {
|
|
24916
|
+
zonesRef.current.delete(zoneId);
|
|
24917
|
+
dndLog.debug("zone:unregister:self", { zoneId, group: meta.group });
|
|
24918
|
+
};
|
|
24915
24919
|
}
|
|
24916
24920
|
target.registerZone(zoneId, meta);
|
|
24917
|
-
|
|
24921
|
+
dndLog.debug("zone:register", { zoneId, group: meta.group, itemCount: meta.itemIds.length, dropEvent: meta.dropEvent, reorderEvent: meta.reorderEvent });
|
|
24922
|
+
return () => {
|
|
24923
|
+
target.unregisterZone(zoneId);
|
|
24924
|
+
dndLog.debug("zone:unregister", { zoneId, group: meta.group });
|
|
24925
|
+
};
|
|
24918
24926
|
}, [parentRoot, isRoot, zoneId, meta]);
|
|
24919
24927
|
const sensors = useSensors(
|
|
24920
24928
|
useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
|
|
@@ -24922,10 +24930,18 @@ function useDataDnd(args) {
|
|
|
24922
24930
|
);
|
|
24923
24931
|
const collisionDetection = React93__default.useCallback((args2) => {
|
|
24924
24932
|
const pointerCollisions = pointerWithin(args2);
|
|
24925
|
-
if (pointerCollisions.length > 0)
|
|
24933
|
+
if (pointerCollisions.length > 0) {
|
|
24934
|
+
dndLog.debug("collision:pointerWithin", { count: pointerCollisions.length, ids: pointerCollisions.map((c) => c.id) });
|
|
24935
|
+
return pointerCollisions;
|
|
24936
|
+
}
|
|
24926
24937
|
const rectCollisions = rectIntersection(args2);
|
|
24927
|
-
if (rectCollisions.length > 0)
|
|
24928
|
-
|
|
24938
|
+
if (rectCollisions.length > 0) {
|
|
24939
|
+
dndLog.debug("collision:rectIntersection", { count: rectCollisions.length, ids: rectCollisions.map((c) => c.id) });
|
|
24940
|
+
return rectCollisions;
|
|
24941
|
+
}
|
|
24942
|
+
const cornerCollisions = closestCorners(args2);
|
|
24943
|
+
dndLog.debug("collision:closestCorners", { count: cornerCollisions.length, ids: cornerCollisions.map((c) => c.id) });
|
|
24944
|
+
return cornerCollisions;
|
|
24929
24945
|
}, []);
|
|
24930
24946
|
const findZoneByItem = React93__default.useCallback(
|
|
24931
24947
|
(id) => {
|
|
@@ -24948,22 +24964,53 @@ function useDataDnd(args) {
|
|
|
24948
24964
|
const handleDragEnd = React93__default.useCallback(
|
|
24949
24965
|
(event) => {
|
|
24950
24966
|
const { active, over } = event;
|
|
24951
|
-
|
|
24967
|
+
const allZones = Array.from(zonesRef.current.entries()).map(([id, m]) => ({ id, group: m.group, items: m.itemIds.length }));
|
|
24968
|
+
dndLog.debug("dragEnd:received", {
|
|
24969
|
+
activeId: active.id,
|
|
24970
|
+
overId: over?.id,
|
|
24971
|
+
overData: over?.data?.current,
|
|
24972
|
+
zones: allZones
|
|
24973
|
+
});
|
|
24974
|
+
if (!over) {
|
|
24975
|
+
dndLog.warn("dragEnd:abort:no-over", { activeId: active.id, reason: "no droppable under pointer at drop time \u2192 item snaps back" });
|
|
24976
|
+
return;
|
|
24977
|
+
}
|
|
24952
24978
|
const sourceZone = findZoneByItem(active.id);
|
|
24953
24979
|
const overData = over.data?.current;
|
|
24954
24980
|
const targetGroup = overData?.dndGroup;
|
|
24955
|
-
|
|
24981
|
+
dndLog.debug("dragEnd:resolved", { sourceGroup: sourceZone?.group, targetGroup, overDataKeys: overData ? Object.keys(overData) : null });
|
|
24982
|
+
if (!sourceZone) {
|
|
24983
|
+
dndLog.warn("dragEnd:abort:no-source-zone", { activeId: active.id });
|
|
24984
|
+
return;
|
|
24985
|
+
}
|
|
24986
|
+
if (!targetGroup) {
|
|
24987
|
+
dndLog.warn("dragEnd:abort:no-target-group", { overId: over.id, overData });
|
|
24988
|
+
return;
|
|
24989
|
+
}
|
|
24956
24990
|
const targetZone = findZoneByGroup(targetGroup);
|
|
24957
|
-
if (!targetZone)
|
|
24991
|
+
if (!targetZone) {
|
|
24992
|
+
dndLog.warn("dragEnd:abort:target-zone-not-registered", { targetGroup });
|
|
24993
|
+
return;
|
|
24994
|
+
}
|
|
24958
24995
|
if (sourceZone.group !== targetZone.group) {
|
|
24959
24996
|
if (targetZone.dropEvent) {
|
|
24960
24997
|
const newIndex2 = targetZone.itemIds.indexOf(over.id);
|
|
24961
|
-
|
|
24998
|
+
const evt = `UI:${targetZone.dropEvent}`;
|
|
24999
|
+
dndLog.info("dragEnd:cross-container:emit", {
|
|
25000
|
+
event: evt,
|
|
24962
25001
|
id: String(active.id),
|
|
24963
25002
|
sourceGroup: sourceZone.group,
|
|
24964
25003
|
targetGroup: targetZone.group,
|
|
24965
25004
|
newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
|
|
24966
25005
|
});
|
|
25006
|
+
eventBus.emit(evt, {
|
|
25007
|
+
id: String(active.id),
|
|
25008
|
+
sourceGroup: sourceZone.group,
|
|
25009
|
+
targetGroup: targetZone.group,
|
|
25010
|
+
newIndex: newIndex2 === -1 ? targetZone.itemIds.length : newIndex2
|
|
25011
|
+
});
|
|
25012
|
+
} else {
|
|
25013
|
+
dndLog.warn("dragEnd:cross-container:no-dropEvent-on-target", { targetGroup: targetZone.group });
|
|
24967
25014
|
}
|
|
24968
25015
|
return;
|
|
24969
25016
|
}
|
|
@@ -24975,11 +25022,20 @@ function useDataDnd(args) {
|
|
|
24975
25022
|
setLocalOrder(reordered);
|
|
24976
25023
|
}
|
|
24977
25024
|
if (sourceZone.reorderEvent) {
|
|
24978
|
-
|
|
25025
|
+
const evt = `UI:${sourceZone.reorderEvent}`;
|
|
25026
|
+
dndLog.info("dragEnd:reorder:emit", {
|
|
25027
|
+
event: evt,
|
|
24979
25028
|
id: String(active.id),
|
|
24980
25029
|
oldIndex,
|
|
24981
25030
|
newIndex
|
|
24982
25031
|
});
|
|
25032
|
+
eventBus.emit(evt, {
|
|
25033
|
+
id: String(active.id),
|
|
25034
|
+
oldIndex,
|
|
25035
|
+
newIndex
|
|
25036
|
+
});
|
|
25037
|
+
} else {
|
|
25038
|
+
dndLog.debug("dragEnd:reorder:no-reorderEvent", { sourceGroup: sourceZone.group });
|
|
24983
25039
|
}
|
|
24984
25040
|
},
|
|
24985
25041
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
@@ -25020,15 +25076,20 @@ function useDataDnd(args) {
|
|
|
25020
25076
|
[sortableData, enabled]
|
|
25021
25077
|
);
|
|
25022
25078
|
const DropZoneShell = ({ children }) => {
|
|
25079
|
+
const droppableId = `dnd-zone-${zoneId}`;
|
|
25023
25080
|
const { setNodeRef, isOver } = useDroppable({
|
|
25024
|
-
id:
|
|
25081
|
+
id: droppableId,
|
|
25025
25082
|
data: sortableData
|
|
25026
25083
|
});
|
|
25084
|
+
React93__default.useEffect(() => {
|
|
25085
|
+
dndLog.debug("dropzone:isOver:change", { droppableId, group: ownGroup, isOver });
|
|
25086
|
+
}, [droppableId, isOver]);
|
|
25027
25087
|
return /* @__PURE__ */ jsx(
|
|
25028
25088
|
Box,
|
|
25029
25089
|
{
|
|
25030
25090
|
ref: setNodeRef,
|
|
25031
25091
|
"data-dnd-zone": ownGroup,
|
|
25092
|
+
"data-dnd-is-over": isOver ? "true" : "false",
|
|
25032
25093
|
className: isOver ? "ring-2 ring-primary ring-offset-2 rounded-lg transition-all min-h-[3rem]" : "min-h-[3rem] rounded-lg transition-all",
|
|
25033
25094
|
children
|
|
25034
25095
|
}
|
|
@@ -25038,21 +25099,65 @@ function useDataDnd(args) {
|
|
|
25038
25099
|
() => ({ registerZone, unregisterZone }),
|
|
25039
25100
|
[registerZone, unregisterZone]
|
|
25040
25101
|
);
|
|
25102
|
+
const handleDragStart = React93__default.useCallback((event) => {
|
|
25103
|
+
const sourceZone = findZoneByItem(event.active.id);
|
|
25104
|
+
dndLog.info("dragStart", {
|
|
25105
|
+
activeId: event.active.id,
|
|
25106
|
+
activeData: event.active.data?.current,
|
|
25107
|
+
sourceGroup: sourceZone?.group,
|
|
25108
|
+
zoneCount: zonesRef.current.size
|
|
25109
|
+
});
|
|
25110
|
+
}, [findZoneByItem]);
|
|
25111
|
+
const handleDragOver = React93__default.useCallback((event) => {
|
|
25112
|
+
dndLog.debug("dragOver", {
|
|
25113
|
+
activeId: event.active.id,
|
|
25114
|
+
overId: event.over?.id,
|
|
25115
|
+
overData: event.over?.data?.current
|
|
25116
|
+
});
|
|
25117
|
+
}, []);
|
|
25118
|
+
const handleDragCancel = React93__default.useCallback((event) => {
|
|
25119
|
+
dndLog.warn("dragCancel", {
|
|
25120
|
+
activeId: event.active.id,
|
|
25121
|
+
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
25122
|
+
});
|
|
25123
|
+
}, []);
|
|
25041
25124
|
const wrapContainer = React93__default.useCallback(
|
|
25042
25125
|
(children) => {
|
|
25043
25126
|
if (!enabled) return children;
|
|
25044
25127
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
25045
25128
|
if (!isZone) {
|
|
25046
25129
|
if (!isRoot) return children;
|
|
25047
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(
|
|
25130
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(
|
|
25131
|
+
DndContext,
|
|
25132
|
+
{
|
|
25133
|
+
sensors,
|
|
25134
|
+
collisionDetection,
|
|
25135
|
+
onDragStart: handleDragStart,
|
|
25136
|
+
onDragOver: handleDragOver,
|
|
25137
|
+
onDragEnd: handleDragEnd,
|
|
25138
|
+
onDragCancel: handleDragCancel,
|
|
25139
|
+
children
|
|
25140
|
+
}
|
|
25141
|
+
) });
|
|
25048
25142
|
}
|
|
25049
25143
|
const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
|
|
25050
25144
|
if (isRoot) {
|
|
25051
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(
|
|
25145
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(
|
|
25146
|
+
DndContext,
|
|
25147
|
+
{
|
|
25148
|
+
sensors,
|
|
25149
|
+
collisionDetection,
|
|
25150
|
+
onDragStart: handleDragStart,
|
|
25151
|
+
onDragOver: handleDragOver,
|
|
25152
|
+
onDragEnd: handleDragEnd,
|
|
25153
|
+
onDragCancel: handleDragCancel,
|
|
25154
|
+
children: inner
|
|
25155
|
+
}
|
|
25156
|
+
) });
|
|
25052
25157
|
}
|
|
25053
25158
|
return inner;
|
|
25054
25159
|
},
|
|
25055
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
25160
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragStart, handleDragOver, handleDragEnd, handleDragCancel, itemIds, isRoot, rootContextValue]
|
|
25056
25161
|
);
|
|
25057
25162
|
return {
|
|
25058
25163
|
enabled,
|
|
@@ -25062,12 +25167,13 @@ function useDataDnd(args) {
|
|
|
25062
25167
|
orderedItems
|
|
25063
25168
|
};
|
|
25064
25169
|
}
|
|
25065
|
-
var RootCtx;
|
|
25170
|
+
var dndLog, RootCtx;
|
|
25066
25171
|
var init_useDataDnd = __esm({
|
|
25067
25172
|
"components/molecules/useDataDnd.tsx"() {
|
|
25068
25173
|
"use client";
|
|
25069
25174
|
init_useEventBus();
|
|
25070
25175
|
init_Box();
|
|
25176
|
+
dndLog = createLogger("almadar:ui:dnd");
|
|
25071
25177
|
RootCtx = React93__default.createContext(null);
|
|
25072
25178
|
}
|
|
25073
25179
|
});
|