@inf-monkeys-tech/monkeys-design 0.4.40 → 0.4.41
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 +4 -4
- package/dist/components/data-explorer/index.d.ts +4 -4
- package/dist/components/data-explorer/index.js +297 -151
- package/dist/components/data-explorer/index.js.map +1 -1
- package/dist/components/data-explorer/index.mjs +299 -153
- package/dist/components/data-explorer/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/{theme-rXHbVr6l.d.ts → theme-6n0A9kRO.d.ts} +1 -1
- package/dist/{theme-DnbkgyCq.d.mts → theme-BsEbXR7C.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-BnC3Z85r.d.mts → types-BFHv0G27.d.mts} +1 -0
- package/dist/{types-BnC3Z85r.d.ts → types-BFHv0G27.d.ts} +1 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as DropdownMenu3 from '@radix-ui/react-dropdown-menu';
|
|
2
2
|
import { forwardRef, useState, useEffect, useMemo, useRef, useCallback, Fragment as Fragment$1, useLayoutEffect } from 'react';
|
|
3
3
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
|
-
import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from '@dnd-kit/core';
|
|
5
|
-
import { sortableKeyboardCoordinates, SortableContext, verticalListSortingStrategy, useSortable } from '@dnd-kit/sortable';
|
|
4
|
+
import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter, DragOverlay } from '@dnd-kit/core';
|
|
5
|
+
import { sortableKeyboardCoordinates, SortableContext, verticalListSortingStrategy, useSortable, defaultAnimateLayoutChanges } from '@dnd-kit/sortable';
|
|
6
6
|
import { CSS } from '@dnd-kit/utilities';
|
|
7
7
|
|
|
8
8
|
// src/components/data-explorer/DataExplorerToolbarActions.tsx
|
|
@@ -1671,11 +1671,30 @@ function DataExplorerDetailShell({
|
|
|
1671
1671
|
}
|
|
1672
1672
|
);
|
|
1673
1673
|
}
|
|
1674
|
-
var treeItemDropTransition =
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1674
|
+
var treeItemDropTransition = {
|
|
1675
|
+
duration: 220,
|
|
1676
|
+
easing: "cubic-bezier(0.22, 1, 0.36, 1)"
|
|
1677
|
+
};
|
|
1678
|
+
var treeItemAnimateLayoutChanges = (args) => {
|
|
1679
|
+
if (args.isSorting) return true;
|
|
1680
|
+
if (args.wasDragging && args.transition && args.containerId === args.previousContainerId) {
|
|
1681
|
+
return true;
|
|
1682
|
+
}
|
|
1683
|
+
return defaultAnimateLayoutChanges(args);
|
|
1684
|
+
};
|
|
1685
|
+
var treeItemRadiusValues = {
|
|
1686
|
+
none: "0px",
|
|
1687
|
+
sm: "0.125rem",
|
|
1688
|
+
md: "0.375rem",
|
|
1689
|
+
lg: "0.5rem",
|
|
1690
|
+
xl: "0.75rem",
|
|
1691
|
+
full: "9999px"
|
|
1692
|
+
};
|
|
1693
|
+
function resolveTreeItemBorderRadius(itemRadius, appearanceRadius) {
|
|
1694
|
+
const radius = itemRadius ?? appearanceRadius;
|
|
1695
|
+
if (typeof radius === "number") return `${radius}px`;
|
|
1696
|
+
if (!radius) return void 0;
|
|
1697
|
+
return treeItemRadiusValues[radius] ?? radius;
|
|
1679
1698
|
}
|
|
1680
1699
|
function ChevronIcon({ expanded }) {
|
|
1681
1700
|
return /* @__PURE__ */ jsx(
|
|
@@ -1758,6 +1777,7 @@ function DraggableTreeItem({
|
|
|
1758
1777
|
collapseLabel,
|
|
1759
1778
|
themeSlots,
|
|
1760
1779
|
classNames,
|
|
1780
|
+
itemStyle,
|
|
1761
1781
|
context,
|
|
1762
1782
|
renderNodeActions,
|
|
1763
1783
|
renderNodeChildren,
|
|
@@ -1779,10 +1799,8 @@ function DraggableTreeItem({
|
|
|
1779
1799
|
} = useSortable({
|
|
1780
1800
|
id: node.id,
|
|
1781
1801
|
disabled: !draggable,
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
easing: "cubic-bezier(0.22,1,0.36,1)"
|
|
1785
|
-
}
|
|
1802
|
+
animateLayoutChanges: treeItemAnimateLayoutChanges,
|
|
1803
|
+
transition: treeItemDropTransition
|
|
1786
1804
|
});
|
|
1787
1805
|
const {
|
|
1788
1806
|
role: _sortableRole,
|
|
@@ -1803,7 +1821,7 @@ function DraggableTreeItem({
|
|
|
1803
1821
|
};
|
|
1804
1822
|
const style = {
|
|
1805
1823
|
transform: CSS.Transform.toString(transform),
|
|
1806
|
-
transition
|
|
1824
|
+
transition
|
|
1807
1825
|
};
|
|
1808
1826
|
return /* @__PURE__ */ jsxs(
|
|
1809
1827
|
"div",
|
|
@@ -1814,104 +1832,39 @@ function DraggableTreeItem({
|
|
|
1814
1832
|
"min-w-0",
|
|
1815
1833
|
classNames?.item,
|
|
1816
1834
|
node.className,
|
|
1817
|
-
isDragging && "relative z-20"
|
|
1835
|
+
isDragging && "relative z-20",
|
|
1836
|
+
active && "opacity-0"
|
|
1818
1837
|
),
|
|
1819
1838
|
children: [
|
|
1820
|
-
/* @__PURE__ */
|
|
1821
|
-
|
|
1839
|
+
/* @__PURE__ */ jsx(
|
|
1840
|
+
TreeItemRow,
|
|
1822
1841
|
{
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
onClick: () => {
|
|
1850
|
-
if (!selectable) return;
|
|
1851
|
-
onSelect?.(node);
|
|
1852
|
-
},
|
|
1853
|
-
onKeyDown: (event) => {
|
|
1854
|
-
if (!selectable) return;
|
|
1855
|
-
if (event.key !== "Enter" && event.key !== " ") return;
|
|
1856
|
-
event.preventDefault();
|
|
1857
|
-
onSelect?.(node);
|
|
1858
|
-
},
|
|
1859
|
-
children: [
|
|
1860
|
-
draggable ? /* @__PURE__ */ jsx(
|
|
1861
|
-
"span",
|
|
1862
|
-
{
|
|
1863
|
-
className: cn(
|
|
1864
|
-
themeSlots.treeNodeDragHandle,
|
|
1865
|
-
"opacity-100",
|
|
1866
|
-
classNames?.dragHandle
|
|
1867
|
-
),
|
|
1868
|
-
"aria-label": dragHandleLabel,
|
|
1869
|
-
title: dragHandleLabel,
|
|
1870
|
-
...handleListeners,
|
|
1871
|
-
onClick: (event) => event.stopPropagation(),
|
|
1872
|
-
children: /* @__PURE__ */ jsx(GripIcon, {})
|
|
1873
|
-
}
|
|
1874
|
-
) : /* @__PURE__ */ jsx("span", { className: cn("h-5 w-5 shrink-0", classNames?.dragHandle) }),
|
|
1875
|
-
hasChildren ? /* @__PURE__ */ jsx(
|
|
1876
|
-
"button",
|
|
1877
|
-
{
|
|
1878
|
-
type: "button",
|
|
1879
|
-
className: cn(themeSlots.treeNodeToggle, classNames?.toggle),
|
|
1880
|
-
"aria-label": expanded ? collapseLabel : expandLabel,
|
|
1881
|
-
onClick: (event) => {
|
|
1882
|
-
event.stopPropagation();
|
|
1883
|
-
onToggle(node.id);
|
|
1884
|
-
},
|
|
1885
|
-
children: /* @__PURE__ */ jsx(ChevronIcon, { expanded })
|
|
1886
|
-
}
|
|
1887
|
-
) : /* @__PURE__ */ jsx("span", { className: cn(themeSlots.treeNodeToggle, classNames?.toggle) }),
|
|
1888
|
-
node.icon ? /* @__PURE__ */ jsx("span", { className: cn(themeSlots.treeNodeIcon, classNames?.icon), children: node.icon }) : null,
|
|
1889
|
-
/* @__PURE__ */ jsxs(
|
|
1890
|
-
"span",
|
|
1891
|
-
{
|
|
1892
|
-
className: cn(
|
|
1893
|
-
"flex min-w-0 flex-1 flex-col",
|
|
1894
|
-
classNames?.itemContent
|
|
1895
|
-
),
|
|
1896
|
-
children: [
|
|
1897
|
-
/* @__PURE__ */ jsx("span", { className: cn(themeSlots.treeNodeLabel, classNames?.label), children: node.label }),
|
|
1898
|
-
node.description ? /* @__PURE__ */ jsx(
|
|
1899
|
-
"span",
|
|
1900
|
-
{
|
|
1901
|
-
className: cn(
|
|
1902
|
-
themeSlots.treeNodeDescription,
|
|
1903
|
-
classNames?.description
|
|
1904
|
-
),
|
|
1905
|
-
children: node.description
|
|
1906
|
-
}
|
|
1907
|
-
) : null
|
|
1908
|
-
]
|
|
1909
|
-
}
|
|
1910
|
-
),
|
|
1911
|
-
node.meta ? /* @__PURE__ */ jsx("span", { className: cn(themeSlots.treeNodeMeta, classNames?.meta), children: node.meta }) : null,
|
|
1912
|
-
node.badge ? /* @__PURE__ */ jsx("span", { className: cn(themeSlots.treeNodeBadge, classNames?.badge), children: node.badge }) : null,
|
|
1913
|
-
renderNodeActions ? /* @__PURE__ */ jsx("span", { className: cn("ml-1 shrink-0", classNames?.actions), children: renderNodeActions(renderContext) }) : null
|
|
1914
|
-
]
|
|
1842
|
+
node,
|
|
1843
|
+
depth,
|
|
1844
|
+
indentSize,
|
|
1845
|
+
selected,
|
|
1846
|
+
expanded,
|
|
1847
|
+
active: isDragging || active,
|
|
1848
|
+
over,
|
|
1849
|
+
hasChildren,
|
|
1850
|
+
disabled,
|
|
1851
|
+
selectable,
|
|
1852
|
+
draggable,
|
|
1853
|
+
activationMode,
|
|
1854
|
+
dragHandleLabel,
|
|
1855
|
+
expandLabel,
|
|
1856
|
+
collapseLabel,
|
|
1857
|
+
themeSlots,
|
|
1858
|
+
classNames,
|
|
1859
|
+
itemClassName: node.itemClassName,
|
|
1860
|
+
itemStyle,
|
|
1861
|
+
sortableAttributes,
|
|
1862
|
+
sortableListeners,
|
|
1863
|
+
handleListeners,
|
|
1864
|
+
renderNodeActions,
|
|
1865
|
+
renderContext,
|
|
1866
|
+
onSelect: () => onSelect?.(node),
|
|
1867
|
+
onToggle: () => onToggle(node.id)
|
|
1915
1868
|
}
|
|
1916
1869
|
),
|
|
1917
1870
|
renderNodeChildren ? /* @__PURE__ */ jsx(
|
|
@@ -1929,6 +1882,132 @@ function DraggableTreeItem({
|
|
|
1929
1882
|
}
|
|
1930
1883
|
);
|
|
1931
1884
|
}
|
|
1885
|
+
function TreeItemRow({
|
|
1886
|
+
node,
|
|
1887
|
+
depth,
|
|
1888
|
+
indentSize,
|
|
1889
|
+
selected,
|
|
1890
|
+
expanded,
|
|
1891
|
+
active,
|
|
1892
|
+
over,
|
|
1893
|
+
hasChildren,
|
|
1894
|
+
disabled,
|
|
1895
|
+
selectable,
|
|
1896
|
+
draggable,
|
|
1897
|
+
activationMode,
|
|
1898
|
+
dragHandleLabel,
|
|
1899
|
+
expandLabel,
|
|
1900
|
+
collapseLabel,
|
|
1901
|
+
themeSlots,
|
|
1902
|
+
classNames,
|
|
1903
|
+
itemClassName,
|
|
1904
|
+
itemStyle,
|
|
1905
|
+
sortableAttributes,
|
|
1906
|
+
sortableListeners,
|
|
1907
|
+
handleListeners,
|
|
1908
|
+
renderNodeActions,
|
|
1909
|
+
renderContext,
|
|
1910
|
+
onSelect,
|
|
1911
|
+
onToggle
|
|
1912
|
+
}) {
|
|
1913
|
+
return /* @__PURE__ */ jsxs(
|
|
1914
|
+
"div",
|
|
1915
|
+
{
|
|
1916
|
+
"data-data-explorer-draggable-tree-item": true,
|
|
1917
|
+
className: cn(
|
|
1918
|
+
themeSlots.treeNodeButton,
|
|
1919
|
+
"min-h-8 touch-none border border-transparent bg-background/70 py-0 pl-1 pr-2 font-medium",
|
|
1920
|
+
selectable && "cursor-pointer",
|
|
1921
|
+
draggable && activationMode === "row" && "cursor-grab active:cursor-grabbing",
|
|
1922
|
+
selected && themeSlots.treeNodeSelected,
|
|
1923
|
+
disabled && themeSlots.treeNodeDisabled,
|
|
1924
|
+
active && themeSlots.treeNodeDragging,
|
|
1925
|
+
over && "border-primary/30 bg-primary/[0.08] ring-1 ring-primary/15",
|
|
1926
|
+
selected && classNames?.itemSelected,
|
|
1927
|
+
disabled && classNames?.itemDisabled,
|
|
1928
|
+
active && classNames?.itemDragging,
|
|
1929
|
+
over && classNames?.itemOver,
|
|
1930
|
+
classNames?.itemButton,
|
|
1931
|
+
itemClassName
|
|
1932
|
+
),
|
|
1933
|
+
style: { ...itemStyle, paddingLeft: `${depth * indentSize + 4}px` },
|
|
1934
|
+
role: "treeitem",
|
|
1935
|
+
"aria-selected": selected || void 0,
|
|
1936
|
+
"aria-disabled": disabled || void 0,
|
|
1937
|
+
"aria-expanded": hasChildren ? expanded : void 0,
|
|
1938
|
+
"aria-label": node.ariaLabel,
|
|
1939
|
+
tabIndex: selectable ? 0 : -1,
|
|
1940
|
+
...sortableAttributes,
|
|
1941
|
+
...sortableListeners,
|
|
1942
|
+
onClick: () => {
|
|
1943
|
+
if (!selectable) return;
|
|
1944
|
+
onSelect?.();
|
|
1945
|
+
},
|
|
1946
|
+
onKeyDown: (event) => {
|
|
1947
|
+
if (!selectable) return;
|
|
1948
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
1949
|
+
event.preventDefault();
|
|
1950
|
+
onSelect?.();
|
|
1951
|
+
},
|
|
1952
|
+
children: [
|
|
1953
|
+
draggable ? /* @__PURE__ */ jsx(
|
|
1954
|
+
"span",
|
|
1955
|
+
{
|
|
1956
|
+
className: cn(
|
|
1957
|
+
themeSlots.treeNodeDragHandle,
|
|
1958
|
+
"opacity-100",
|
|
1959
|
+
classNames?.dragHandle
|
|
1960
|
+
),
|
|
1961
|
+
"aria-label": dragHandleLabel,
|
|
1962
|
+
title: dragHandleLabel,
|
|
1963
|
+
...handleListeners,
|
|
1964
|
+
onClick: (event) => event.stopPropagation(),
|
|
1965
|
+
children: /* @__PURE__ */ jsx(GripIcon, {})
|
|
1966
|
+
}
|
|
1967
|
+
) : /* @__PURE__ */ jsx("span", { className: cn("h-5 w-5 shrink-0", classNames?.dragHandle) }),
|
|
1968
|
+
hasChildren ? /* @__PURE__ */ jsx(
|
|
1969
|
+
"button",
|
|
1970
|
+
{
|
|
1971
|
+
type: "button",
|
|
1972
|
+
className: cn(themeSlots.treeNodeToggle, classNames?.toggle),
|
|
1973
|
+
"aria-label": expanded ? collapseLabel : expandLabel,
|
|
1974
|
+
onClick: (event) => {
|
|
1975
|
+
event.stopPropagation();
|
|
1976
|
+
onToggle?.();
|
|
1977
|
+
},
|
|
1978
|
+
children: /* @__PURE__ */ jsx(ChevronIcon, { expanded })
|
|
1979
|
+
}
|
|
1980
|
+
) : /* @__PURE__ */ jsx("span", { className: cn(themeSlots.treeNodeToggle, classNames?.toggle) }),
|
|
1981
|
+
node.icon ? /* @__PURE__ */ jsx("span", { className: cn(themeSlots.treeNodeIcon, classNames?.icon), children: node.icon }) : null,
|
|
1982
|
+
/* @__PURE__ */ jsxs(
|
|
1983
|
+
"span",
|
|
1984
|
+
{
|
|
1985
|
+
className: cn(
|
|
1986
|
+
"flex min-w-0 flex-1 flex-col",
|
|
1987
|
+
classNames?.itemContent
|
|
1988
|
+
),
|
|
1989
|
+
children: [
|
|
1990
|
+
/* @__PURE__ */ jsx("span", { className: cn(themeSlots.treeNodeLabel, classNames?.label), children: node.label }),
|
|
1991
|
+
node.description ? /* @__PURE__ */ jsx(
|
|
1992
|
+
"span",
|
|
1993
|
+
{
|
|
1994
|
+
className: cn(
|
|
1995
|
+
themeSlots.treeNodeDescription,
|
|
1996
|
+
classNames?.description
|
|
1997
|
+
),
|
|
1998
|
+
children: node.description
|
|
1999
|
+
}
|
|
2000
|
+
) : null
|
|
2001
|
+
]
|
|
2002
|
+
}
|
|
2003
|
+
),
|
|
2004
|
+
node.meta ? /* @__PURE__ */ jsx("span", { className: cn(themeSlots.treeNodeMeta, classNames?.meta), children: node.meta }) : null,
|
|
2005
|
+
node.badge ? /* @__PURE__ */ jsx("span", { className: cn(themeSlots.treeNodeBadge, classNames?.badge), children: node.badge }) : null,
|
|
2006
|
+
renderNodeActions ? /* @__PURE__ */ jsx("span", { className: cn("ml-1 shrink-0", classNames?.actions), children: renderNodeActions(renderContext) }) : null
|
|
2007
|
+
]
|
|
2008
|
+
}
|
|
2009
|
+
);
|
|
2010
|
+
}
|
|
1932
2011
|
function DataExplorerDraggableTree({
|
|
1933
2012
|
nodes,
|
|
1934
2013
|
context,
|
|
@@ -1942,6 +2021,7 @@ function DataExplorerDraggableTree({
|
|
|
1942
2021
|
empty,
|
|
1943
2022
|
labels,
|
|
1944
2023
|
appearance,
|
|
2024
|
+
itemRadius,
|
|
1945
2025
|
className,
|
|
1946
2026
|
classNames,
|
|
1947
2027
|
renderNodeActions,
|
|
@@ -1955,7 +2035,14 @@ function DataExplorerDraggableTree({
|
|
|
1955
2035
|
() => buildDefaultExpandedNodeIds(nodes, defaultExpandedNodeIds)
|
|
1956
2036
|
);
|
|
1957
2037
|
const [activeNodeId, setActiveNodeId] = useState();
|
|
2038
|
+
const [activeNodeWidth, setActiveNodeWidth] = useState();
|
|
1958
2039
|
const [overNodeId, setOverNodeId] = useState();
|
|
2040
|
+
const itemBorderRadius = resolveTreeItemBorderRadius(itemRadius, theme.radius);
|
|
2041
|
+
const itemStyle = itemBorderRadius ? { borderRadius: itemBorderRadius } : void 0;
|
|
2042
|
+
const overlayStyle = {
|
|
2043
|
+
width: activeNodeWidth,
|
|
2044
|
+
borderRadius: itemBorderRadius
|
|
2045
|
+
};
|
|
1959
2046
|
const sensors = useSensors(
|
|
1960
2047
|
useSensor(PointerSensor, { activationConstraint: { distance: 4 } }),
|
|
1961
2048
|
useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates })
|
|
@@ -1975,6 +2062,7 @@ function DataExplorerDraggableTree({
|
|
|
1975
2062
|
for (const entry of flattenedNodes) map.set(entry.node.id, entry);
|
|
1976
2063
|
return map;
|
|
1977
2064
|
}, [flattenedNodes]);
|
|
2065
|
+
const activeEntry = activeNodeId ? flattenedNodeMap.get(activeNodeId) : void 0;
|
|
1978
2066
|
const sortableIds = flattenedNodes.map((entry) => entry.node.id);
|
|
1979
2067
|
const setNodeExpanded = (nodeId, expanded) => {
|
|
1980
2068
|
const next = new Set(resolvedExpandedNodeIds);
|
|
@@ -1992,19 +2080,20 @@ function DataExplorerDraggableTree({
|
|
|
1992
2080
|
const activeId = String(event.active.id || "");
|
|
1993
2081
|
const overId = event.over ? String(event.over.id || "") : "";
|
|
1994
2082
|
setActiveNodeId(void 0);
|
|
2083
|
+
setActiveNodeWidth(void 0);
|
|
1995
2084
|
setOverNodeId(void 0);
|
|
1996
2085
|
if (!activeId || !overId || activeId === overId || !onDragEnd) return;
|
|
1997
|
-
const
|
|
2086
|
+
const activeEntry2 = flattenedNodeMap.get(activeId);
|
|
1998
2087
|
const overEntry = flattenedNodeMap.get(overId);
|
|
1999
|
-
if (!
|
|
2088
|
+
if (!activeEntry2 || !overEntry) return;
|
|
2000
2089
|
const payload = {
|
|
2001
|
-
activeNode:
|
|
2090
|
+
activeNode: activeEntry2.node,
|
|
2002
2091
|
overNode: overEntry.node,
|
|
2003
|
-
activeParentId:
|
|
2092
|
+
activeParentId: activeEntry2.parentId,
|
|
2004
2093
|
overParentId: overEntry.parentId,
|
|
2005
|
-
activeIndex:
|
|
2094
|
+
activeIndex: activeEntry2.index,
|
|
2006
2095
|
overIndex: overEntry.index,
|
|
2007
|
-
sameParent:
|
|
2096
|
+
sameParent: activeEntry2.parentId === overEntry.parentId,
|
|
2008
2097
|
context
|
|
2009
2098
|
};
|
|
2010
2099
|
void onDragEnd(payload);
|
|
@@ -2015,59 +2104,116 @@ function DataExplorerDraggableTree({
|
|
|
2015
2104
|
if (nodes.length === 0) {
|
|
2016
2105
|
return /* @__PURE__ */ jsx("div", { className: cn(theme.slots.treeRoot, classNames?.root, className), children: /* @__PURE__ */ jsx("div", { className: cn(theme.slots.treeEmpty, classNames?.empty), children: empty ?? labels?.empty ?? "No data" }) });
|
|
2017
2106
|
}
|
|
2018
|
-
return /* @__PURE__ */
|
|
2107
|
+
return /* @__PURE__ */ jsxs(
|
|
2019
2108
|
DndContext,
|
|
2020
2109
|
{
|
|
2021
2110
|
sensors,
|
|
2022
2111
|
collisionDetection: closestCenter,
|
|
2023
|
-
onDragStart: (event) =>
|
|
2112
|
+
onDragStart: (event) => {
|
|
2113
|
+
setActiveNodeId(String(event.active.id || ""));
|
|
2114
|
+
setActiveNodeWidth(event.active.rect.current.initial?.width);
|
|
2115
|
+
},
|
|
2024
2116
|
onDragOver: (event) => {
|
|
2025
2117
|
setOverNodeId(event.over ? String(event.over.id || "") : void 0);
|
|
2026
2118
|
},
|
|
2027
2119
|
onDragEnd: handleDragEnd,
|
|
2028
2120
|
onDragCancel: () => {
|
|
2029
2121
|
setActiveNodeId(void 0);
|
|
2122
|
+
setActiveNodeWidth(void 0);
|
|
2030
2123
|
setOverNodeId(void 0);
|
|
2031
2124
|
},
|
|
2032
|
-
children:
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2125
|
+
children: [
|
|
2126
|
+
/* @__PURE__ */ jsx(SortableContext, { items: sortableIds, strategy: verticalListSortingStrategy, children: /* @__PURE__ */ jsx(
|
|
2127
|
+
"div",
|
|
2128
|
+
{
|
|
2129
|
+
className: cn(
|
|
2130
|
+
theme.slots.treeRoot,
|
|
2131
|
+
"space-y-1 overflow-visible",
|
|
2132
|
+
classNames?.root,
|
|
2133
|
+
className
|
|
2134
|
+
),
|
|
2135
|
+
role: "tree",
|
|
2136
|
+
children: /* @__PURE__ */ jsx("div", { className: cn("min-w-0 space-y-1", classNames?.list), children: flattenedNodes.map((entry) => {
|
|
2137
|
+
const node = entry.node;
|
|
2138
|
+
const expanded = node.collapsible === false || resolvedExpandedNodeIds.has(node.id);
|
|
2139
|
+
return /* @__PURE__ */ jsx(
|
|
2140
|
+
DraggableTreeItem,
|
|
2141
|
+
{
|
|
2142
|
+
entry,
|
|
2143
|
+
selected: selectedNodeId === node.id,
|
|
2144
|
+
expanded,
|
|
2145
|
+
active: activeNodeId === node.id,
|
|
2146
|
+
over: overNodeId === node.id && activeNodeId !== node.id,
|
|
2147
|
+
indentSize,
|
|
2148
|
+
activationMode,
|
|
2149
|
+
dragHandleLabel: labels?.dragHandle ?? "Drag",
|
|
2150
|
+
expandLabel: labels?.expand ?? "Expand",
|
|
2151
|
+
collapseLabel: labels?.collapse ?? "Collapse",
|
|
2152
|
+
themeSlots: theme.slots,
|
|
2153
|
+
classNames,
|
|
2154
|
+
itemStyle,
|
|
2155
|
+
context,
|
|
2156
|
+
renderNodeActions,
|
|
2157
|
+
renderNodeChildren,
|
|
2158
|
+
onSelect: (nextNode) => onSelectNode?.(nextNode, context),
|
|
2159
|
+
onToggle: (nodeId) => setNodeExpanded(nodeId, !expanded)
|
|
2160
|
+
},
|
|
2161
|
+
node.id
|
|
2162
|
+
);
|
|
2163
|
+
}) })
|
|
2164
|
+
}
|
|
2165
|
+
) }),
|
|
2166
|
+
/* @__PURE__ */ jsx(
|
|
2167
|
+
DragOverlay,
|
|
2168
|
+
{
|
|
2169
|
+
dropAnimation: {
|
|
2170
|
+
duration: treeItemDropTransition.duration,
|
|
2171
|
+
easing: treeItemDropTransition.easing
|
|
2172
|
+
},
|
|
2173
|
+
children: activeEntry ? /* @__PURE__ */ jsx(
|
|
2174
|
+
"div",
|
|
2047
2175
|
{
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2176
|
+
className: cn("min-w-0 overflow-hidden shadow-lg", classNames?.overlay),
|
|
2177
|
+
style: overlayStyle,
|
|
2178
|
+
children: /* @__PURE__ */ jsx(
|
|
2179
|
+
TreeItemRow,
|
|
2180
|
+
{
|
|
2181
|
+
node: activeEntry.node,
|
|
2182
|
+
depth: activeEntry.depth,
|
|
2183
|
+
indentSize,
|
|
2184
|
+
selected: selectedNodeId === activeEntry.node.id,
|
|
2185
|
+
expanded: activeEntry.node.collapsible === false || resolvedExpandedNodeIds.has(activeEntry.node.id),
|
|
2186
|
+
active: true,
|
|
2187
|
+
over: false,
|
|
2188
|
+
hasChildren: Boolean(activeEntry.node.children?.length),
|
|
2189
|
+
disabled: Boolean(activeEntry.node.disabled),
|
|
2190
|
+
selectable: activeEntry.node.selectable !== false,
|
|
2191
|
+
draggable: activeEntry.node.draggable !== false,
|
|
2192
|
+
activationMode,
|
|
2193
|
+
dragHandleLabel: labels?.dragHandle ?? "Drag",
|
|
2194
|
+
expandLabel: labels?.expand ?? "Expand",
|
|
2195
|
+
collapseLabel: labels?.collapse ?? "Collapse",
|
|
2196
|
+
themeSlots: theme.slots,
|
|
2197
|
+
classNames,
|
|
2198
|
+
itemClassName: activeEntry.node.itemClassName,
|
|
2199
|
+
itemStyle,
|
|
2200
|
+
renderNodeActions,
|
|
2201
|
+
renderContext: {
|
|
2202
|
+
node: activeEntry.node,
|
|
2203
|
+
depth: activeEntry.depth,
|
|
2204
|
+
expanded: activeEntry.node.collapsible === false || resolvedExpandedNodeIds.has(activeEntry.node.id),
|
|
2205
|
+
selected: selectedNodeId === activeEntry.node.id,
|
|
2206
|
+
dragging: true,
|
|
2207
|
+
disabled: Boolean(activeEntry.node.disabled),
|
|
2208
|
+
context: activeEntry.node.context ?? context
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
)
|
|
2212
|
+
}
|
|
2213
|
+
) : null
|
|
2214
|
+
}
|
|
2215
|
+
)
|
|
2216
|
+
]
|
|
2071
2217
|
}
|
|
2072
2218
|
);
|
|
2073
2219
|
}
|