yangdx
commited on
Commit
·
c8567ca
1
Parent(s):
a450594
Fix Safari popover problem
Browse files
lightrag_webui/src/components/graph/LayoutsControl.tsx
CHANGED
@@ -289,7 +289,7 @@ const LayoutsControl = () => {
|
|
289 |
)
|
290 |
|
291 |
return (
|
292 |
-
|
293 |
<div>
|
294 |
{layouts[layout] && 'worker' in layouts[layout] && (
|
295 |
<WorkerLayoutControl
|
@@ -310,7 +310,14 @@ const LayoutsControl = () => {
|
|
310 |
<GripIcon />
|
311 |
</Button>
|
312 |
</PopoverTrigger>
|
313 |
-
<PopoverContent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
314 |
<Command>
|
315 |
<CommandList>
|
316 |
<CommandGroup>
|
@@ -331,7 +338,7 @@ const LayoutsControl = () => {
|
|
331 |
</PopoverContent>
|
332 |
</Popover>
|
333 |
</div>
|
334 |
-
|
335 |
)
|
336 |
}
|
337 |
|
|
|
289 |
)
|
290 |
|
291 |
return (
|
292 |
+
<div>
|
293 |
<div>
|
294 |
{layouts[layout] && 'worker' in layouts[layout] && (
|
295 |
<WorkerLayoutControl
|
|
|
310 |
<GripIcon />
|
311 |
</Button>
|
312 |
</PopoverTrigger>
|
313 |
+
<PopoverContent
|
314 |
+
side="right"
|
315 |
+
align="start"
|
316 |
+
sideOffset={8}
|
317 |
+
collisionPadding={5}
|
318 |
+
sticky="always"
|
319 |
+
className="p-1 min-w-auto"
|
320 |
+
>
|
321 |
<Command>
|
322 |
<CommandList>
|
323 |
<CommandGroup>
|
|
|
338 |
</PopoverContent>
|
339 |
</Popover>
|
340 |
</div>
|
341 |
+
</div>
|
342 |
)
|
343 |
}
|
344 |
|
lightrag_webui/src/components/graph/Settings.tsx
CHANGED
@@ -245,8 +245,10 @@ export default function Settings() {
|
|
245 |
</PopoverTrigger>
|
246 |
<PopoverContent
|
247 |
side="right"
|
248 |
-
align="
|
249 |
-
|
|
|
|
|
250 |
onCloseAutoFocus={(e) => e.preventDefault()}
|
251 |
>
|
252 |
<div className="flex flex-col gap-2">
|
|
|
245 |
</PopoverTrigger>
|
246 |
<PopoverContent
|
247 |
side="right"
|
248 |
+
align="end"
|
249 |
+
sideOffset={8}
|
250 |
+
collisionPadding={5}
|
251 |
+
className="p-2 max-w-[200px]"
|
252 |
onCloseAutoFocus={(e) => e.preventDefault()}
|
253 |
>
|
254 |
<div className="flex flex-col gap-2">
|
lightrag_webui/src/components/ui/Popover.tsx
CHANGED
@@ -7,20 +7,32 @@ const Popover = PopoverPrimitive.Root
|
|
7 |
|
8 |
const PopoverTrigger = PopoverPrimitive.Trigger
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
const PopoverContent = React.forwardRef<
|
11 |
React.ComponentRef<typeof PopoverPrimitive.Content>,
|
12 |
-
|
13 |
-
>(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (
|
14 |
-
<PopoverPrimitive.
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
24 |
))
|
25 |
PopoverContent.displayName = PopoverPrimitive.Content.displayName
|
26 |
|
|
|
7 |
|
8 |
const PopoverTrigger = PopoverPrimitive.Trigger
|
9 |
|
10 |
+
// Define the props type to include positioning props
|
11 |
+
type PopoverContentProps = React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & {
|
12 |
+
collisionPadding?: number | Partial<Record<'top' | 'right' | 'bottom' | 'left', number>>;
|
13 |
+
sticky?: 'partial' | 'always';
|
14 |
+
avoidCollisions?: boolean;
|
15 |
+
};
|
16 |
+
|
17 |
const PopoverContent = React.forwardRef<
|
18 |
React.ComponentRef<typeof PopoverPrimitive.Content>,
|
19 |
+
PopoverContentProps
|
20 |
+
>(({ className, align = 'center', sideOffset = 4, collisionPadding, sticky, avoidCollisions = false, ...props }, ref) => (
|
21 |
+
<PopoverPrimitive.Portal>
|
22 |
+
<PopoverPrimitive.Content
|
23 |
+
ref={ref}
|
24 |
+
align={align}
|
25 |
+
sideOffset={sideOffset}
|
26 |
+
collisionPadding={collisionPadding}
|
27 |
+
sticky={sticky}
|
28 |
+
avoidCollisions={avoidCollisions}
|
29 |
+
className={cn(
|
30 |
+
'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 z-50 rounded-md border p-4 shadow-md outline-none',
|
31 |
+
className
|
32 |
+
)}
|
33 |
+
{...props}
|
34 |
+
/>
|
35 |
+
</PopoverPrimitive.Portal>
|
36 |
))
|
37 |
PopoverContent.displayName = PopoverPrimitive.Content.displayName
|
38 |
|