yangdx
commited on
Commit
·
a4ac433
1
Parent(s):
895e92f
fix(Tooltip): fix truncated content and add scrollbar in property tooltips
Browse files- lightrag/api/webui/assets/index-CH-3l4_Z.css +0 -0
- lightrag/api/webui/assets/{index-BlVvSIic.js → index-DB4_OcJk.js} +0 -0
- lightrag/api/webui/assets/index-kBxU9cG3.css +0 -0
- lightrag/api/webui/index.html +0 -0
- lightrag_webui/src/components/graph/PropertiesView.tsx +1 -1
- lightrag_webui/src/components/ui/Tooltip.tsx +33 -20
lightrag/api/webui/assets/index-CH-3l4_Z.css
DELETED
Binary file (47.7 kB)
|
|
lightrag/api/webui/assets/{index-BlVvSIic.js → index-DB4_OcJk.js}
RENAMED
Binary files a/lightrag/api/webui/assets/index-BlVvSIic.js and b/lightrag/api/webui/assets/index-DB4_OcJk.js differ
|
|
lightrag/api/webui/assets/index-kBxU9cG3.css
ADDED
Binary file (47.7 kB). View file
|
|
lightrag/api/webui/index.html
CHANGED
Binary files a/lightrag/api/webui/index.html and b/lightrag/api/webui/index.html differ
|
|
lightrag_webui/src/components/graph/PropertiesView.tsx
CHANGED
@@ -138,7 +138,7 @@ const PropertyRow = ({
|
|
138 |
className="hover:bg-primary/20 rounded p-1 text-ellipsis"
|
139 |
tooltipClassName="max-w-80"
|
140 |
text={value}
|
141 |
-
tooltip={tooltip || value}
|
142 |
side="left"
|
143 |
onClick={onClick}
|
144 |
/>
|
|
|
138 |
className="hover:bg-primary/20 rounded p-1 text-ellipsis"
|
139 |
tooltipClassName="max-w-80"
|
140 |
text={value}
|
141 |
+
tooltip={tooltip || (typeof value === 'string' ? value : JSON.stringify(value, null, 2))}
|
142 |
side="left"
|
143 |
onClick={onClick}
|
144 |
/>
|
lightrag_webui/src/components/ui/Tooltip.tsx
CHANGED
@@ -10,30 +10,43 @@ const TooltipTrigger = TooltipPrimitive.Trigger
|
|
10 |
|
11 |
const processTooltipContent = (content: string) => {
|
12 |
if (typeof content !== 'string') return content
|
13 |
-
return
|
14 |
-
<
|
15 |
-
{
|
16 |
-
|
17 |
-
|
18 |
-
))
|
19 |
}
|
20 |
|
21 |
const TooltipContent = React.forwardRef<
|
22 |
React.ComponentRef<typeof TooltipPrimitive.Content>,
|
23 |
-
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
)
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
TooltipContent.displayName = TooltipPrimitive.Content.displayName
|
38 |
|
39 |
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
|
|
10 |
|
11 |
const processTooltipContent = (content: string) => {
|
12 |
if (typeof content !== 'string') return content
|
13 |
+
return (
|
14 |
+
<div className="relative top-0 pt-1 whitespace-pre-wrap break-words">
|
15 |
+
{content}
|
16 |
+
</div>
|
17 |
+
)
|
|
|
18 |
}
|
19 |
|
20 |
const TooltipContent = React.forwardRef<
|
21 |
React.ComponentRef<typeof TooltipPrimitive.Content>,
|
22 |
+
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> & {
|
23 |
+
side?: 'top' | 'right' | 'bottom' | 'left'
|
24 |
+
align?: 'start' | 'center' | 'end'
|
25 |
+
}
|
26 |
+
>(({ className, side = 'left', align = 'start', children, ...props }, ref) => {
|
27 |
+
const contentRef = React.useRef<HTMLDivElement>(null);
|
28 |
+
|
29 |
+
React.useEffect(() => {
|
30 |
+
if (contentRef.current) {
|
31 |
+
contentRef.current.scrollTop = 0;
|
32 |
+
}
|
33 |
+
}, [children]);
|
34 |
+
|
35 |
+
return (
|
36 |
+
<TooltipPrimitive.Content
|
37 |
+
ref={ref}
|
38 |
+
side={side}
|
39 |
+
align={align}
|
40 |
+
className={cn(
|
41 |
+
'bg-popover text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-[60vh] overflow-y-auto whitespace-pre-wrap break-words rounded-md border px-3 py-2 text-sm shadow-md',
|
42 |
+
className
|
43 |
+
)}
|
44 |
+
{...props}
|
45 |
+
>
|
46 |
+
{typeof children === 'string' ? processTooltipContent(children) : children}
|
47 |
+
</TooltipPrimitive.Content>
|
48 |
+
);
|
49 |
+
})
|
50 |
TooltipContent.displayName = TooltipPrimitive.Content.displayName
|
51 |
|
52 |
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|