@almadar/ui 4.50.3 → 4.50.5
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 +22 -53
- package/dist/avl/index.js +23 -54
- package/dist/components/index.cjs +22 -53
- package/dist/components/index.js +23 -54
- package/dist/providers/index.cjs +22 -53
- package/dist/providers/index.js +23 -54
- package/dist/runtime/index.cjs +22 -53
- package/dist/runtime/index.js +23 -54
- package/package.json +1 -1
package/dist/avl/index.cjs
CHANGED
|
@@ -24928,12 +24928,17 @@ function useDataDnd(args) {
|
|
|
24928
24928
|
React93__namespace.default.useEffect(() => {
|
|
24929
24929
|
setLocalOrder(null);
|
|
24930
24930
|
}, [items]);
|
|
24931
|
+
const itemIdsSignature = orderedItems.map((it, idx) => {
|
|
24932
|
+
const raw = it[dndItemIdField];
|
|
24933
|
+
return String(raw ?? `__idx_${idx}`);
|
|
24934
|
+
}).join("|");
|
|
24931
24935
|
const itemIds = React93__namespace.default.useMemo(
|
|
24932
24936
|
() => orderedItems.map((it, idx) => {
|
|
24933
24937
|
const raw = it[dndItemIdField];
|
|
24934
24938
|
return raw ?? `__idx_${idx}`;
|
|
24935
24939
|
}),
|
|
24936
|
-
|
|
24940
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24941
|
+
[itemIdsSignature]
|
|
24937
24942
|
);
|
|
24938
24943
|
const zonesRef = React93__namespace.default.useRef(/* @__PURE__ */ new Map());
|
|
24939
24944
|
const registerZone = React93__namespace.default.useCallback((zoneId2, meta2) => {
|
|
@@ -24942,10 +24947,6 @@ function useDataDnd(args) {
|
|
|
24942
24947
|
const unregisterZone = React93__namespace.default.useCallback((zoneId2) => {
|
|
24943
24948
|
zonesRef.current.delete(zoneId2);
|
|
24944
24949
|
}, []);
|
|
24945
|
-
const [overlayNode, setOverlayNode] = React93__namespace.default.useState(null);
|
|
24946
|
-
const setOverlay = React93__namespace.default.useCallback((node) => {
|
|
24947
|
-
setOverlayNode(node);
|
|
24948
|
-
}, []);
|
|
24949
24950
|
const zoneId = React93__namespace.default.useId();
|
|
24950
24951
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
24951
24952
|
const meta = React93__namespace.default.useMemo(
|
|
@@ -25029,7 +25030,7 @@ function useDataDnd(args) {
|
|
|
25029
25030
|
},
|
|
25030
25031
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
25031
25032
|
);
|
|
25032
|
-
const
|
|
25033
|
+
const sortableData = React93__namespace.default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
25033
25034
|
const SortableItem = React93__namespace.default.useCallback(
|
|
25034
25035
|
({ id, children }) => {
|
|
25035
25036
|
const {
|
|
@@ -25039,17 +25040,16 @@ function useDataDnd(args) {
|
|
|
25039
25040
|
transform,
|
|
25040
25041
|
transition,
|
|
25041
25042
|
isDragging
|
|
25042
|
-
} = sortable.useSortable({ id, data:
|
|
25043
|
-
React93__namespace.default.useEffect(() => {
|
|
25044
|
-
if (!isDragging || !overlaySink) return;
|
|
25045
|
-
overlaySink(children);
|
|
25046
|
-
return () => overlaySink(null);
|
|
25047
|
-
}, [isDragging, children]);
|
|
25043
|
+
} = sortable.useSortable({ id, data: sortableData });
|
|
25048
25044
|
const style = {
|
|
25049
25045
|
transform: utilities.CSS.Transform.toString(transform),
|
|
25050
25046
|
transition,
|
|
25051
25047
|
opacity: isDragging ? 0.4 : 1,
|
|
25052
|
-
cursor: enabled ? "grab" : void 0
|
|
25048
|
+
cursor: enabled ? "grab" : void 0,
|
|
25049
|
+
// Lift the dragged element above siblings so its visual movement
|
|
25050
|
+
// isn't hidden behind other cards / column boundaries.
|
|
25051
|
+
zIndex: isDragging ? 50 : void 0,
|
|
25052
|
+
position: isDragging ? "relative" : void 0
|
|
25053
25053
|
};
|
|
25054
25054
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
25055
25055
|
Box,
|
|
@@ -25063,12 +25063,12 @@ function useDataDnd(args) {
|
|
|
25063
25063
|
}
|
|
25064
25064
|
);
|
|
25065
25065
|
},
|
|
25066
|
-
[
|
|
25066
|
+
[sortableData, enabled]
|
|
25067
25067
|
);
|
|
25068
25068
|
const DropZoneShell = ({ children }) => {
|
|
25069
25069
|
const { setNodeRef, isOver } = core$1.useDroppable({
|
|
25070
25070
|
id: `dnd-zone-${zoneId}`,
|
|
25071
|
-
data:
|
|
25071
|
+
data: sortableData
|
|
25072
25072
|
});
|
|
25073
25073
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
25074
25074
|
Box,
|
|
@@ -25081,55 +25081,24 @@ function useDataDnd(args) {
|
|
|
25081
25081
|
);
|
|
25082
25082
|
};
|
|
25083
25083
|
const rootContextValue = React93__namespace.default.useMemo(
|
|
25084
|
-
() => ({ registerZone, unregisterZone
|
|
25085
|
-
[registerZone, unregisterZone
|
|
25084
|
+
() => ({ registerZone, unregisterZone }),
|
|
25085
|
+
[registerZone, unregisterZone]
|
|
25086
25086
|
);
|
|
25087
25087
|
const wrapContainer = React93__namespace.default.useCallback(
|
|
25088
25088
|
(children) => {
|
|
25089
25089
|
if (!enabled) return children;
|
|
25090
25090
|
const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
|
|
25091
|
-
const clearOverlay = () => setOverlay(null);
|
|
25092
25091
|
if (!isZone) {
|
|
25093
25092
|
if (!isRoot) return children;
|
|
25094
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
25095
|
-
core$1.DndContext,
|
|
25096
|
-
{
|
|
25097
|
-
sensors,
|
|
25098
|
-
collisionDetection,
|
|
25099
|
-
onDragEnd: (e) => {
|
|
25100
|
-
handleDragEnd(e);
|
|
25101
|
-
clearOverlay();
|
|
25102
|
-
},
|
|
25103
|
-
onDragCancel: clearOverlay,
|
|
25104
|
-
children: [
|
|
25105
|
-
children,
|
|
25106
|
-
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
25107
|
-
]
|
|
25108
|
-
}
|
|
25109
|
-
) });
|
|
25093
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
|
|
25110
25094
|
}
|
|
25111
25095
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
|
|
25112
25096
|
if (isRoot) {
|
|
25113
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
25114
|
-
core$1.DndContext,
|
|
25115
|
-
{
|
|
25116
|
-
sensors,
|
|
25117
|
-
collisionDetection,
|
|
25118
|
-
onDragEnd: (e) => {
|
|
25119
|
-
handleDragEnd(e);
|
|
25120
|
-
clearOverlay();
|
|
25121
|
-
},
|
|
25122
|
-
onDragCancel: clearOverlay,
|
|
25123
|
-
children: [
|
|
25124
|
-
inner,
|
|
25125
|
-
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
25126
|
-
]
|
|
25127
|
-
}
|
|
25128
|
-
) });
|
|
25097
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
|
|
25129
25098
|
}
|
|
25130
25099
|
return inner;
|
|
25131
25100
|
},
|
|
25132
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue
|
|
25101
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
25133
25102
|
);
|
|
25134
25103
|
return {
|
|
25135
25104
|
enabled,
|
|
@@ -25339,7 +25308,7 @@ function DataGrid({
|
|
|
25339
25308
|
const id = itemData.id || String(index);
|
|
25340
25309
|
const isSelected = selectedIds.has(id);
|
|
25341
25310
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
25342
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
25311
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
25343
25312
|
if (hasRenderProp) {
|
|
25344
25313
|
return wrapDnd(
|
|
25345
25314
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -25755,7 +25724,7 @@ function DataList({
|
|
|
25755
25724
|
const idFieldName = dndItemIdField ?? "id";
|
|
25756
25725
|
const renderItem = (itemData, index, isLast) => {
|
|
25757
25726
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
25758
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
25727
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
25759
25728
|
if (hasRenderProp) {
|
|
25760
25729
|
const id2 = itemData.id || String(index);
|
|
25761
25730
|
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,
|
|
37
|
+
import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, 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';
|
|
@@ -24882,12 +24882,17 @@ function useDataDnd(args) {
|
|
|
24882
24882
|
React93__default.useEffect(() => {
|
|
24883
24883
|
setLocalOrder(null);
|
|
24884
24884
|
}, [items]);
|
|
24885
|
+
const itemIdsSignature = orderedItems.map((it, idx) => {
|
|
24886
|
+
const raw = it[dndItemIdField];
|
|
24887
|
+
return String(raw ?? `__idx_${idx}`);
|
|
24888
|
+
}).join("|");
|
|
24885
24889
|
const itemIds = React93__default.useMemo(
|
|
24886
24890
|
() => orderedItems.map((it, idx) => {
|
|
24887
24891
|
const raw = it[dndItemIdField];
|
|
24888
24892
|
return raw ?? `__idx_${idx}`;
|
|
24889
24893
|
}),
|
|
24890
|
-
|
|
24894
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24895
|
+
[itemIdsSignature]
|
|
24891
24896
|
);
|
|
24892
24897
|
const zonesRef = React93__default.useRef(/* @__PURE__ */ new Map());
|
|
24893
24898
|
const registerZone = React93__default.useCallback((zoneId2, meta2) => {
|
|
@@ -24896,10 +24901,6 @@ function useDataDnd(args) {
|
|
|
24896
24901
|
const unregisterZone = React93__default.useCallback((zoneId2) => {
|
|
24897
24902
|
zonesRef.current.delete(zoneId2);
|
|
24898
24903
|
}, []);
|
|
24899
|
-
const [overlayNode, setOverlayNode] = React93__default.useState(null);
|
|
24900
|
-
const setOverlay = React93__default.useCallback((node) => {
|
|
24901
|
-
setOverlayNode(node);
|
|
24902
|
-
}, []);
|
|
24903
24904
|
const zoneId = React93__default.useId();
|
|
24904
24905
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
24905
24906
|
const meta = React93__default.useMemo(
|
|
@@ -24983,7 +24984,7 @@ function useDataDnd(args) {
|
|
|
24983
24984
|
},
|
|
24984
24985
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
24985
24986
|
);
|
|
24986
|
-
const
|
|
24987
|
+
const sortableData = React93__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
24987
24988
|
const SortableItem = React93__default.useCallback(
|
|
24988
24989
|
({ id, children }) => {
|
|
24989
24990
|
const {
|
|
@@ -24993,17 +24994,16 @@ function useDataDnd(args) {
|
|
|
24993
24994
|
transform,
|
|
24994
24995
|
transition,
|
|
24995
24996
|
isDragging
|
|
24996
|
-
} = useSortable({ id, data:
|
|
24997
|
-
React93__default.useEffect(() => {
|
|
24998
|
-
if (!isDragging || !overlaySink) return;
|
|
24999
|
-
overlaySink(children);
|
|
25000
|
-
return () => overlaySink(null);
|
|
25001
|
-
}, [isDragging, children]);
|
|
24997
|
+
} = useSortable({ id, data: sortableData });
|
|
25002
24998
|
const style = {
|
|
25003
24999
|
transform: CSS.Transform.toString(transform),
|
|
25004
25000
|
transition,
|
|
25005
25001
|
opacity: isDragging ? 0.4 : 1,
|
|
25006
|
-
cursor: enabled ? "grab" : void 0
|
|
25002
|
+
cursor: enabled ? "grab" : void 0,
|
|
25003
|
+
// Lift the dragged element above siblings so its visual movement
|
|
25004
|
+
// isn't hidden behind other cards / column boundaries.
|
|
25005
|
+
zIndex: isDragging ? 50 : void 0,
|
|
25006
|
+
position: isDragging ? "relative" : void 0
|
|
25007
25007
|
};
|
|
25008
25008
|
return /* @__PURE__ */ jsx(
|
|
25009
25009
|
Box,
|
|
@@ -25017,12 +25017,12 @@ function useDataDnd(args) {
|
|
|
25017
25017
|
}
|
|
25018
25018
|
);
|
|
25019
25019
|
},
|
|
25020
|
-
[
|
|
25020
|
+
[sortableData, enabled]
|
|
25021
25021
|
);
|
|
25022
25022
|
const DropZoneShell = ({ children }) => {
|
|
25023
25023
|
const { setNodeRef, isOver } = useDroppable({
|
|
25024
25024
|
id: `dnd-zone-${zoneId}`,
|
|
25025
|
-
data:
|
|
25025
|
+
data: sortableData
|
|
25026
25026
|
});
|
|
25027
25027
|
return /* @__PURE__ */ jsx(
|
|
25028
25028
|
Box,
|
|
@@ -25035,55 +25035,24 @@ function useDataDnd(args) {
|
|
|
25035
25035
|
);
|
|
25036
25036
|
};
|
|
25037
25037
|
const rootContextValue = React93__default.useMemo(
|
|
25038
|
-
() => ({ registerZone, unregisterZone
|
|
25039
|
-
[registerZone, unregisterZone
|
|
25038
|
+
() => ({ registerZone, unregisterZone }),
|
|
25039
|
+
[registerZone, unregisterZone]
|
|
25040
25040
|
);
|
|
25041
25041
|
const wrapContainer = React93__default.useCallback(
|
|
25042
25042
|
(children) => {
|
|
25043
25043
|
if (!enabled) return children;
|
|
25044
25044
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
25045
|
-
const clearOverlay = () => setOverlay(null);
|
|
25046
25045
|
if (!isZone) {
|
|
25047
25046
|
if (!isRoot) return children;
|
|
25048
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
25049
|
-
DndContext,
|
|
25050
|
-
{
|
|
25051
|
-
sensors,
|
|
25052
|
-
collisionDetection,
|
|
25053
|
-
onDragEnd: (e) => {
|
|
25054
|
-
handleDragEnd(e);
|
|
25055
|
-
clearOverlay();
|
|
25056
|
-
},
|
|
25057
|
-
onDragCancel: clearOverlay,
|
|
25058
|
-
children: [
|
|
25059
|
-
children,
|
|
25060
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
25061
|
-
]
|
|
25062
|
-
}
|
|
25063
|
-
) });
|
|
25047
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
|
|
25064
25048
|
}
|
|
25065
25049
|
const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
|
|
25066
25050
|
if (isRoot) {
|
|
25067
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
25068
|
-
DndContext,
|
|
25069
|
-
{
|
|
25070
|
-
sensors,
|
|
25071
|
-
collisionDetection,
|
|
25072
|
-
onDragEnd: (e) => {
|
|
25073
|
-
handleDragEnd(e);
|
|
25074
|
-
clearOverlay();
|
|
25075
|
-
},
|
|
25076
|
-
onDragCancel: clearOverlay,
|
|
25077
|
-
children: [
|
|
25078
|
-
inner,
|
|
25079
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
25080
|
-
]
|
|
25081
|
-
}
|
|
25082
|
-
) });
|
|
25051
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
|
|
25083
25052
|
}
|
|
25084
25053
|
return inner;
|
|
25085
25054
|
},
|
|
25086
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue
|
|
25055
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
25087
25056
|
);
|
|
25088
25057
|
return {
|
|
25089
25058
|
enabled,
|
|
@@ -25293,7 +25262,7 @@ function DataGrid({
|
|
|
25293
25262
|
const id = itemData.id || String(index);
|
|
25294
25263
|
const isSelected = selectedIds.has(id);
|
|
25295
25264
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
25296
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
25265
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
25297
25266
|
if (hasRenderProp) {
|
|
25298
25267
|
return wrapDnd(
|
|
25299
25268
|
/* @__PURE__ */ jsx(
|
|
@@ -25709,7 +25678,7 @@ function DataList({
|
|
|
25709
25678
|
const idFieldName = dndItemIdField ?? "id";
|
|
25710
25679
|
const renderItem = (itemData, index, isLast) => {
|
|
25711
25680
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
25712
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
25681
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
25713
25682
|
if (hasRenderProp) {
|
|
25714
25683
|
const id2 = itemData.id || String(index);
|
|
25715
25684
|
return wrapDnd(
|
|
@@ -20095,12 +20095,17 @@ function useDataDnd(args) {
|
|
|
20095
20095
|
React75__namespace.default.useEffect(() => {
|
|
20096
20096
|
setLocalOrder(null);
|
|
20097
20097
|
}, [items]);
|
|
20098
|
+
const itemIdsSignature = orderedItems.map((it, idx) => {
|
|
20099
|
+
const raw = it[dndItemIdField];
|
|
20100
|
+
return String(raw ?? `__idx_${idx}`);
|
|
20101
|
+
}).join("|");
|
|
20098
20102
|
const itemIds = React75__namespace.default.useMemo(
|
|
20099
20103
|
() => orderedItems.map((it, idx) => {
|
|
20100
20104
|
const raw = it[dndItemIdField];
|
|
20101
20105
|
return raw ?? `__idx_${idx}`;
|
|
20102
20106
|
}),
|
|
20103
|
-
|
|
20107
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20108
|
+
[itemIdsSignature]
|
|
20104
20109
|
);
|
|
20105
20110
|
const zonesRef = React75__namespace.default.useRef(/* @__PURE__ */ new Map());
|
|
20106
20111
|
const registerZone = React75__namespace.default.useCallback((zoneId2, meta2) => {
|
|
@@ -20109,10 +20114,6 @@ function useDataDnd(args) {
|
|
|
20109
20114
|
const unregisterZone = React75__namespace.default.useCallback((zoneId2) => {
|
|
20110
20115
|
zonesRef.current.delete(zoneId2);
|
|
20111
20116
|
}, []);
|
|
20112
|
-
const [overlayNode, setOverlayNode] = React75__namespace.default.useState(null);
|
|
20113
|
-
const setOverlay = React75__namespace.default.useCallback((node) => {
|
|
20114
|
-
setOverlayNode(node);
|
|
20115
|
-
}, []);
|
|
20116
20117
|
const zoneId = React75__namespace.default.useId();
|
|
20117
20118
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
20118
20119
|
const meta = React75__namespace.default.useMemo(
|
|
@@ -20196,7 +20197,7 @@ function useDataDnd(args) {
|
|
|
20196
20197
|
},
|
|
20197
20198
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
20198
20199
|
);
|
|
20199
|
-
const
|
|
20200
|
+
const sortableData = React75__namespace.default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
20200
20201
|
const SortableItem = React75__namespace.default.useCallback(
|
|
20201
20202
|
({ id, children }) => {
|
|
20202
20203
|
const {
|
|
@@ -20206,17 +20207,16 @@ function useDataDnd(args) {
|
|
|
20206
20207
|
transform,
|
|
20207
20208
|
transition,
|
|
20208
20209
|
isDragging
|
|
20209
|
-
} = sortable.useSortable({ id, data:
|
|
20210
|
-
React75__namespace.default.useEffect(() => {
|
|
20211
|
-
if (!isDragging || !overlaySink) return;
|
|
20212
|
-
overlaySink(children);
|
|
20213
|
-
return () => overlaySink(null);
|
|
20214
|
-
}, [isDragging, children]);
|
|
20210
|
+
} = sortable.useSortable({ id, data: sortableData });
|
|
20215
20211
|
const style = {
|
|
20216
20212
|
transform: utilities.CSS.Transform.toString(transform),
|
|
20217
20213
|
transition,
|
|
20218
20214
|
opacity: isDragging ? 0.4 : 1,
|
|
20219
|
-
cursor: enabled ? "grab" : void 0
|
|
20215
|
+
cursor: enabled ? "grab" : void 0,
|
|
20216
|
+
// Lift the dragged element above siblings so its visual movement
|
|
20217
|
+
// isn't hidden behind other cards / column boundaries.
|
|
20218
|
+
zIndex: isDragging ? 50 : void 0,
|
|
20219
|
+
position: isDragging ? "relative" : void 0
|
|
20220
20220
|
};
|
|
20221
20221
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
20222
20222
|
exports.Box,
|
|
@@ -20230,12 +20230,12 @@ function useDataDnd(args) {
|
|
|
20230
20230
|
}
|
|
20231
20231
|
);
|
|
20232
20232
|
},
|
|
20233
|
-
[
|
|
20233
|
+
[sortableData, enabled]
|
|
20234
20234
|
);
|
|
20235
20235
|
const DropZoneShell = ({ children }) => {
|
|
20236
20236
|
const { setNodeRef, isOver } = core$1.useDroppable({
|
|
20237
20237
|
id: `dnd-zone-${zoneId}`,
|
|
20238
|
-
data:
|
|
20238
|
+
data: sortableData
|
|
20239
20239
|
});
|
|
20240
20240
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
20241
20241
|
exports.Box,
|
|
@@ -20248,55 +20248,24 @@ function useDataDnd(args) {
|
|
|
20248
20248
|
);
|
|
20249
20249
|
};
|
|
20250
20250
|
const rootContextValue = React75__namespace.default.useMemo(
|
|
20251
|
-
() => ({ registerZone, unregisterZone
|
|
20252
|
-
[registerZone, unregisterZone
|
|
20251
|
+
() => ({ registerZone, unregisterZone }),
|
|
20252
|
+
[registerZone, unregisterZone]
|
|
20253
20253
|
);
|
|
20254
20254
|
const wrapContainer = React75__namespace.default.useCallback(
|
|
20255
20255
|
(children) => {
|
|
20256
20256
|
if (!enabled) return children;
|
|
20257
20257
|
const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
|
|
20258
|
-
const clearOverlay = () => setOverlay(null);
|
|
20259
20258
|
if (!isZone) {
|
|
20260
20259
|
if (!isRoot) return children;
|
|
20261
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
20262
|
-
core$1.DndContext,
|
|
20263
|
-
{
|
|
20264
|
-
sensors,
|
|
20265
|
-
collisionDetection,
|
|
20266
|
-
onDragEnd: (e) => {
|
|
20267
|
-
handleDragEnd(e);
|
|
20268
|
-
clearOverlay();
|
|
20269
|
-
},
|
|
20270
|
-
onDragCancel: clearOverlay,
|
|
20271
|
-
children: [
|
|
20272
|
-
children,
|
|
20273
|
-
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
20274
|
-
]
|
|
20275
|
-
}
|
|
20276
|
-
) });
|
|
20260
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
|
|
20277
20261
|
}
|
|
20278
20262
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
|
|
20279
20263
|
if (isRoot) {
|
|
20280
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
20281
|
-
core$1.DndContext,
|
|
20282
|
-
{
|
|
20283
|
-
sensors,
|
|
20284
|
-
collisionDetection,
|
|
20285
|
-
onDragEnd: (e) => {
|
|
20286
|
-
handleDragEnd(e);
|
|
20287
|
-
clearOverlay();
|
|
20288
|
-
},
|
|
20289
|
-
onDragCancel: clearOverlay,
|
|
20290
|
-
children: [
|
|
20291
|
-
inner,
|
|
20292
|
-
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
20293
|
-
]
|
|
20294
|
-
}
|
|
20295
|
-
) });
|
|
20264
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
|
|
20296
20265
|
}
|
|
20297
20266
|
return inner;
|
|
20298
20267
|
},
|
|
20299
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue
|
|
20268
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
20300
20269
|
);
|
|
20301
20270
|
return {
|
|
20302
20271
|
enabled,
|
|
@@ -20506,7 +20475,7 @@ function DataGrid({
|
|
|
20506
20475
|
const id = itemData.id || String(index);
|
|
20507
20476
|
const isSelected = selectedIds.has(id);
|
|
20508
20477
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
20509
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
20478
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
20510
20479
|
if (hasRenderProp) {
|
|
20511
20480
|
return wrapDnd(
|
|
20512
20481
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -20922,7 +20891,7 @@ function DataList({
|
|
|
20922
20891
|
const idFieldName = dndItemIdField ?? "id";
|
|
20923
20892
|
const renderItem = (itemData, index, isLast) => {
|
|
20924
20893
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
20925
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
20894
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
20926
20895
|
if (hasRenderProp) {
|
|
20927
20896
|
const id2 = itemData.id || String(index);
|
|
20928
20897
|
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,
|
|
38
|
+
import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, 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';
|
|
@@ -20049,12 +20049,17 @@ function useDataDnd(args) {
|
|
|
20049
20049
|
React75__default.useEffect(() => {
|
|
20050
20050
|
setLocalOrder(null);
|
|
20051
20051
|
}, [items]);
|
|
20052
|
+
const itemIdsSignature = orderedItems.map((it, idx) => {
|
|
20053
|
+
const raw = it[dndItemIdField];
|
|
20054
|
+
return String(raw ?? `__idx_${idx}`);
|
|
20055
|
+
}).join("|");
|
|
20052
20056
|
const itemIds = React75__default.useMemo(
|
|
20053
20057
|
() => orderedItems.map((it, idx) => {
|
|
20054
20058
|
const raw = it[dndItemIdField];
|
|
20055
20059
|
return raw ?? `__idx_${idx}`;
|
|
20056
20060
|
}),
|
|
20057
|
-
|
|
20061
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20062
|
+
[itemIdsSignature]
|
|
20058
20063
|
);
|
|
20059
20064
|
const zonesRef = React75__default.useRef(/* @__PURE__ */ new Map());
|
|
20060
20065
|
const registerZone = React75__default.useCallback((zoneId2, meta2) => {
|
|
@@ -20063,10 +20068,6 @@ function useDataDnd(args) {
|
|
|
20063
20068
|
const unregisterZone = React75__default.useCallback((zoneId2) => {
|
|
20064
20069
|
zonesRef.current.delete(zoneId2);
|
|
20065
20070
|
}, []);
|
|
20066
|
-
const [overlayNode, setOverlayNode] = React75__default.useState(null);
|
|
20067
|
-
const setOverlay = React75__default.useCallback((node) => {
|
|
20068
|
-
setOverlayNode(node);
|
|
20069
|
-
}, []);
|
|
20070
20071
|
const zoneId = React75__default.useId();
|
|
20071
20072
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
20072
20073
|
const meta = React75__default.useMemo(
|
|
@@ -20150,7 +20151,7 @@ function useDataDnd(args) {
|
|
|
20150
20151
|
},
|
|
20151
20152
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
20152
20153
|
);
|
|
20153
|
-
const
|
|
20154
|
+
const sortableData = React75__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
20154
20155
|
const SortableItem = React75__default.useCallback(
|
|
20155
20156
|
({ id, children }) => {
|
|
20156
20157
|
const {
|
|
@@ -20160,17 +20161,16 @@ function useDataDnd(args) {
|
|
|
20160
20161
|
transform,
|
|
20161
20162
|
transition,
|
|
20162
20163
|
isDragging
|
|
20163
|
-
} = useSortable({ id, data:
|
|
20164
|
-
React75__default.useEffect(() => {
|
|
20165
|
-
if (!isDragging || !overlaySink) return;
|
|
20166
|
-
overlaySink(children);
|
|
20167
|
-
return () => overlaySink(null);
|
|
20168
|
-
}, [isDragging, children]);
|
|
20164
|
+
} = useSortable({ id, data: sortableData });
|
|
20169
20165
|
const style = {
|
|
20170
20166
|
transform: CSS.Transform.toString(transform),
|
|
20171
20167
|
transition,
|
|
20172
20168
|
opacity: isDragging ? 0.4 : 1,
|
|
20173
|
-
cursor: enabled ? "grab" : void 0
|
|
20169
|
+
cursor: enabled ? "grab" : void 0,
|
|
20170
|
+
// Lift the dragged element above siblings so its visual movement
|
|
20171
|
+
// isn't hidden behind other cards / column boundaries.
|
|
20172
|
+
zIndex: isDragging ? 50 : void 0,
|
|
20173
|
+
position: isDragging ? "relative" : void 0
|
|
20174
20174
|
};
|
|
20175
20175
|
return /* @__PURE__ */ jsx(
|
|
20176
20176
|
Box,
|
|
@@ -20184,12 +20184,12 @@ function useDataDnd(args) {
|
|
|
20184
20184
|
}
|
|
20185
20185
|
);
|
|
20186
20186
|
},
|
|
20187
|
-
[
|
|
20187
|
+
[sortableData, enabled]
|
|
20188
20188
|
);
|
|
20189
20189
|
const DropZoneShell = ({ children }) => {
|
|
20190
20190
|
const { setNodeRef, isOver } = useDroppable({
|
|
20191
20191
|
id: `dnd-zone-${zoneId}`,
|
|
20192
|
-
data:
|
|
20192
|
+
data: sortableData
|
|
20193
20193
|
});
|
|
20194
20194
|
return /* @__PURE__ */ jsx(
|
|
20195
20195
|
Box,
|
|
@@ -20202,55 +20202,24 @@ function useDataDnd(args) {
|
|
|
20202
20202
|
);
|
|
20203
20203
|
};
|
|
20204
20204
|
const rootContextValue = React75__default.useMemo(
|
|
20205
|
-
() => ({ registerZone, unregisterZone
|
|
20206
|
-
[registerZone, unregisterZone
|
|
20205
|
+
() => ({ registerZone, unregisterZone }),
|
|
20206
|
+
[registerZone, unregisterZone]
|
|
20207
20207
|
);
|
|
20208
20208
|
const wrapContainer = React75__default.useCallback(
|
|
20209
20209
|
(children) => {
|
|
20210
20210
|
if (!enabled) return children;
|
|
20211
20211
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
20212
|
-
const clearOverlay = () => setOverlay(null);
|
|
20213
20212
|
if (!isZone) {
|
|
20214
20213
|
if (!isRoot) return children;
|
|
20215
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
20216
|
-
DndContext,
|
|
20217
|
-
{
|
|
20218
|
-
sensors,
|
|
20219
|
-
collisionDetection,
|
|
20220
|
-
onDragEnd: (e) => {
|
|
20221
|
-
handleDragEnd(e);
|
|
20222
|
-
clearOverlay();
|
|
20223
|
-
},
|
|
20224
|
-
onDragCancel: clearOverlay,
|
|
20225
|
-
children: [
|
|
20226
|
-
children,
|
|
20227
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
20228
|
-
]
|
|
20229
|
-
}
|
|
20230
|
-
) });
|
|
20214
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
|
|
20231
20215
|
}
|
|
20232
20216
|
const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
|
|
20233
20217
|
if (isRoot) {
|
|
20234
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
20235
|
-
DndContext,
|
|
20236
|
-
{
|
|
20237
|
-
sensors,
|
|
20238
|
-
collisionDetection,
|
|
20239
|
-
onDragEnd: (e) => {
|
|
20240
|
-
handleDragEnd(e);
|
|
20241
|
-
clearOverlay();
|
|
20242
|
-
},
|
|
20243
|
-
onDragCancel: clearOverlay,
|
|
20244
|
-
children: [
|
|
20245
|
-
inner,
|
|
20246
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
20247
|
-
]
|
|
20248
|
-
}
|
|
20249
|
-
) });
|
|
20218
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
|
|
20250
20219
|
}
|
|
20251
20220
|
return inner;
|
|
20252
20221
|
},
|
|
20253
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue
|
|
20222
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
20254
20223
|
);
|
|
20255
20224
|
return {
|
|
20256
20225
|
enabled,
|
|
@@ -20460,7 +20429,7 @@ function DataGrid({
|
|
|
20460
20429
|
const id = itemData.id || String(index);
|
|
20461
20430
|
const isSelected = selectedIds.has(id);
|
|
20462
20431
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
20463
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
20432
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
20464
20433
|
if (hasRenderProp) {
|
|
20465
20434
|
return wrapDnd(
|
|
20466
20435
|
/* @__PURE__ */ jsx(
|
|
@@ -20876,7 +20845,7 @@ function DataList({
|
|
|
20876
20845
|
const idFieldName = dndItemIdField ?? "id";
|
|
20877
20846
|
const renderItem = (itemData, index, isLast) => {
|
|
20878
20847
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
20879
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
20848
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
20880
20849
|
if (hasRenderProp) {
|
|
20881
20850
|
const id2 = itemData.id || String(index);
|
|
20882
20851
|
return wrapDnd(
|
package/dist/providers/index.cjs
CHANGED
|
@@ -21340,12 +21340,17 @@ function useDataDnd(args) {
|
|
|
21340
21340
|
React81__namespace.default.useEffect(() => {
|
|
21341
21341
|
setLocalOrder(null);
|
|
21342
21342
|
}, [items]);
|
|
21343
|
+
const itemIdsSignature = orderedItems.map((it, idx) => {
|
|
21344
|
+
const raw = it[dndItemIdField];
|
|
21345
|
+
return String(raw ?? `__idx_${idx}`);
|
|
21346
|
+
}).join("|");
|
|
21343
21347
|
const itemIds = React81__namespace.default.useMemo(
|
|
21344
21348
|
() => orderedItems.map((it, idx) => {
|
|
21345
21349
|
const raw = it[dndItemIdField];
|
|
21346
21350
|
return raw ?? `__idx_${idx}`;
|
|
21347
21351
|
}),
|
|
21348
|
-
|
|
21352
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21353
|
+
[itemIdsSignature]
|
|
21349
21354
|
);
|
|
21350
21355
|
const zonesRef = React81__namespace.default.useRef(/* @__PURE__ */ new Map());
|
|
21351
21356
|
const registerZone = React81__namespace.default.useCallback((zoneId2, meta2) => {
|
|
@@ -21354,10 +21359,6 @@ function useDataDnd(args) {
|
|
|
21354
21359
|
const unregisterZone = React81__namespace.default.useCallback((zoneId2) => {
|
|
21355
21360
|
zonesRef.current.delete(zoneId2);
|
|
21356
21361
|
}, []);
|
|
21357
|
-
const [overlayNode, setOverlayNode] = React81__namespace.default.useState(null);
|
|
21358
|
-
const setOverlay = React81__namespace.default.useCallback((node) => {
|
|
21359
|
-
setOverlayNode(node);
|
|
21360
|
-
}, []);
|
|
21361
21362
|
const zoneId = React81__namespace.default.useId();
|
|
21362
21363
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21363
21364
|
const meta = React81__namespace.default.useMemo(
|
|
@@ -21441,7 +21442,7 @@ function useDataDnd(args) {
|
|
|
21441
21442
|
},
|
|
21442
21443
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
21443
21444
|
);
|
|
21444
|
-
const
|
|
21445
|
+
const sortableData = React81__namespace.default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
21445
21446
|
const SortableItem = React81__namespace.default.useCallback(
|
|
21446
21447
|
({ id, children }) => {
|
|
21447
21448
|
const {
|
|
@@ -21451,17 +21452,16 @@ function useDataDnd(args) {
|
|
|
21451
21452
|
transform,
|
|
21452
21453
|
transition,
|
|
21453
21454
|
isDragging
|
|
21454
|
-
} = sortable.useSortable({ id, data:
|
|
21455
|
-
React81__namespace.default.useEffect(() => {
|
|
21456
|
-
if (!isDragging || !overlaySink) return;
|
|
21457
|
-
overlaySink(children);
|
|
21458
|
-
return () => overlaySink(null);
|
|
21459
|
-
}, [isDragging, children]);
|
|
21455
|
+
} = sortable.useSortable({ id, data: sortableData });
|
|
21460
21456
|
const style = {
|
|
21461
21457
|
transform: utilities.CSS.Transform.toString(transform),
|
|
21462
21458
|
transition,
|
|
21463
21459
|
opacity: isDragging ? 0.4 : 1,
|
|
21464
|
-
cursor: enabled ? "grab" : void 0
|
|
21460
|
+
cursor: enabled ? "grab" : void 0,
|
|
21461
|
+
// Lift the dragged element above siblings so its visual movement
|
|
21462
|
+
// isn't hidden behind other cards / column boundaries.
|
|
21463
|
+
zIndex: isDragging ? 50 : void 0,
|
|
21464
|
+
position: isDragging ? "relative" : void 0
|
|
21465
21465
|
};
|
|
21466
21466
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21467
21467
|
Box,
|
|
@@ -21475,12 +21475,12 @@ function useDataDnd(args) {
|
|
|
21475
21475
|
}
|
|
21476
21476
|
);
|
|
21477
21477
|
},
|
|
21478
|
-
[
|
|
21478
|
+
[sortableData, enabled]
|
|
21479
21479
|
);
|
|
21480
21480
|
const DropZoneShell = ({ children }) => {
|
|
21481
21481
|
const { setNodeRef, isOver } = core$1.useDroppable({
|
|
21482
21482
|
id: `dnd-zone-${zoneId}`,
|
|
21483
|
-
data:
|
|
21483
|
+
data: sortableData
|
|
21484
21484
|
});
|
|
21485
21485
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21486
21486
|
Box,
|
|
@@ -21493,55 +21493,24 @@ function useDataDnd(args) {
|
|
|
21493
21493
|
);
|
|
21494
21494
|
};
|
|
21495
21495
|
const rootContextValue = React81__namespace.default.useMemo(
|
|
21496
|
-
() => ({ registerZone, unregisterZone
|
|
21497
|
-
[registerZone, unregisterZone
|
|
21496
|
+
() => ({ registerZone, unregisterZone }),
|
|
21497
|
+
[registerZone, unregisterZone]
|
|
21498
21498
|
);
|
|
21499
21499
|
const wrapContainer = React81__namespace.default.useCallback(
|
|
21500
21500
|
(children) => {
|
|
21501
21501
|
if (!enabled) return children;
|
|
21502
21502
|
const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
|
|
21503
|
-
const clearOverlay = () => setOverlay(null);
|
|
21504
21503
|
if (!isZone) {
|
|
21505
21504
|
if (!isRoot) return children;
|
|
21506
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
21507
|
-
core$1.DndContext,
|
|
21508
|
-
{
|
|
21509
|
-
sensors,
|
|
21510
|
-
collisionDetection,
|
|
21511
|
-
onDragEnd: (e) => {
|
|
21512
|
-
handleDragEnd(e);
|
|
21513
|
-
clearOverlay();
|
|
21514
|
-
},
|
|
21515
|
-
onDragCancel: clearOverlay,
|
|
21516
|
-
children: [
|
|
21517
|
-
children,
|
|
21518
|
-
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
21519
|
-
]
|
|
21520
|
-
}
|
|
21521
|
-
) });
|
|
21505
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
|
|
21522
21506
|
}
|
|
21523
21507
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
|
|
21524
21508
|
if (isRoot) {
|
|
21525
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
21526
|
-
core$1.DndContext,
|
|
21527
|
-
{
|
|
21528
|
-
sensors,
|
|
21529
|
-
collisionDetection,
|
|
21530
|
-
onDragEnd: (e) => {
|
|
21531
|
-
handleDragEnd(e);
|
|
21532
|
-
clearOverlay();
|
|
21533
|
-
},
|
|
21534
|
-
onDragCancel: clearOverlay,
|
|
21535
|
-
children: [
|
|
21536
|
-
inner,
|
|
21537
|
-
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
21538
|
-
]
|
|
21539
|
-
}
|
|
21540
|
-
) });
|
|
21509
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
|
|
21541
21510
|
}
|
|
21542
21511
|
return inner;
|
|
21543
21512
|
},
|
|
21544
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue
|
|
21513
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
21545
21514
|
);
|
|
21546
21515
|
return {
|
|
21547
21516
|
enabled,
|
|
@@ -21751,7 +21720,7 @@ function DataGrid({
|
|
|
21751
21720
|
const id = itemData.id || String(index);
|
|
21752
21721
|
const isSelected = selectedIds.has(id);
|
|
21753
21722
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
21754
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
21723
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
21755
21724
|
if (hasRenderProp) {
|
|
21756
21725
|
return wrapDnd(
|
|
21757
21726
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -22167,7 +22136,7 @@ function DataList({
|
|
|
22167
22136
|
const idFieldName = dndItemIdField ?? "id";
|
|
22168
22137
|
const renderItem = (itemData, index, isLast) => {
|
|
22169
22138
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
22170
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
22139
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
22171
22140
|
if (hasRenderProp) {
|
|
22172
22141
|
const id2 = itemData.id || String(index);
|
|
22173
22142
|
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,
|
|
39
|
+
import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, 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';
|
|
@@ -21294,12 +21294,17 @@ function useDataDnd(args) {
|
|
|
21294
21294
|
React81__default.useEffect(() => {
|
|
21295
21295
|
setLocalOrder(null);
|
|
21296
21296
|
}, [items]);
|
|
21297
|
+
const itemIdsSignature = orderedItems.map((it, idx) => {
|
|
21298
|
+
const raw = it[dndItemIdField];
|
|
21299
|
+
return String(raw ?? `__idx_${idx}`);
|
|
21300
|
+
}).join("|");
|
|
21297
21301
|
const itemIds = React81__default.useMemo(
|
|
21298
21302
|
() => orderedItems.map((it, idx) => {
|
|
21299
21303
|
const raw = it[dndItemIdField];
|
|
21300
21304
|
return raw ?? `__idx_${idx}`;
|
|
21301
21305
|
}),
|
|
21302
|
-
|
|
21306
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21307
|
+
[itemIdsSignature]
|
|
21303
21308
|
);
|
|
21304
21309
|
const zonesRef = React81__default.useRef(/* @__PURE__ */ new Map());
|
|
21305
21310
|
const registerZone = React81__default.useCallback((zoneId2, meta2) => {
|
|
@@ -21308,10 +21313,6 @@ function useDataDnd(args) {
|
|
|
21308
21313
|
const unregisterZone = React81__default.useCallback((zoneId2) => {
|
|
21309
21314
|
zonesRef.current.delete(zoneId2);
|
|
21310
21315
|
}, []);
|
|
21311
|
-
const [overlayNode, setOverlayNode] = React81__default.useState(null);
|
|
21312
|
-
const setOverlay = React81__default.useCallback((node) => {
|
|
21313
|
-
setOverlayNode(node);
|
|
21314
|
-
}, []);
|
|
21315
21316
|
const zoneId = React81__default.useId();
|
|
21316
21317
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21317
21318
|
const meta = React81__default.useMemo(
|
|
@@ -21395,7 +21396,7 @@ function useDataDnd(args) {
|
|
|
21395
21396
|
},
|
|
21396
21397
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
21397
21398
|
);
|
|
21398
|
-
const
|
|
21399
|
+
const sortableData = React81__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
21399
21400
|
const SortableItem = React81__default.useCallback(
|
|
21400
21401
|
({ id, children }) => {
|
|
21401
21402
|
const {
|
|
@@ -21405,17 +21406,16 @@ function useDataDnd(args) {
|
|
|
21405
21406
|
transform,
|
|
21406
21407
|
transition,
|
|
21407
21408
|
isDragging
|
|
21408
|
-
} = useSortable({ id, data:
|
|
21409
|
-
React81__default.useEffect(() => {
|
|
21410
|
-
if (!isDragging || !overlaySink) return;
|
|
21411
|
-
overlaySink(children);
|
|
21412
|
-
return () => overlaySink(null);
|
|
21413
|
-
}, [isDragging, children]);
|
|
21409
|
+
} = useSortable({ id, data: sortableData });
|
|
21414
21410
|
const style = {
|
|
21415
21411
|
transform: CSS.Transform.toString(transform),
|
|
21416
21412
|
transition,
|
|
21417
21413
|
opacity: isDragging ? 0.4 : 1,
|
|
21418
|
-
cursor: enabled ? "grab" : void 0
|
|
21414
|
+
cursor: enabled ? "grab" : void 0,
|
|
21415
|
+
// Lift the dragged element above siblings so its visual movement
|
|
21416
|
+
// isn't hidden behind other cards / column boundaries.
|
|
21417
|
+
zIndex: isDragging ? 50 : void 0,
|
|
21418
|
+
position: isDragging ? "relative" : void 0
|
|
21419
21419
|
};
|
|
21420
21420
|
return /* @__PURE__ */ jsx(
|
|
21421
21421
|
Box,
|
|
@@ -21429,12 +21429,12 @@ function useDataDnd(args) {
|
|
|
21429
21429
|
}
|
|
21430
21430
|
);
|
|
21431
21431
|
},
|
|
21432
|
-
[
|
|
21432
|
+
[sortableData, enabled]
|
|
21433
21433
|
);
|
|
21434
21434
|
const DropZoneShell = ({ children }) => {
|
|
21435
21435
|
const { setNodeRef, isOver } = useDroppable({
|
|
21436
21436
|
id: `dnd-zone-${zoneId}`,
|
|
21437
|
-
data:
|
|
21437
|
+
data: sortableData
|
|
21438
21438
|
});
|
|
21439
21439
|
return /* @__PURE__ */ jsx(
|
|
21440
21440
|
Box,
|
|
@@ -21447,55 +21447,24 @@ function useDataDnd(args) {
|
|
|
21447
21447
|
);
|
|
21448
21448
|
};
|
|
21449
21449
|
const rootContextValue = React81__default.useMemo(
|
|
21450
|
-
() => ({ registerZone, unregisterZone
|
|
21451
|
-
[registerZone, unregisterZone
|
|
21450
|
+
() => ({ registerZone, unregisterZone }),
|
|
21451
|
+
[registerZone, unregisterZone]
|
|
21452
21452
|
);
|
|
21453
21453
|
const wrapContainer = React81__default.useCallback(
|
|
21454
21454
|
(children) => {
|
|
21455
21455
|
if (!enabled) return children;
|
|
21456
21456
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
21457
|
-
const clearOverlay = () => setOverlay(null);
|
|
21458
21457
|
if (!isZone) {
|
|
21459
21458
|
if (!isRoot) return children;
|
|
21460
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
21461
|
-
DndContext,
|
|
21462
|
-
{
|
|
21463
|
-
sensors,
|
|
21464
|
-
collisionDetection,
|
|
21465
|
-
onDragEnd: (e) => {
|
|
21466
|
-
handleDragEnd(e);
|
|
21467
|
-
clearOverlay();
|
|
21468
|
-
},
|
|
21469
|
-
onDragCancel: clearOverlay,
|
|
21470
|
-
children: [
|
|
21471
|
-
children,
|
|
21472
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
21473
|
-
]
|
|
21474
|
-
}
|
|
21475
|
-
) });
|
|
21459
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
|
|
21476
21460
|
}
|
|
21477
21461
|
const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
|
|
21478
21462
|
if (isRoot) {
|
|
21479
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
21480
|
-
DndContext,
|
|
21481
|
-
{
|
|
21482
|
-
sensors,
|
|
21483
|
-
collisionDetection,
|
|
21484
|
-
onDragEnd: (e) => {
|
|
21485
|
-
handleDragEnd(e);
|
|
21486
|
-
clearOverlay();
|
|
21487
|
-
},
|
|
21488
|
-
onDragCancel: clearOverlay,
|
|
21489
|
-
children: [
|
|
21490
|
-
inner,
|
|
21491
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
21492
|
-
]
|
|
21493
|
-
}
|
|
21494
|
-
) });
|
|
21463
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
|
|
21495
21464
|
}
|
|
21496
21465
|
return inner;
|
|
21497
21466
|
},
|
|
21498
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue
|
|
21467
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
21499
21468
|
);
|
|
21500
21469
|
return {
|
|
21501
21470
|
enabled,
|
|
@@ -21705,7 +21674,7 @@ function DataGrid({
|
|
|
21705
21674
|
const id = itemData.id || String(index);
|
|
21706
21675
|
const isSelected = selectedIds.has(id);
|
|
21707
21676
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
21708
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
21677
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
21709
21678
|
if (hasRenderProp) {
|
|
21710
21679
|
return wrapDnd(
|
|
21711
21680
|
/* @__PURE__ */ jsx(
|
|
@@ -22121,7 +22090,7 @@ function DataList({
|
|
|
22121
22090
|
const idFieldName = dndItemIdField ?? "id";
|
|
22122
22091
|
const renderItem = (itemData, index, isLast) => {
|
|
22123
22092
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
22124
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
22093
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
22125
22094
|
if (hasRenderProp) {
|
|
22126
22095
|
const id2 = itemData.id || String(index);
|
|
22127
22096
|
return wrapDnd(
|
package/dist/runtime/index.cjs
CHANGED
|
@@ -21109,12 +21109,17 @@ function useDataDnd(args) {
|
|
|
21109
21109
|
React80__namespace.default.useEffect(() => {
|
|
21110
21110
|
setLocalOrder(null);
|
|
21111
21111
|
}, [items]);
|
|
21112
|
+
const itemIdsSignature = orderedItems.map((it, idx) => {
|
|
21113
|
+
const raw = it[dndItemIdField];
|
|
21114
|
+
return String(raw ?? `__idx_${idx}`);
|
|
21115
|
+
}).join("|");
|
|
21112
21116
|
const itemIds = React80__namespace.default.useMemo(
|
|
21113
21117
|
() => orderedItems.map((it, idx) => {
|
|
21114
21118
|
const raw = it[dndItemIdField];
|
|
21115
21119
|
return raw ?? `__idx_${idx}`;
|
|
21116
21120
|
}),
|
|
21117
|
-
|
|
21121
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21122
|
+
[itemIdsSignature]
|
|
21118
21123
|
);
|
|
21119
21124
|
const zonesRef = React80__namespace.default.useRef(/* @__PURE__ */ new Map());
|
|
21120
21125
|
const registerZone = React80__namespace.default.useCallback((zoneId2, meta2) => {
|
|
@@ -21123,10 +21128,6 @@ function useDataDnd(args) {
|
|
|
21123
21128
|
const unregisterZone = React80__namespace.default.useCallback((zoneId2) => {
|
|
21124
21129
|
zonesRef.current.delete(zoneId2);
|
|
21125
21130
|
}, []);
|
|
21126
|
-
const [overlayNode, setOverlayNode] = React80__namespace.default.useState(null);
|
|
21127
|
-
const setOverlay = React80__namespace.default.useCallback((node) => {
|
|
21128
|
-
setOverlayNode(node);
|
|
21129
|
-
}, []);
|
|
21130
21131
|
const zoneId = React80__namespace.default.useId();
|
|
21131
21132
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21132
21133
|
const meta = React80__namespace.default.useMemo(
|
|
@@ -21210,7 +21211,7 @@ function useDataDnd(args) {
|
|
|
21210
21211
|
},
|
|
21211
21212
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
21212
21213
|
);
|
|
21213
|
-
const
|
|
21214
|
+
const sortableData = React80__namespace.default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
21214
21215
|
const SortableItem = React80__namespace.default.useCallback(
|
|
21215
21216
|
({ id, children }) => {
|
|
21216
21217
|
const {
|
|
@@ -21220,17 +21221,16 @@ function useDataDnd(args) {
|
|
|
21220
21221
|
transform,
|
|
21221
21222
|
transition,
|
|
21222
21223
|
isDragging
|
|
21223
|
-
} = sortable.useSortable({ id, data:
|
|
21224
|
-
React80__namespace.default.useEffect(() => {
|
|
21225
|
-
if (!isDragging || !overlaySink) return;
|
|
21226
|
-
overlaySink(children);
|
|
21227
|
-
return () => overlaySink(null);
|
|
21228
|
-
}, [isDragging, children]);
|
|
21224
|
+
} = sortable.useSortable({ id, data: sortableData });
|
|
21229
21225
|
const style = {
|
|
21230
21226
|
transform: utilities.CSS.Transform.toString(transform),
|
|
21231
21227
|
transition,
|
|
21232
21228
|
opacity: isDragging ? 0.4 : 1,
|
|
21233
|
-
cursor: enabled ? "grab" : void 0
|
|
21229
|
+
cursor: enabled ? "grab" : void 0,
|
|
21230
|
+
// Lift the dragged element above siblings so its visual movement
|
|
21231
|
+
// isn't hidden behind other cards / column boundaries.
|
|
21232
|
+
zIndex: isDragging ? 50 : void 0,
|
|
21233
|
+
position: isDragging ? "relative" : void 0
|
|
21234
21234
|
};
|
|
21235
21235
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21236
21236
|
Box,
|
|
@@ -21244,12 +21244,12 @@ function useDataDnd(args) {
|
|
|
21244
21244
|
}
|
|
21245
21245
|
);
|
|
21246
21246
|
},
|
|
21247
|
-
[
|
|
21247
|
+
[sortableData, enabled]
|
|
21248
21248
|
);
|
|
21249
21249
|
const DropZoneShell = ({ children }) => {
|
|
21250
21250
|
const { setNodeRef, isOver } = core$1.useDroppable({
|
|
21251
21251
|
id: `dnd-zone-${zoneId}`,
|
|
21252
|
-
data:
|
|
21252
|
+
data: sortableData
|
|
21253
21253
|
});
|
|
21254
21254
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21255
21255
|
Box,
|
|
@@ -21262,55 +21262,24 @@ function useDataDnd(args) {
|
|
|
21262
21262
|
);
|
|
21263
21263
|
};
|
|
21264
21264
|
const rootContextValue = React80__namespace.default.useMemo(
|
|
21265
|
-
() => ({ registerZone, unregisterZone
|
|
21266
|
-
[registerZone, unregisterZone
|
|
21265
|
+
() => ({ registerZone, unregisterZone }),
|
|
21266
|
+
[registerZone, unregisterZone]
|
|
21267
21267
|
);
|
|
21268
21268
|
const wrapContainer = React80__namespace.default.useCallback(
|
|
21269
21269
|
(children) => {
|
|
21270
21270
|
if (!enabled) return children;
|
|
21271
21271
|
const strategy = layout === "grid" ? sortable.rectSortingStrategy : sortable.verticalListSortingStrategy;
|
|
21272
|
-
const clearOverlay = () => setOverlay(null);
|
|
21273
21272
|
if (!isZone) {
|
|
21274
21273
|
if (!isRoot) return children;
|
|
21275
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
21276
|
-
core$1.DndContext,
|
|
21277
|
-
{
|
|
21278
|
-
sensors,
|
|
21279
|
-
collisionDetection,
|
|
21280
|
-
onDragEnd: (e) => {
|
|
21281
|
-
handleDragEnd(e);
|
|
21282
|
-
clearOverlay();
|
|
21283
|
-
},
|
|
21284
|
-
onDragCancel: clearOverlay,
|
|
21285
|
-
children: [
|
|
21286
|
-
children,
|
|
21287
|
-
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
21288
|
-
]
|
|
21289
|
-
}
|
|
21290
|
-
) });
|
|
21274
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
|
|
21291
21275
|
}
|
|
21292
21276
|
const inner = /* @__PURE__ */ jsxRuntime.jsx(DropZoneShell, { children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: itemIds, strategy, children }) });
|
|
21293
21277
|
if (isRoot) {
|
|
21294
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.
|
|
21295
|
-
core$1.DndContext,
|
|
21296
|
-
{
|
|
21297
|
-
sensors,
|
|
21298
|
-
collisionDetection,
|
|
21299
|
-
onDragEnd: (e) => {
|
|
21300
|
-
handleDragEnd(e);
|
|
21301
|
-
clearOverlay();
|
|
21302
|
-
},
|
|
21303
|
-
onDragCancel: clearOverlay,
|
|
21304
|
-
children: [
|
|
21305
|
-
inner,
|
|
21306
|
-
/* @__PURE__ */ jsxRuntime.jsx(core$1.DragOverlay, { children: overlayNode })
|
|
21307
|
-
]
|
|
21308
|
-
}
|
|
21309
|
-
) });
|
|
21278
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(core$1.DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
|
|
21310
21279
|
}
|
|
21311
21280
|
return inner;
|
|
21312
21281
|
},
|
|
21313
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue
|
|
21282
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
21314
21283
|
);
|
|
21315
21284
|
return {
|
|
21316
21285
|
enabled,
|
|
@@ -21520,7 +21489,7 @@ function DataGrid({
|
|
|
21520
21489
|
const id = itemData.id || String(index);
|
|
21521
21490
|
const isSelected = selectedIds.has(id);
|
|
21522
21491
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
21523
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
21492
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
21524
21493
|
if (hasRenderProp) {
|
|
21525
21494
|
return wrapDnd(
|
|
21526
21495
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -21936,7 +21905,7 @@ function DataList({
|
|
|
21936
21905
|
const idFieldName = dndItemIdField ?? "id";
|
|
21937
21906
|
const renderItem = (itemData, index, isLast) => {
|
|
21938
21907
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
21939
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
21908
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsxRuntime.jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
21940
21909
|
if (hasRenderProp) {
|
|
21941
21910
|
const id2 = itemData.id || String(index);
|
|
21942
21911
|
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,
|
|
39
|
+
import { useSensors, useSensor, PointerSensor, KeyboardSensor, pointerWithin, rectIntersection, closestCorners, DndContext, 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';
|
|
@@ -21063,12 +21063,17 @@ function useDataDnd(args) {
|
|
|
21063
21063
|
React80__default.useEffect(() => {
|
|
21064
21064
|
setLocalOrder(null);
|
|
21065
21065
|
}, [items]);
|
|
21066
|
+
const itemIdsSignature = orderedItems.map((it, idx) => {
|
|
21067
|
+
const raw = it[dndItemIdField];
|
|
21068
|
+
return String(raw ?? `__idx_${idx}`);
|
|
21069
|
+
}).join("|");
|
|
21066
21070
|
const itemIds = React80__default.useMemo(
|
|
21067
21071
|
() => orderedItems.map((it, idx) => {
|
|
21068
21072
|
const raw = it[dndItemIdField];
|
|
21069
21073
|
return raw ?? `__idx_${idx}`;
|
|
21070
21074
|
}),
|
|
21071
|
-
|
|
21075
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21076
|
+
[itemIdsSignature]
|
|
21072
21077
|
);
|
|
21073
21078
|
const zonesRef = React80__default.useRef(/* @__PURE__ */ new Map());
|
|
21074
21079
|
const registerZone = React80__default.useCallback((zoneId2, meta2) => {
|
|
@@ -21077,10 +21082,6 @@ function useDataDnd(args) {
|
|
|
21077
21082
|
const unregisterZone = React80__default.useCallback((zoneId2) => {
|
|
21078
21083
|
zonesRef.current.delete(zoneId2);
|
|
21079
21084
|
}, []);
|
|
21080
|
-
const [overlayNode, setOverlayNode] = React80__default.useState(null);
|
|
21081
|
-
const setOverlay = React80__default.useCallback((node) => {
|
|
21082
|
-
setOverlayNode(node);
|
|
21083
|
-
}, []);
|
|
21084
21085
|
const zoneId = React80__default.useId();
|
|
21085
21086
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
21086
21087
|
const meta = React80__default.useMemo(
|
|
@@ -21164,7 +21165,7 @@ function useDataDnd(args) {
|
|
|
21164
21165
|
},
|
|
21165
21166
|
[orderedItems, ownGroup, findZoneByItem, findZoneByGroup, eventBus]
|
|
21166
21167
|
);
|
|
21167
|
-
const
|
|
21168
|
+
const sortableData = React80__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
21168
21169
|
const SortableItem = React80__default.useCallback(
|
|
21169
21170
|
({ id, children }) => {
|
|
21170
21171
|
const {
|
|
@@ -21174,17 +21175,16 @@ function useDataDnd(args) {
|
|
|
21174
21175
|
transform,
|
|
21175
21176
|
transition,
|
|
21176
21177
|
isDragging
|
|
21177
|
-
} = useSortable({ id, data:
|
|
21178
|
-
React80__default.useEffect(() => {
|
|
21179
|
-
if (!isDragging || !overlaySink) return;
|
|
21180
|
-
overlaySink(children);
|
|
21181
|
-
return () => overlaySink(null);
|
|
21182
|
-
}, [isDragging, children]);
|
|
21178
|
+
} = useSortable({ id, data: sortableData });
|
|
21183
21179
|
const style = {
|
|
21184
21180
|
transform: CSS.Transform.toString(transform),
|
|
21185
21181
|
transition,
|
|
21186
21182
|
opacity: isDragging ? 0.4 : 1,
|
|
21187
|
-
cursor: enabled ? "grab" : void 0
|
|
21183
|
+
cursor: enabled ? "grab" : void 0,
|
|
21184
|
+
// Lift the dragged element above siblings so its visual movement
|
|
21185
|
+
// isn't hidden behind other cards / column boundaries.
|
|
21186
|
+
zIndex: isDragging ? 50 : void 0,
|
|
21187
|
+
position: isDragging ? "relative" : void 0
|
|
21188
21188
|
};
|
|
21189
21189
|
return /* @__PURE__ */ jsx(
|
|
21190
21190
|
Box,
|
|
@@ -21198,12 +21198,12 @@ function useDataDnd(args) {
|
|
|
21198
21198
|
}
|
|
21199
21199
|
);
|
|
21200
21200
|
},
|
|
21201
|
-
[
|
|
21201
|
+
[sortableData, enabled]
|
|
21202
21202
|
);
|
|
21203
21203
|
const DropZoneShell = ({ children }) => {
|
|
21204
21204
|
const { setNodeRef, isOver } = useDroppable({
|
|
21205
21205
|
id: `dnd-zone-${zoneId}`,
|
|
21206
|
-
data:
|
|
21206
|
+
data: sortableData
|
|
21207
21207
|
});
|
|
21208
21208
|
return /* @__PURE__ */ jsx(
|
|
21209
21209
|
Box,
|
|
@@ -21216,55 +21216,24 @@ function useDataDnd(args) {
|
|
|
21216
21216
|
);
|
|
21217
21217
|
};
|
|
21218
21218
|
const rootContextValue = React80__default.useMemo(
|
|
21219
|
-
() => ({ registerZone, unregisterZone
|
|
21220
|
-
[registerZone, unregisterZone
|
|
21219
|
+
() => ({ registerZone, unregisterZone }),
|
|
21220
|
+
[registerZone, unregisterZone]
|
|
21221
21221
|
);
|
|
21222
21222
|
const wrapContainer = React80__default.useCallback(
|
|
21223
21223
|
(children) => {
|
|
21224
21224
|
if (!enabled) return children;
|
|
21225
21225
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
21226
|
-
const clearOverlay = () => setOverlay(null);
|
|
21227
21226
|
if (!isZone) {
|
|
21228
21227
|
if (!isRoot) return children;
|
|
21229
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
21230
|
-
DndContext,
|
|
21231
|
-
{
|
|
21232
|
-
sensors,
|
|
21233
|
-
collisionDetection,
|
|
21234
|
-
onDragEnd: (e) => {
|
|
21235
|
-
handleDragEnd(e);
|
|
21236
|
-
clearOverlay();
|
|
21237
|
-
},
|
|
21238
|
-
onDragCancel: clearOverlay,
|
|
21239
|
-
children: [
|
|
21240
|
-
children,
|
|
21241
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
21242
|
-
]
|
|
21243
|
-
}
|
|
21244
|
-
) });
|
|
21228
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children }) });
|
|
21245
21229
|
}
|
|
21246
21230
|
const inner = /* @__PURE__ */ jsx(DropZoneShell, { children: /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy, children }) });
|
|
21247
21231
|
if (isRoot) {
|
|
21248
|
-
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */
|
|
21249
|
-
DndContext,
|
|
21250
|
-
{
|
|
21251
|
-
sensors,
|
|
21252
|
-
collisionDetection,
|
|
21253
|
-
onDragEnd: (e) => {
|
|
21254
|
-
handleDragEnd(e);
|
|
21255
|
-
clearOverlay();
|
|
21256
|
-
},
|
|
21257
|
-
onDragCancel: clearOverlay,
|
|
21258
|
-
children: [
|
|
21259
|
-
inner,
|
|
21260
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: overlayNode })
|
|
21261
|
-
]
|
|
21262
|
-
}
|
|
21263
|
-
) });
|
|
21232
|
+
return /* @__PURE__ */ jsx(RootCtx.Provider, { value: rootContextValue, children: /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection, onDragEnd: handleDragEnd, children: inner }) });
|
|
21264
21233
|
}
|
|
21265
21234
|
return inner;
|
|
21266
21235
|
},
|
|
21267
|
-
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue
|
|
21236
|
+
[enabled, isZone, layout, sensors, collisionDetection, handleDragEnd, itemIds, isRoot, rootContextValue]
|
|
21268
21237
|
);
|
|
21269
21238
|
return {
|
|
21270
21239
|
enabled,
|
|
@@ -21474,7 +21443,7 @@ function DataGrid({
|
|
|
21474
21443
|
const id = itemData.id || String(index);
|
|
21475
21444
|
const isSelected = selectedIds.has(id);
|
|
21476
21445
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
21477
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
21446
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
21478
21447
|
if (hasRenderProp) {
|
|
21479
21448
|
return wrapDnd(
|
|
21480
21449
|
/* @__PURE__ */ jsx(
|
|
@@ -21890,7 +21859,7 @@ function DataList({
|
|
|
21890
21859
|
const idFieldName = dndItemIdField ?? "id";
|
|
21891
21860
|
const renderItem = (itemData, index, isLast) => {
|
|
21892
21861
|
const dndId = itemData[idFieldName] ?? `__idx_${index}`;
|
|
21893
|
-
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }) : node;
|
|
21862
|
+
const wrapDnd = (node) => dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: dndId, children: node }, dndId) : node;
|
|
21894
21863
|
if (hasRenderProp) {
|
|
21895
21864
|
const id2 = itemData.id || String(index);
|
|
21896
21865
|
return wrapDnd(
|