@inf-monkeys-tech/monkeys-design 0.4.45 → 0.4.47
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/components/data-explorer/index.d.mts +3 -3
- package/dist/components/data-explorer/index.d.ts +3 -3
- package/dist/components/data-explorer/index.js +62 -1
- package/dist/components/data-explorer/index.js.map +1 -1
- package/dist/components/data-explorer/index.mjs +62 -1
- package/dist/components/data-explorer/index.mjs.map +1 -1
- package/dist/components/layout/index.d.mts +125 -3
- package/dist/components/layout/index.d.ts +125 -3
- package/dist/components/layout/index.js +3925 -12
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/index.mjs +3924 -13
- package/dist/components/layout/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1042 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1040 -70
- package/dist/index.mjs.map +1 -1
- package/dist/{theme-6n0A9kRO.d.ts → theme-BuvXrHFY.d.ts} +1 -1
- package/dist/{theme-BsEbXR7C.d.mts → theme-CUATVszl.d.mts} +1 -1
- package/dist/theme-system/index.d.mts +1 -1
- package/dist/theme-system/index.d.ts +1 -1
- package/dist/{types-BFHv0G27.d.mts → types-DikLSLsl.d.mts} +4 -0
- package/dist/{types-BFHv0G27.d.ts → types-DikLSLsl.d.ts} +4 -0
- package/package.json +1 -1
|
@@ -1778,6 +1778,52 @@ function buildFlattenedTree(nodes, expandedNodeIds) {
|
|
|
1778
1778
|
flattenTree(nodes, expandedNodeIds, void 0, 0, entries);
|
|
1779
1779
|
return entries;
|
|
1780
1780
|
}
|
|
1781
|
+
function findAncestorEntryAtDepth(entries, entry, depth) {
|
|
1782
|
+
if (depth < 0) return void 0;
|
|
1783
|
+
let parentId = entry.parentId;
|
|
1784
|
+
while (parentId) {
|
|
1785
|
+
const parentEntry = entries.find((candidate) => candidate.node.id === parentId);
|
|
1786
|
+
if (!parentEntry) return void 0;
|
|
1787
|
+
if (parentEntry.depth === depth) return parentEntry;
|
|
1788
|
+
parentId = parentEntry.parentId;
|
|
1789
|
+
}
|
|
1790
|
+
return void 0;
|
|
1791
|
+
}
|
|
1792
|
+
function countSiblingsBeforeDrop(entries, activeEntry, overEntry, parentId, targetDepth) {
|
|
1793
|
+
const targetEntry = activeEntry.node.id === overEntry.node.id ? activeEntry : overEntry;
|
|
1794
|
+
let index = 0;
|
|
1795
|
+
for (const entry of entries) {
|
|
1796
|
+
if (entry.node.id === targetEntry.node.id) break;
|
|
1797
|
+
if (entry.node.id === activeEntry.node.id) continue;
|
|
1798
|
+
if (entry.parentId === parentId && entry.depth === targetDepth) {
|
|
1799
|
+
index += 1;
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
return index;
|
|
1803
|
+
}
|
|
1804
|
+
function projectDataExplorerDraggableTreeDrop({
|
|
1805
|
+
flattenedNodes,
|
|
1806
|
+
activeEntry,
|
|
1807
|
+
overEntry,
|
|
1808
|
+
dragOffsetX,
|
|
1809
|
+
indentSize
|
|
1810
|
+
}) {
|
|
1811
|
+
const depthDelta = Math.round(dragOffsetX / Math.max(1, indentSize));
|
|
1812
|
+
const projectedDepth = Math.max(0, activeEntry.depth + depthDelta);
|
|
1813
|
+
const targetDepth = Math.min(projectedDepth, overEntry.depth);
|
|
1814
|
+
const parentAtDepth = targetDepth === 0 ? void 0 : targetDepth === overEntry.depth ? overEntry.parentId : findAncestorEntryAtDepth(flattenedNodes, overEntry, targetDepth)?.parentId;
|
|
1815
|
+
return {
|
|
1816
|
+
parentId: parentAtDepth,
|
|
1817
|
+
index: countSiblingsBeforeDrop(
|
|
1818
|
+
flattenedNodes,
|
|
1819
|
+
activeEntry,
|
|
1820
|
+
overEntry,
|
|
1821
|
+
parentAtDepth,
|
|
1822
|
+
targetDepth
|
|
1823
|
+
),
|
|
1824
|
+
depth: targetDepth
|
|
1825
|
+
};
|
|
1826
|
+
}
|
|
1781
1827
|
function DraggableTreeItem({
|
|
1782
1828
|
entry,
|
|
1783
1829
|
selected,
|
|
@@ -2153,7 +2199,7 @@ function DataExplorerDraggableTree({
|
|
|
2153
2199
|
const handleDragEnd = (event) => {
|
|
2154
2200
|
const activeId = String(event.active.id || "");
|
|
2155
2201
|
const overId = event.over ? String(event.over.id || "") : "";
|
|
2156
|
-
if (!activeId || !overId ||
|
|
2202
|
+
if (!activeId || !overId || !onDragEnd) {
|
|
2157
2203
|
clearDragState();
|
|
2158
2204
|
return;
|
|
2159
2205
|
}
|
|
@@ -2163,14 +2209,29 @@ function DataExplorerDraggableTree({
|
|
|
2163
2209
|
clearDragState();
|
|
2164
2210
|
return;
|
|
2165
2211
|
}
|
|
2212
|
+
const projectedDrop = projectDataExplorerDraggableTreeDrop({
|
|
2213
|
+
flattenedNodes,
|
|
2214
|
+
activeEntry: activeEntry2,
|
|
2215
|
+
overEntry,
|
|
2216
|
+
dragOffsetX: event.delta.x,
|
|
2217
|
+
indentSize
|
|
2218
|
+
});
|
|
2219
|
+
if (activeEntry2.parentId === projectedDrop.parentId && activeEntry2.index === projectedDrop.index) {
|
|
2220
|
+
clearDragState();
|
|
2221
|
+
return;
|
|
2222
|
+
}
|
|
2166
2223
|
const payload = {
|
|
2167
2224
|
activeNode: activeEntry2.node,
|
|
2168
2225
|
overNode: overEntry.node,
|
|
2169
2226
|
activeParentId: activeEntry2.parentId,
|
|
2170
2227
|
overParentId: overEntry.parentId,
|
|
2228
|
+
targetParentId: projectedDrop.parentId,
|
|
2171
2229
|
activeIndex: activeEntry2.index,
|
|
2172
2230
|
overIndex: overEntry.index,
|
|
2231
|
+
targetIndex: projectedDrop.index,
|
|
2232
|
+
targetDepth: projectedDrop.depth,
|
|
2173
2233
|
sameParent: activeEntry2.parentId === overEntry.parentId,
|
|
2234
|
+
targetSameParent: activeEntry2.parentId === projectedDrop.parentId,
|
|
2174
2235
|
context
|
|
2175
2236
|
};
|
|
2176
2237
|
void onDragEnd(payload);
|