@almadar/ui 4.50.2 → 4.50.4
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 +51 -8
- package/dist/avl/index.js +52 -9
- package/dist/components/index.cjs +51 -8
- package/dist/components/index.js +52 -9
- package/dist/providers/index.cjs +51 -8
- package/dist/providers/index.js +52 -9
- package/dist/runtime/index.cjs +51 -8
- package/dist/runtime/index.js +52 -9
- package/package.json +1 -1
package/dist/avl/index.cjs
CHANGED
|
@@ -24942,6 +24942,10 @@ function useDataDnd(args) {
|
|
|
24942
24942
|
const unregisterZone = React93__namespace.default.useCallback((zoneId2) => {
|
|
24943
24943
|
zonesRef.current.delete(zoneId2);
|
|
24944
24944
|
}, []);
|
|
24945
|
+
const [overlayNode, setOverlayNode] = React93__namespace.default.useState(null);
|
|
24946
|
+
const setOverlay = React93__namespace.default.useCallback((node) => {
|
|
24947
|
+
setOverlayNode(node);
|
|
24948
|
+
}, []);
|
|
24945
24949
|
const zoneId = React93__namespace.default.useId();
|
|
24946
24950
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
24947
24951
|
const meta = React93__namespace.default.useMemo(
|
|
@@ -25025,6 +25029,7 @@ function useDataDnd(args) {
|
|
|
25025
25029
|
},
|
|
25026
25030
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
25027
25031
|
);
|
|
25032
|
+
const overlaySink = isRoot ? setOverlay : parentRoot?.setOverlay;
|
|
25028
25033
|
const SortableItem = React93__namespace.default.useCallback(
|
|
25029
25034
|
({ id, children }) => {
|
|
25030
25035
|
const {
|
|
@@ -25035,6 +25040,13 @@ function useDataDnd(args) {
|
|
|
25035
25040
|
transition,
|
|
25036
25041
|
isDragging
|
|
25037
25042
|
} = sortable.useSortable({ id, data: { dndGroup: ownGroup } });
|
|
25043
|
+
const childrenRef = React93__namespace.default.useRef(children);
|
|
25044
|
+
childrenRef.current = children;
|
|
25045
|
+
React93__namespace.default.useEffect(() => {
|
|
25046
|
+
if (!isDragging || !overlaySink) return;
|
|
25047
|
+
overlaySink(childrenRef.current);
|
|
25048
|
+
return () => overlaySink(null);
|
|
25049
|
+
}, [isDragging]);
|
|
25038
25050
|
const style = {
|
|
25039
25051
|
transform: utilities.CSS.Transform.toString(transform),
|
|
25040
25052
|
transition,
|
|
@@ -25053,7 +25065,7 @@ function useDataDnd(args) {
|
|
|
25053
25065
|
}
|
|
25054
25066
|
);
|
|
25055
25067
|
},
|
|
25056
|
-
[ownGroup, enabled]
|
|
25068
|
+
[ownGroup, enabled, overlaySink]
|
|
25057
25069
|
);
|
|
25058
25070
|
const DropZoneShell = ({ children }) => {
|
|
25059
25071
|
const { setNodeRef, isOver } = core$1.useDroppable({
|
|
@@ -25071,24 +25083,55 @@ function useDataDnd(args) {
|
|
|
25071
25083
|
);
|
|
25072
25084
|
};
|
|
25073
25085
|
const rootContextValue = React93__namespace.default.useMemo(
|
|
25074
|
-
() => ({ registerZone, unregisterZone }),
|
|
25075
|
-
[registerZone, unregisterZone]
|
|
25086
|
+
() => ({ registerZone, unregisterZone, setOverlay }),
|
|
25087
|
+
[registerZone, unregisterZone, setOverlay]
|
|
25076
25088
|
);
|
|
25077
25089
|
const wrapContainer = React93__namespace.default.useCallback(
|
|
25078
25090
|
(children) => {
|
|
25079
25091
|
if (!enabled) return children;
|
|
25080
25092
|
const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
|
|
25093
|
+
const clearOverlay = () => setOverlay(null);
|
|
25081
25094
|
if (!isZone) {
|
|
25082
25095
|
if (!isRoot) return children;
|
|
25083
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
25096
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
25097
|
+
core$1.DndContext,
|
|
25098
|
+
{
|
|
25099
|
+
sensors,
|
|
25100
|
+
collisionDetection,
|
|
25101
|
+
onDragEnd: (e) => {
|
|
25102
|
+
handleDragEnd(e);
|
|
25103
|
+
clearOverlay();
|
|
25104
|
+
},
|
|
25105
|
+
onDragCancel: clearOverlay,
|
|
25106
|
+
children: [
|
|
25107
|
+
children,
|
|
25108
|
+
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
25109
|
+
]
|
|
25110
|
+
}
|
|
25111
|
+
) });
|
|
25084
25112
|
}
|
|
25085
25113
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
|
|
25086
25114
|
if (isRoot) {
|
|
25087
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
25115
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
25116
|
+
core$1.DndContext,
|
|
25117
|
+
{
|
|
25118
|
+
sensors,
|
|
25119
|
+
collisionDetection,
|
|
25120
|
+
onDragEnd: (e) => {
|
|
25121
|
+
handleDragEnd(e);
|
|
25122
|
+
clearOverlay();
|
|
25123
|
+
},
|
|
25124
|
+
onDragCancel: clearOverlay,
|
|
25125
|
+
children: [
|
|
25126
|
+
inner,
|
|
25127
|
+
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
25128
|
+
]
|
|
25129
|
+
}
|
|
25130
|
+
) });
|
|
25088
25131
|
}
|
|
25089
25132
|
return inner;
|
|
25090
25133
|
},
|
|
25091
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
25134
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue, overlayNode, setOverlay]
|
|
25092
25135
|
);
|
|
25093
25136
|
return {
|
|
25094
25137
|
enabled,
|
|
@@ -25298,7 +25341,7 @@ function DataGrid({
|
|
|
25298
25341
|
const id = itemData.id || String(index);
|
|
25299
25342
|
const isSelected = selectedIds.has(id);
|
|
25300
25343
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
25301
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
25344
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
25302
25345
|
if (hasRenderProp) {
|
|
25303
25346
|
return wrapDnd(
|
|
25304
25347
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -25714,7 +25757,7 @@ function DataList({
|
|
|
25714
25757
|
const idFieldName = dndItemIdField ?? "id";
|
|
25715
25758
|
const renderItem = (itemData, index, isLast) => {
|
|
25716
25759
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
25717
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
25760
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
25718
25761
|
if (hasRenderProp) {
|
|
25719
25762
|
const id2 = itemData.id || String(index);
|
|
25720
25763
|
return wrapDnd(
|
package/dist/avl/index.js
CHANGED
|
@@ -34,7 +34,7 @@ import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js'
|
|
|
34
34
|
import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
|
|
35
35
|
import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
|
|
36
36
|
import { FieldTypeSchema, isInlineTrait, isEntityCall, schemaToIR, getPage, isCircuitEvent } from '@almadar/core';
|
|
37
|
-
import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, useDroppable } from '@dnd-kit/core';
|
|
37
|
+
import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, DragOverlay, useDroppable } from '@dnd-kit/core';
|
|
38
38
|
import { sortableKeyboardCoordinates, arrayMove, useSortable, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
39
39
|
import { CSS } from '@dnd-kit/utilities';
|
|
40
40
|
import { useThree, useFrame, Canvas } from '@react-three/fiber';
|
|
@@ -24896,6 +24896,10 @@ function useDataDnd(args) {
|
|
|
24896
24896
|
const unregisterZone = React93__default.useCallback((zoneId2) => {
|
|
24897
24897
|
zonesRef.current.delete(zoneId2);
|
|
24898
24898
|
}, []);
|
|
24899
|
+
const [overlayNode, setOverlayNode] = React93__default.useState(null);
|
|
24900
|
+
const setOverlay = React93__default.useCallback((node) => {
|
|
24901
|
+
setOverlayNode(node);
|
|
24902
|
+
}, []);
|
|
24899
24903
|
const zoneId = React93__default.useId();
|
|
24900
24904
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
24901
24905
|
const meta = React93__default.useMemo(
|
|
@@ -24979,6 +24983,7 @@ function useDataDnd(args) {
|
|
|
24979
24983
|
},
|
|
24980
24984
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
24981
24985
|
);
|
|
24986
|
+
const overlaySink = isRoot ? setOverlay : parentRoot?.setOverlay;
|
|
24982
24987
|
const SortableItem = React93__default.useCallback(
|
|
24983
24988
|
({ id, children }) => {
|
|
24984
24989
|
const {
|
|
@@ -24989,6 +24994,13 @@ function useDataDnd(args) {
|
|
|
24989
24994
|
transition,
|
|
24990
24995
|
isDragging
|
|
24991
24996
|
} = useSortable({ id, data: { dndGroup: ownGroup } });
|
|
24997
|
+
const childrenRef = React93__default.useRef(children);
|
|
24998
|
+
childrenRef.current = children;
|
|
24999
|
+
React93__default.useEffect(() => {
|
|
25000
|
+
if (!isDragging || !overlaySink) return;
|
|
25001
|
+
overlaySink(childrenRef.current);
|
|
25002
|
+
return () => overlaySink(null);
|
|
25003
|
+
}, [isDragging]);
|
|
24992
25004
|
const style = {
|
|
24993
25005
|
transform: CSS.Transform.toString(transform),
|
|
24994
25006
|
transition,
|
|
@@ -25007,7 +25019,7 @@ function useDataDnd(args) {
|
|
|
25007
25019
|
}
|
|
25008
25020
|
);
|
|
25009
25021
|
},
|
|
25010
|
-
[ownGroup, enabled]
|
|
25022
|
+
[ownGroup, enabled, overlaySink]
|
|
25011
25023
|
);
|
|
25012
25024
|
const DropZoneShell = ({ children }) => {
|
|
25013
25025
|
const { setNodeRef, isOver } = useDroppable({
|
|
@@ -25025,24 +25037,55 @@ function useDataDnd(args) {
|
|
|
25025
25037
|
);
|
|
25026
25038
|
};
|
|
25027
25039
|
const rootContextValue = React93__default.useMemo(
|
|
25028
|
-
() => ({ registerZone, unregisterZone }),
|
|
25029
|
-
[registerZone, unregisterZone]
|
|
25040
|
+
() => ({ registerZone, unregisterZone, setOverlay }),
|
|
25041
|
+
[registerZone, unregisterZone, setOverlay]
|
|
25030
25042
|
);
|
|
25031
25043
|
const wrapContainer = React93__default.useCallback(
|
|
25032
25044
|
(children) => {
|
|
25033
25045
|
if (!enabled) return children;
|
|
25034
25046
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
25047
|
+
const clearOverlay = () => setOverlay(null);
|
|
25035
25048
|
if (!isZone) {
|
|
25036
25049
|
if (!isRoot) return children;
|
|
25037
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
25050
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxs(
|
|
25051
|
+
DndContext,
|
|
25052
|
+
{
|
|
25053
|
+
sensors,
|
|
25054
|
+
collisionDetection,
|
|
25055
|
+
onDragEnd: (e) => {
|
|
25056
|
+
handleDragEnd(e);
|
|
25057
|
+
clearOverlay();
|
|
25058
|
+
},
|
|
25059
|
+
onDragCancel: clearOverlay,
|
|
25060
|
+
children: [
|
|
25061
|
+
children,
|
|
25062
|
+
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
25063
|
+
]
|
|
25064
|
+
}
|
|
25065
|
+
) });
|
|
25038
25066
|
}
|
|
25039
25067
|
const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
|
|
25040
25068
|
if (isRoot) {
|
|
25041
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
25069
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxs(
|
|
25070
|
+
DndContext,
|
|
25071
|
+
{
|
|
25072
|
+
sensors,
|
|
25073
|
+
collisionDetection,
|
|
25074
|
+
onDragEnd: (e) => {
|
|
25075
|
+
handleDragEnd(e);
|
|
25076
|
+
clearOverlay();
|
|
25077
|
+
},
|
|
25078
|
+
onDragCancel: clearOverlay,
|
|
25079
|
+
children: [
|
|
25080
|
+
inner,
|
|
25081
|
+
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
25082
|
+
]
|
|
25083
|
+
}
|
|
25084
|
+
) });
|
|
25042
25085
|
}
|
|
25043
25086
|
return inner;
|
|
25044
25087
|
},
|
|
25045
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
25088
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue, overlayNode, setOverlay]
|
|
25046
25089
|
);
|
|
25047
25090
|
return {
|
|
25048
25091
|
enabled,
|
|
@@ -25252,7 +25295,7 @@ function DataGrid({
|
|
|
25252
25295
|
const id = itemData.id || String(index);
|
|
25253
25296
|
const isSelected = selectedIds.has(id);
|
|
25254
25297
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
25255
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
25298
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
25256
25299
|
if (hasRenderProp) {
|
|
25257
25300
|
return wrapDnd(
|
|
25258
25301
|
/* @__PURE__ */ jsx(
|
|
@@ -25668,7 +25711,7 @@ function DataList({
|
|
|
25668
25711
|
const idFieldName = dndItemIdField ?? "id";
|
|
25669
25712
|
const renderItem = (itemData, index, isLast) => {
|
|
25670
25713
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
25671
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
25714
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
25672
25715
|
if (hasRenderProp) {
|
|
25673
25716
|
const id2 = itemData.id || String(index);
|
|
25674
25717
|
return wrapDnd(
|
|
@@ -20109,6 +20109,10 @@ function useDataDnd(args) {
|
|
|
20109
20109
|
const unregisterZone = React75__namespace.default.useCallback((zoneId2) => {
|
|
20110
20110
|
zonesRef.current.delete(zoneId2);
|
|
20111
20111
|
}, []);
|
|
20112
|
+
const [overlayNode, setOverlayNode] = React75__namespace.default.useState(null);
|
|
20113
|
+
const setOverlay = React75__namespace.default.useCallback((node) => {
|
|
20114
|
+
setOverlayNode(node);
|
|
20115
|
+
}, []);
|
|
20112
20116
|
const zoneId = React75__namespace.default.useId();
|
|
20113
20117
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
20114
20118
|
const meta = React75__namespace.default.useMemo(
|
|
@@ -20192,6 +20196,7 @@ function useDataDnd(args) {
|
|
|
20192
20196
|
},
|
|
20193
20197
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
20194
20198
|
);
|
|
20199
|
+
const overlaySink = isRoot ? setOverlay : parentRoot?.setOverlay;
|
|
20195
20200
|
const SortableItem = React75__namespace.default.useCallback(
|
|
20196
20201
|
({ id, children }) => {
|
|
20197
20202
|
const {
|
|
@@ -20202,6 +20207,13 @@ function useDataDnd(args) {
|
|
|
20202
20207
|
transition,
|
|
20203
20208
|
isDragging
|
|
20204
20209
|
} = sortable.useSortable({ id, data: { dndGroup: ownGroup } });
|
|
20210
|
+
const childrenRef = React75__namespace.default.useRef(children);
|
|
20211
|
+
childrenRef.current = children;
|
|
20212
|
+
React75__namespace.default.useEffect(() => {
|
|
20213
|
+
if (!isDragging || !overlaySink) return;
|
|
20214
|
+
overlaySink(childrenRef.current);
|
|
20215
|
+
return () => overlaySink(null);
|
|
20216
|
+
}, [isDragging]);
|
|
20205
20217
|
const style = {
|
|
20206
20218
|
transform: utilities.CSS.Transform.toString(transform),
|
|
20207
20219
|
transition,
|
|
@@ -20220,7 +20232,7 @@ function useDataDnd(args) {
|
|
|
20220
20232
|
}
|
|
20221
20233
|
);
|
|
20222
20234
|
},
|
|
20223
|
-
[ownGroup, enabled]
|
|
20235
|
+
[ownGroup, enabled, overlaySink]
|
|
20224
20236
|
);
|
|
20225
20237
|
const DropZoneShell = ({ children }) => {
|
|
20226
20238
|
const { setNodeRef, isOver } = core$1.useDroppable({
|
|
@@ -20238,24 +20250,55 @@ function useDataDnd(args) {
|
|
|
20238
20250
|
);
|
|
20239
20251
|
};
|
|
20240
20252
|
const rootContextValue = React75__namespace.default.useMemo(
|
|
20241
|
-
() => ({ registerZone, unregisterZone }),
|
|
20242
|
-
[registerZone, unregisterZone]
|
|
20253
|
+
() => ({ registerZone, unregisterZone, setOverlay }),
|
|
20254
|
+
[registerZone, unregisterZone, setOverlay]
|
|
20243
20255
|
);
|
|
20244
20256
|
const wrapContainer = React75__namespace.default.useCallback(
|
|
20245
20257
|
(children) => {
|
|
20246
20258
|
if (!enabled) return children;
|
|
20247
20259
|
const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
|
|
20260
|
+
const clearOverlay = () => setOverlay(null);
|
|
20248
20261
|
if (!isZone) {
|
|
20249
20262
|
if (!isRoot) return children;
|
|
20250
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
20263
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20264
|
+
core$1.DndContext,
|
|
20265
|
+
{
|
|
20266
|
+
sensors,
|
|
20267
|
+
collisionDetection,
|
|
20268
|
+
onDragEnd: (e) => {
|
|
20269
|
+
handleDragEnd(e);
|
|
20270
|
+
clearOverlay();
|
|
20271
|
+
},
|
|
20272
|
+
onDragCancel: clearOverlay,
|
|
20273
|
+
children: [
|
|
20274
|
+
children,
|
|
20275
|
+
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
20276
|
+
]
|
|
20277
|
+
}
|
|
20278
|
+
) });
|
|
20251
20279
|
}
|
|
20252
20280
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
|
|
20253
20281
|
if (isRoot) {
|
|
20254
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
20282
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20283
|
+
core$1.DndContext,
|
|
20284
|
+
{
|
|
20285
|
+
sensors,
|
|
20286
|
+
collisionDetection,
|
|
20287
|
+
onDragEnd: (e) => {
|
|
20288
|
+
handleDragEnd(e);
|
|
20289
|
+
clearOverlay();
|
|
20290
|
+
},
|
|
20291
|
+
onDragCancel: clearOverlay,
|
|
20292
|
+
children: [
|
|
20293
|
+
inner,
|
|
20294
|
+
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
20295
|
+
]
|
|
20296
|
+
}
|
|
20297
|
+
) });
|
|
20255
20298
|
}
|
|
20256
20299
|
return inner;
|
|
20257
20300
|
},
|
|
20258
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
20301
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue, overlayNode, setOverlay]
|
|
20259
20302
|
);
|
|
20260
20303
|
return {
|
|
20261
20304
|
enabled,
|
|
@@ -20465,7 +20508,7 @@ function DataGrid({
|
|
|
20465
20508
|
const id = itemData.id || String(index);
|
|
20466
20509
|
const isSelected = selectedIds.has(id);
|
|
20467
20510
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
20468
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
20511
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
20469
20512
|
if (hasRenderProp) {
|
|
20470
20513
|
return wrapDnd(
|
|
20471
20514
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -20881,7 +20924,7 @@ function DataList({
|
|
|
20881
20924
|
const idFieldName = dndItemIdField ?? "id";
|
|
20882
20925
|
const renderItem = (itemData, index, isLast) => {
|
|
20883
20926
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
20884
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
20927
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
20885
20928
|
if (hasRenderProp) {
|
|
20886
20929
|
const id2 = itemData.id || String(index);
|
|
20887
20930
|
return wrapDnd(
|
package/dist/components/index.js
CHANGED
|
@@ -35,7 +35,7 @@ import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js'
|
|
|
35
35
|
import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
|
|
36
36
|
import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
|
|
37
37
|
import { isInlineTrait } from '@almadar/core';
|
|
38
|
-
import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, useDroppable } from '@dnd-kit/core';
|
|
38
|
+
import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, DragOverlay, useDroppable } from '@dnd-kit/core';
|
|
39
39
|
import { sortableKeyboardCoordinates, arrayMove, useSortable, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
40
40
|
import { CSS } from '@dnd-kit/utilities';
|
|
41
41
|
import { Handle, Position } from '@xyflow/react';
|
|
@@ -20063,6 +20063,10 @@ function useDataDnd(args) {
|
|
|
20063
20063
|
const unregisterZone = React75__default.useCallback((zoneId2) => {
|
|
20064
20064
|
zonesRef.current.delete(zoneId2);
|
|
20065
20065
|
}, []);
|
|
20066
|
+
const [overlayNode, setOverlayNode] = React75__default.useState(null);
|
|
20067
|
+
const setOverlay = React75__default.useCallback((node) => {
|
|
20068
|
+
setOverlayNode(node);
|
|
20069
|
+
}, []);
|
|
20066
20070
|
const zoneId = React75__default.useId();
|
|
20067
20071
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
20068
20072
|
const meta = React75__default.useMemo(
|
|
@@ -20146,6 +20150,7 @@ function useDataDnd(args) {
|
|
|
20146
20150
|
},
|
|
20147
20151
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
20148
20152
|
);
|
|
20153
|
+
const overlaySink = isRoot ? setOverlay : parentRoot?.setOverlay;
|
|
20149
20154
|
const SortableItem = React75__default.useCallback(
|
|
20150
20155
|
({ id, children }) => {
|
|
20151
20156
|
const {
|
|
@@ -20156,6 +20161,13 @@ function useDataDnd(args) {
|
|
|
20156
20161
|
transition,
|
|
20157
20162
|
isDragging
|
|
20158
20163
|
} = useSortable({ id, data: { dndGroup: ownGroup } });
|
|
20164
|
+
const childrenRef = React75__default.useRef(children);
|
|
20165
|
+
childrenRef.current = children;
|
|
20166
|
+
React75__default.useEffect(() => {
|
|
20167
|
+
if (!isDragging || !overlaySink) return;
|
|
20168
|
+
overlaySink(childrenRef.current);
|
|
20169
|
+
return () => overlaySink(null);
|
|
20170
|
+
}, [isDragging]);
|
|
20159
20171
|
const style = {
|
|
20160
20172
|
transform: CSS.Transform.toString(transform),
|
|
20161
20173
|
transition,
|
|
@@ -20174,7 +20186,7 @@ function useDataDnd(args) {
|
|
|
20174
20186
|
}
|
|
20175
20187
|
);
|
|
20176
20188
|
},
|
|
20177
|
-
[ownGroup, enabled]
|
|
20189
|
+
[ownGroup, enabled, overlaySink]
|
|
20178
20190
|
);
|
|
20179
20191
|
const DropZoneShell = ({ children }) => {
|
|
20180
20192
|
const { setNodeRef, isOver } = useDroppable({
|
|
@@ -20192,24 +20204,55 @@ function useDataDnd(args) {
|
|
|
20192
20204
|
);
|
|
20193
20205
|
};
|
|
20194
20206
|
const rootContextValue = React75__default.useMemo(
|
|
20195
|
-
() => ({ registerZone, unregisterZone }),
|
|
20196
|
-
[registerZone, unregisterZone]
|
|
20207
|
+
() => ({ registerZone, unregisterZone, setOverlay }),
|
|
20208
|
+
[registerZone, unregisterZone, setOverlay]
|
|
20197
20209
|
);
|
|
20198
20210
|
const wrapContainer = React75__default.useCallback(
|
|
20199
20211
|
(children) => {
|
|
20200
20212
|
if (!enabled) return children;
|
|
20201
20213
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
20214
|
+
const clearOverlay = () => setOverlay(null);
|
|
20202
20215
|
if (!isZone) {
|
|
20203
20216
|
if (!isRoot) return children;
|
|
20204
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
20217
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxs(
|
|
20218
|
+
DndContext,
|
|
20219
|
+
{
|
|
20220
|
+
sensors,
|
|
20221
|
+
collisionDetection,
|
|
20222
|
+
onDragEnd: (e) => {
|
|
20223
|
+
handleDragEnd(e);
|
|
20224
|
+
clearOverlay();
|
|
20225
|
+
},
|
|
20226
|
+
onDragCancel: clearOverlay,
|
|
20227
|
+
children: [
|
|
20228
|
+
children,
|
|
20229
|
+
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
20230
|
+
]
|
|
20231
|
+
}
|
|
20232
|
+
) });
|
|
20205
20233
|
}
|
|
20206
20234
|
const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
|
|
20207
20235
|
if (isRoot) {
|
|
20208
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
20236
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxs(
|
|
20237
|
+
DndContext,
|
|
20238
|
+
{
|
|
20239
|
+
sensors,
|
|
20240
|
+
collisionDetection,
|
|
20241
|
+
onDragEnd: (e) => {
|
|
20242
|
+
handleDragEnd(e);
|
|
20243
|
+
clearOverlay();
|
|
20244
|
+
},
|
|
20245
|
+
onDragCancel: clearOverlay,
|
|
20246
|
+
children: [
|
|
20247
|
+
inner,
|
|
20248
|
+
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
20249
|
+
]
|
|
20250
|
+
}
|
|
20251
|
+
) });
|
|
20209
20252
|
}
|
|
20210
20253
|
return inner;
|
|
20211
20254
|
},
|
|
20212
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
20255
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue, overlayNode, setOverlay]
|
|
20213
20256
|
);
|
|
20214
20257
|
return {
|
|
20215
20258
|
enabled,
|
|
@@ -20419,7 +20462,7 @@ function DataGrid({
|
|
|
20419
20462
|
const id = itemData.id || String(index);
|
|
20420
20463
|
const isSelected = selectedIds.has(id);
|
|
20421
20464
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
20422
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
20465
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
20423
20466
|
if (hasRenderProp) {
|
|
20424
20467
|
return wrapDnd(
|
|
20425
20468
|
/* @__PURE__ */ jsx(
|
|
@@ -20835,7 +20878,7 @@ function DataList({
|
|
|
20835
20878
|
const idFieldName = dndItemIdField ?? "id";
|
|
20836
20879
|
const renderItem = (itemData, index, isLast) => {
|
|
20837
20880
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
20838
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
20881
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
20839
20882
|
if (hasRenderProp) {
|
|
20840
20883
|
const id2 = itemData.id || String(index);
|
|
20841
20884
|
return wrapDnd(
|
package/dist/providers/index.cjs
CHANGED
|
@@ -21354,6 +21354,10 @@ function useDataDnd(args) {
|
|
|
21354
21354
|
const unregisterZone = React81__namespace.default.useCallback((zoneId2) => {
|
|
21355
21355
|
zonesRef.current.delete(zoneId2);
|
|
21356
21356
|
}, []);
|
|
21357
|
+
const [overlayNode, setOverlayNode] = React81__namespace.default.useState(null);
|
|
21358
|
+
const setOverlay = React81__namespace.default.useCallback((node) => {
|
|
21359
|
+
setOverlayNode(node);
|
|
21360
|
+
}, []);
|
|
21357
21361
|
const zoneId = React81__namespace.default.useId();
|
|
21358
21362
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21359
21363
|
const meta = React81__namespace.default.useMemo(
|
|
@@ -21437,6 +21441,7 @@ function useDataDnd(args) {
|
|
|
21437
21441
|
},
|
|
21438
21442
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
21439
21443
|
);
|
|
21444
|
+
const overlaySink = isRoot ? setOverlay : parentRoot?.setOverlay;
|
|
21440
21445
|
const SortableItem = React81__namespace.default.useCallback(
|
|
21441
21446
|
({ id, children }) => {
|
|
21442
21447
|
const {
|
|
@@ -21447,6 +21452,13 @@ function useDataDnd(args) {
|
|
|
21447
21452
|
transition,
|
|
21448
21453
|
isDragging
|
|
21449
21454
|
} = sortable.useSortable({ id, data: { dndGroup: ownGroup } });
|
|
21455
|
+
const childrenRef = React81__namespace.default.useRef(children);
|
|
21456
|
+
childrenRef.current = children;
|
|
21457
|
+
React81__namespace.default.useEffect(() => {
|
|
21458
|
+
if (!isDragging || !overlaySink) return;
|
|
21459
|
+
overlaySink(childrenRef.current);
|
|
21460
|
+
return () => overlaySink(null);
|
|
21461
|
+
}, [isDragging]);
|
|
21450
21462
|
const style = {
|
|
21451
21463
|
transform: utilities.CSS.Transform.toString(transform),
|
|
21452
21464
|
transition,
|
|
@@ -21465,7 +21477,7 @@ function useDataDnd(args) {
|
|
|
21465
21477
|
}
|
|
21466
21478
|
);
|
|
21467
21479
|
},
|
|
21468
|
-
[ownGroup, enabled]
|
|
21480
|
+
[ownGroup, enabled, overlaySink]
|
|
21469
21481
|
);
|
|
21470
21482
|
const DropZoneShell = ({ children }) => {
|
|
21471
21483
|
const { setNodeRef, isOver } = core$1.useDroppable({
|
|
@@ -21483,24 +21495,55 @@ function useDataDnd(args) {
|
|
|
21483
21495
|
);
|
|
21484
21496
|
};
|
|
21485
21497
|
const rootContextValue = React81__namespace.default.useMemo(
|
|
21486
|
-
() => ({ registerZone, unregisterZone }),
|
|
21487
|
-
[registerZone, unregisterZone]
|
|
21498
|
+
() => ({ registerZone, unregisterZone, setOverlay }),
|
|
21499
|
+
[registerZone, unregisterZone, setOverlay]
|
|
21488
21500
|
);
|
|
21489
21501
|
const wrapContainer = React81__namespace.default.useCallback(
|
|
21490
21502
|
(children) => {
|
|
21491
21503
|
if (!enabled) return children;
|
|
21492
21504
|
const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
|
|
21505
|
+
const clearOverlay = () => setOverlay(null);
|
|
21493
21506
|
if (!isZone) {
|
|
21494
21507
|
if (!isRoot) return children;
|
|
21495
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
21508
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21509
|
+
core$1.DndContext,
|
|
21510
|
+
{
|
|
21511
|
+
sensors,
|
|
21512
|
+
collisionDetection,
|
|
21513
|
+
onDragEnd: (e) => {
|
|
21514
|
+
handleDragEnd(e);
|
|
21515
|
+
clearOverlay();
|
|
21516
|
+
},
|
|
21517
|
+
onDragCancel: clearOverlay,
|
|
21518
|
+
children: [
|
|
21519
|
+
children,
|
|
21520
|
+
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
21521
|
+
]
|
|
21522
|
+
}
|
|
21523
|
+
) });
|
|
21496
21524
|
}
|
|
21497
21525
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
|
|
21498
21526
|
if (isRoot) {
|
|
21499
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
21527
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21528
|
+
core$1.DndContext,
|
|
21529
|
+
{
|
|
21530
|
+
sensors,
|
|
21531
|
+
collisionDetection,
|
|
21532
|
+
onDragEnd: (e) => {
|
|
21533
|
+
handleDragEnd(e);
|
|
21534
|
+
clearOverlay();
|
|
21535
|
+
},
|
|
21536
|
+
onDragCancel: clearOverlay,
|
|
21537
|
+
children: [
|
|
21538
|
+
inner,
|
|
21539
|
+
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
21540
|
+
]
|
|
21541
|
+
}
|
|
21542
|
+
) });
|
|
21500
21543
|
}
|
|
21501
21544
|
return inner;
|
|
21502
21545
|
},
|
|
21503
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
21546
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue, overlayNode, setOverlay]
|
|
21504
21547
|
);
|
|
21505
21548
|
return {
|
|
21506
21549
|
enabled,
|
|
@@ -21710,7 +21753,7 @@ function DataGrid({
|
|
|
21710
21753
|
const id = itemData.id || String(index);
|
|
21711
21754
|
const isSelected = selectedIds.has(id);
|
|
21712
21755
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
21713
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
21756
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
21714
21757
|
if (hasRenderProp) {
|
|
21715
21758
|
return wrapDnd(
|
|
21716
21759
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -22126,7 +22169,7 @@ function DataList({
|
|
|
22126
22169
|
const idFieldName = dndItemIdField ?? "id";
|
|
22127
22170
|
const renderItem = (itemData, index, isLast) => {
|
|
22128
22171
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
22129
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
22172
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
22130
22173
|
if (hasRenderProp) {
|
|
22131
22174
|
const id2 = itemData.id || String(index);
|
|
22132
22175
|
return wrapDnd(
|
package/dist/providers/index.js
CHANGED
|
@@ -36,7 +36,7 @@ import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js'
|
|
|
36
36
|
import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
|
|
37
37
|
import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
|
|
38
38
|
import { isInlineTrait } from '@almadar/core';
|
|
39
|
-
import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, useDroppable } from '@dnd-kit/core';
|
|
39
|
+
import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, DragOverlay, useDroppable } from '@dnd-kit/core';
|
|
40
40
|
import { sortableKeyboardCoordinates, arrayMove, useSortable, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
41
41
|
import { CSS } from '@dnd-kit/utilities';
|
|
42
42
|
import { Handle, Position } from '@xyflow/react';
|
|
@@ -21308,6 +21308,10 @@ function useDataDnd(args) {
|
|
|
21308
21308
|
const unregisterZone = React81__default.useCallback((zoneId2) => {
|
|
21309
21309
|
zonesRef.current.delete(zoneId2);
|
|
21310
21310
|
}, []);
|
|
21311
|
+
const [overlayNode, setOverlayNode] = React81__default.useState(null);
|
|
21312
|
+
const setOverlay = React81__default.useCallback((node) => {
|
|
21313
|
+
setOverlayNode(node);
|
|
21314
|
+
}, []);
|
|
21311
21315
|
const zoneId = React81__default.useId();
|
|
21312
21316
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21313
21317
|
const meta = React81__default.useMemo(
|
|
@@ -21391,6 +21395,7 @@ function useDataDnd(args) {
|
|
|
21391
21395
|
},
|
|
21392
21396
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
21393
21397
|
);
|
|
21398
|
+
const overlaySink = isRoot ? setOverlay : parentRoot?.setOverlay;
|
|
21394
21399
|
const SortableItem = React81__default.useCallback(
|
|
21395
21400
|
({ id, children }) => {
|
|
21396
21401
|
const {
|
|
@@ -21401,6 +21406,13 @@ function useDataDnd(args) {
|
|
|
21401
21406
|
transition,
|
|
21402
21407
|
isDragging
|
|
21403
21408
|
} = useSortable({ id, data: { dndGroup: ownGroup } });
|
|
21409
|
+
const childrenRef = React81__default.useRef(children);
|
|
21410
|
+
childrenRef.current = children;
|
|
21411
|
+
React81__default.useEffect(() => {
|
|
21412
|
+
if (!isDragging || !overlaySink) return;
|
|
21413
|
+
overlaySink(childrenRef.current);
|
|
21414
|
+
return () => overlaySink(null);
|
|
21415
|
+
}, [isDragging]);
|
|
21404
21416
|
const style = {
|
|
21405
21417
|
transform: CSS.Transform.toString(transform),
|
|
21406
21418
|
transition,
|
|
@@ -21419,7 +21431,7 @@ function useDataDnd(args) {
|
|
|
21419
21431
|
}
|
|
21420
21432
|
);
|
|
21421
21433
|
},
|
|
21422
|
-
[ownGroup, enabled]
|
|
21434
|
+
[ownGroup, enabled, overlaySink]
|
|
21423
21435
|
);
|
|
21424
21436
|
const DropZoneShell = ({ children }) => {
|
|
21425
21437
|
const { setNodeRef, isOver } = useDroppable({
|
|
@@ -21437,24 +21449,55 @@ function useDataDnd(args) {
|
|
|
21437
21449
|
);
|
|
21438
21450
|
};
|
|
21439
21451
|
const rootContextValue = React81__default.useMemo(
|
|
21440
|
-
() => ({ registerZone, unregisterZone }),
|
|
21441
|
-
[registerZone, unregisterZone]
|
|
21452
|
+
() => ({ registerZone, unregisterZone, setOverlay }),
|
|
21453
|
+
[registerZone, unregisterZone, setOverlay]
|
|
21442
21454
|
);
|
|
21443
21455
|
const wrapContainer = React81__default.useCallback(
|
|
21444
21456
|
(children) => {
|
|
21445
21457
|
if (!enabled) return children;
|
|
21446
21458
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
21459
|
+
const clearOverlay = () => setOverlay(null);
|
|
21447
21460
|
if (!isZone) {
|
|
21448
21461
|
if (!isRoot) return children;
|
|
21449
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
21462
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxs(
|
|
21463
|
+
DndContext,
|
|
21464
|
+
{
|
|
21465
|
+
sensors,
|
|
21466
|
+
collisionDetection,
|
|
21467
|
+
onDragEnd: (e) => {
|
|
21468
|
+
handleDragEnd(e);
|
|
21469
|
+
clearOverlay();
|
|
21470
|
+
},
|
|
21471
|
+
onDragCancel: clearOverlay,
|
|
21472
|
+
children: [
|
|
21473
|
+
children,
|
|
21474
|
+
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
21475
|
+
]
|
|
21476
|
+
}
|
|
21477
|
+
) });
|
|
21450
21478
|
}
|
|
21451
21479
|
const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
|
|
21452
21480
|
if (isRoot) {
|
|
21453
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
21481
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxs(
|
|
21482
|
+
DndContext,
|
|
21483
|
+
{
|
|
21484
|
+
sensors,
|
|
21485
|
+
collisionDetection,
|
|
21486
|
+
onDragEnd: (e) => {
|
|
21487
|
+
handleDragEnd(e);
|
|
21488
|
+
clearOverlay();
|
|
21489
|
+
},
|
|
21490
|
+
onDragCancel: clearOverlay,
|
|
21491
|
+
children: [
|
|
21492
|
+
inner,
|
|
21493
|
+
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
21494
|
+
]
|
|
21495
|
+
}
|
|
21496
|
+
) });
|
|
21454
21497
|
}
|
|
21455
21498
|
return inner;
|
|
21456
21499
|
},
|
|
21457
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
21500
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue, overlayNode, setOverlay]
|
|
21458
21501
|
);
|
|
21459
21502
|
return {
|
|
21460
21503
|
enabled,
|
|
@@ -21664,7 +21707,7 @@ function DataGrid({
|
|
|
21664
21707
|
const id = itemData.id || String(index);
|
|
21665
21708
|
const isSelected = selectedIds.has(id);
|
|
21666
21709
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
21667
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
21710
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
21668
21711
|
if (hasRenderProp) {
|
|
21669
21712
|
return wrapDnd(
|
|
21670
21713
|
/* @__PURE__ */ jsx(
|
|
@@ -22080,7 +22123,7 @@ function DataList({
|
|
|
22080
22123
|
const idFieldName = dndItemIdField ?? "id";
|
|
22081
22124
|
const renderItem = (itemData, index, isLast) => {
|
|
22082
22125
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
22083
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
22126
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
22084
22127
|
if (hasRenderProp) {
|
|
22085
22128
|
const id2 = itemData.id || String(index);
|
|
22086
22129
|
return wrapDnd(
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -21123,6 +21123,10 @@ function useDataDnd(args) {
|
|
|
21123
21123
|
const unregisterZone = React80__namespace.default.useCallback((zoneId2) => {
|
|
21124
21124
|
zonesRef.current.delete(zoneId2);
|
|
21125
21125
|
}, []);
|
|
21126
|
+
const [overlayNode, setOverlayNode] = React80__namespace.default.useState(null);
|
|
21127
|
+
const setOverlay = React80__namespace.default.useCallback((node) => {
|
|
21128
|
+
setOverlayNode(node);
|
|
21129
|
+
}, []);
|
|
21126
21130
|
const zoneId = React80__namespace.default.useId();
|
|
21127
21131
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21128
21132
|
const meta = React80__namespace.default.useMemo(
|
|
@@ -21206,6 +21210,7 @@ function useDataDnd(args) {
|
|
|
21206
21210
|
},
|
|
21207
21211
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
21208
21212
|
);
|
|
21213
|
+
const overlaySink = isRoot ? setOverlay : parentRoot?.setOverlay;
|
|
21209
21214
|
const SortableItem = React80__namespace.default.useCallback(
|
|
21210
21215
|
({ id, children }) => {
|
|
21211
21216
|
const {
|
|
@@ -21216,6 +21221,13 @@ function useDataDnd(args) {
|
|
|
21216
21221
|
transition,
|
|
21217
21222
|
isDragging
|
|
21218
21223
|
} = sortable.useSortable({ id, data: { dndGroup: ownGroup } });
|
|
21224
|
+
const childrenRef = React80__namespace.default.useRef(children);
|
|
21225
|
+
childrenRef.current = children;
|
|
21226
|
+
React80__namespace.default.useEffect(() => {
|
|
21227
|
+
if (!isDragging || !overlaySink) return;
|
|
21228
|
+
overlaySink(childrenRef.current);
|
|
21229
|
+
return () => overlaySink(null);
|
|
21230
|
+
}, [isDragging]);
|
|
21219
21231
|
const style = {
|
|
21220
21232
|
transform: utilities.CSS.Transform.toString(transform),
|
|
21221
21233
|
transition,
|
|
@@ -21234,7 +21246,7 @@ function useDataDnd(args) {
|
|
|
21234
21246
|
}
|
|
21235
21247
|
);
|
|
21236
21248
|
},
|
|
21237
|
-
[ownGroup, enabled]
|
|
21249
|
+
[ownGroup, enabled, overlaySink]
|
|
21238
21250
|
);
|
|
21239
21251
|
const DropZoneShell = ({ children }) => {
|
|
21240
21252
|
const { setNodeRef, isOver } = core$1.useDroppable({
|
|
@@ -21252,24 +21264,55 @@ function useDataDnd(args) {
|
|
|
21252
21264
|
);
|
|
21253
21265
|
};
|
|
21254
21266
|
const rootContextValue = React80__namespace.default.useMemo(
|
|
21255
|
-
() => ({ registerZone, unregisterZone }),
|
|
21256
|
-
[registerZone, unregisterZone]
|
|
21267
|
+
() => ({ registerZone, unregisterZone, setOverlay }),
|
|
21268
|
+
[registerZone, unregisterZone, setOverlay]
|
|
21257
21269
|
);
|
|
21258
21270
|
const wrapContainer = React80__namespace.default.useCallback(
|
|
21259
21271
|
(children) => {
|
|
21260
21272
|
if (!enabled) return children;
|
|
21261
21273
|
const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
|
|
21274
|
+
const clearOverlay = () => setOverlay(null);
|
|
21262
21275
|
if (!isZone) {
|
|
21263
21276
|
if (!isRoot) return children;
|
|
21264
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
21277
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21278
|
+
core$1.DndContext,
|
|
21279
|
+
{
|
|
21280
|
+
sensors,
|
|
21281
|
+
collisionDetection,
|
|
21282
|
+
onDragEnd: (e) => {
|
|
21283
|
+
handleDragEnd(e);
|
|
21284
|
+
clearOverlay();
|
|
21285
|
+
},
|
|
21286
|
+
onDragCancel: clearOverlay,
|
|
21287
|
+
children: [
|
|
21288
|
+
children,
|
|
21289
|
+
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
21290
|
+
]
|
|
21291
|
+
}
|
|
21292
|
+
) });
|
|
21265
21293
|
}
|
|
21266
21294
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
|
|
21267
21295
|
if (isRoot) {
|
|
21268
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
21296
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21297
|
+
core$1.DndContext,
|
|
21298
|
+
{
|
|
21299
|
+
sensors,
|
|
21300
|
+
collisionDetection,
|
|
21301
|
+
onDragEnd: (e) => {
|
|
21302
|
+
handleDragEnd(e);
|
|
21303
|
+
clearOverlay();
|
|
21304
|
+
},
|
|
21305
|
+
onDragCancel: clearOverlay,
|
|
21306
|
+
children: [
|
|
21307
|
+
inner,
|
|
21308
|
+
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
21309
|
+
]
|
|
21310
|
+
}
|
|
21311
|
+
) });
|
|
21269
21312
|
}
|
|
21270
21313
|
return inner;
|
|
21271
21314
|
},
|
|
21272
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
21315
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue, overlayNode, setOverlay]
|
|
21273
21316
|
);
|
|
21274
21317
|
return {
|
|
21275
21318
|
enabled,
|
|
@@ -21479,7 +21522,7 @@ function DataGrid({
|
|
|
21479
21522
|
const id = itemData.id || String(index);
|
|
21480
21523
|
const isSelected = selectedIds.has(id);
|
|
21481
21524
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
21482
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
21525
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
21483
21526
|
if (hasRenderProp) {
|
|
21484
21527
|
return wrapDnd(
|
|
21485
21528
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -21895,7 +21938,7 @@ function DataList({
|
|
|
21895
21938
|
const idFieldName = dndItemIdField ?? "id";
|
|
21896
21939
|
const renderItem = (itemData, index, isLast) => {
|
|
21897
21940
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
21898
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
21941
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
21899
21942
|
if (hasRenderProp) {
|
|
21900
21943
|
const id2 = itemData.id || String(index);
|
|
21901
21944
|
return wrapDnd(
|
package/dist/runtime/index.js
CHANGED
|
@@ -36,7 +36,7 @@ import langToml from 'react-syntax-highlighter/dist/esm/languages/prism/toml.js'
|
|
|
36
36
|
import langGo from 'react-syntax-highlighter/dist/esm/languages/prism/go.js';
|
|
37
37
|
import langGraphql from 'react-syntax-highlighter/dist/esm/languages/prism/graphql.js';
|
|
38
38
|
import { isCircuitEvent, schemaToIR, getPage, clearSchemaCache as clearSchemaCache$1, isEntityCall, isInlineTrait } from '@almadar/core';
|
|
39
|
-
import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, useDroppable } from '@dnd-kit/core';
|
|
39
|
+
import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, DragOverlay, useDroppable } from '@dnd-kit/core';
|
|
40
40
|
import { sortableKeyboardCoordinates, arrayMove, useSortable, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
41
41
|
import { CSS } from '@dnd-kit/utilities';
|
|
42
42
|
import { Handle, Position } from '@xyflow/react';
|
|
@@ -21077,6 +21077,10 @@ function useDataDnd(args) {
|
|
|
21077
21077
|
const unregisterZone = React80__default.useCallback((zoneId2) => {
|
|
21078
21078
|
zonesRef.current.delete(zoneId2);
|
|
21079
21079
|
}, []);
|
|
21080
|
+
const [overlayNode, setOverlayNode] = React80__default.useState(null);
|
|
21081
|
+
const setOverlay = React80__default.useCallback((node) => {
|
|
21082
|
+
setOverlayNode(node);
|
|
21083
|
+
}, []);
|
|
21080
21084
|
const zoneId = React80__default.useId();
|
|
21081
21085
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21082
21086
|
const meta = React80__default.useMemo(
|
|
@@ -21160,6 +21164,7 @@ function useDataDnd(args) {
|
|
|
21160
21164
|
},
|
|
21161
21165
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
21162
21166
|
);
|
|
21167
|
+
const overlaySink = isRoot ? setOverlay : parentRoot?.setOverlay;
|
|
21163
21168
|
const SortableItem = React80__default.useCallback(
|
|
21164
21169
|
({ id, children }) => {
|
|
21165
21170
|
const {
|
|
@@ -21170,6 +21175,13 @@ function useDataDnd(args) {
|
|
|
21170
21175
|
transition,
|
|
21171
21176
|
isDragging
|
|
21172
21177
|
} = useSortable({ id, data: { dndGroup: ownGroup } });
|
|
21178
|
+
const childrenRef = React80__default.useRef(children);
|
|
21179
|
+
childrenRef.current = children;
|
|
21180
|
+
React80__default.useEffect(() => {
|
|
21181
|
+
if (!isDragging || !overlaySink) return;
|
|
21182
|
+
overlaySink(childrenRef.current);
|
|
21183
|
+
return () => overlaySink(null);
|
|
21184
|
+
}, [isDragging]);
|
|
21173
21185
|
const style = {
|
|
21174
21186
|
transform: CSS.Transform.toString(transform),
|
|
21175
21187
|
transition,
|
|
@@ -21188,7 +21200,7 @@ function useDataDnd(args) {
|
|
|
21188
21200
|
}
|
|
21189
21201
|
);
|
|
21190
21202
|
},
|
|
21191
|
-
[ownGroup, enabled]
|
|
21203
|
+
[ownGroup, enabled, overlaySink]
|
|
21192
21204
|
);
|
|
21193
21205
|
const DropZoneShell = ({ children }) => {
|
|
21194
21206
|
const { setNodeRef, isOver } = useDroppable({
|
|
@@ -21206,24 +21218,55 @@ function useDataDnd(args) {
|
|
|
21206
21218
|
);
|
|
21207
21219
|
};
|
|
21208
21220
|
const rootContextValue = React80__default.useMemo(
|
|
21209
|
-
() => ({ registerZone, unregisterZone }),
|
|
21210
|
-
[registerZone, unregisterZone]
|
|
21221
|
+
() => ({ registerZone, unregisterZone, setOverlay }),
|
|
21222
|
+
[registerZone, unregisterZone, setOverlay]
|
|
21211
21223
|
);
|
|
21212
21224
|
const wrapContainer = React80__default.useCallback(
|
|
21213
21225
|
(children) => {
|
|
21214
21226
|
if (!enabled) return children;
|
|
21215
21227
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
21228
|
+
const clearOverlay = () => setOverlay(null);
|
|
21216
21229
|
if (!isZone) {
|
|
21217
21230
|
if (!isRoot) return children;
|
|
21218
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
21231
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxs(
|
|
21232
|
+
DndContext,
|
|
21233
|
+
{
|
|
21234
|
+
sensors,
|
|
21235
|
+
collisionDetection,
|
|
21236
|
+
onDragEnd: (e) => {
|
|
21237
|
+
handleDragEnd(e);
|
|
21238
|
+
clearOverlay();
|
|
21239
|
+
},
|
|
21240
|
+
onDragCancel: clearOverlay,
|
|
21241
|
+
children: [
|
|
21242
|
+
children,
|
|
21243
|
+
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
21244
|
+
]
|
|
21245
|
+
}
|
|
21246
|
+
) });
|
|
21219
21247
|
}
|
|
21220
21248
|
const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
|
|
21221
21249
|
if (isRoot) {
|
|
21222
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
21250
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxs(
|
|
21251
|
+
DndContext,
|
|
21252
|
+
{
|
|
21253
|
+
sensors,
|
|
21254
|
+
collisionDetection,
|
|
21255
|
+
onDragEnd: (e) => {
|
|
21256
|
+
handleDragEnd(e);
|
|
21257
|
+
clearOverlay();
|
|
21258
|
+
},
|
|
21259
|
+
onDragCancel: clearOverlay,
|
|
21260
|
+
children: [
|
|
21261
|
+
inner,
|
|
21262
|
+
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
21263
|
+
]
|
|
21264
|
+
}
|
|
21265
|
+
) });
|
|
21223
21266
|
}
|
|
21224
21267
|
return inner;
|
|
21225
21268
|
},
|
|
21226
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
21269
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue, overlayNode, setOverlay]
|
|
21227
21270
|
);
|
|
21228
21271
|
return {
|
|
21229
21272
|
enabled,
|
|
@@ -21433,7 +21476,7 @@ function DataGrid({
|
|
|
21433
21476
|
const id = itemData.id || String(index);
|
|
21434
21477
|
const isSelected = selectedIds.has(id);
|
|
21435
21478
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
21436
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
21479
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
21437
21480
|
if (hasRenderProp) {
|
|
21438
21481
|
return wrapDnd(
|
|
21439
21482
|
/* @__PURE__ */ jsx(
|
|
@@ -21849,7 +21892,7 @@ function DataList({
|
|
|
21849
21892
|
const idFieldName = dndItemIdField ?? "id";
|
|
21850
21893
|
const renderItem = (itemData, index, isLast) => {
|
|
21851
21894
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
21852
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
21895
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
21853
21896
|
if (hasRenderProp) {
|
|
21854
21897
|
const id2 = itemData.id || String(index);
|
|
21855
21898
|
return wrapDnd(
|