Feature/mutil embedding model (#908)
Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: jyong <jyong@dify.ai> Co-authored-by: StyleZhang <jasonapring2015@outlook.com>
This commit is contained in:
@@ -9,6 +9,7 @@ type IPopover = {
|
||||
position?: 'bottom' | 'br'
|
||||
btnElement?: string | React.ReactNode
|
||||
btnClassName?: string | ((open: boolean) => string)
|
||||
manualClose?: boolean
|
||||
}
|
||||
|
||||
const timeoutDuration = 100
|
||||
@@ -20,6 +21,7 @@ export default function CustomPopover({
|
||||
btnElement,
|
||||
className,
|
||||
btnClassName,
|
||||
manualClose,
|
||||
}: IPopover) {
|
||||
const buttonRef = useRef<HTMLButtonElement>(null)
|
||||
const timeOutRef = useRef<NodeJS.Timeout | null>(null)
|
||||
@@ -62,17 +64,14 @@ export default function CustomPopover({
|
||||
</Popover.Button>
|
||||
<Transition as={Fragment}>
|
||||
<Popover.Panel
|
||||
className={`${s.popupPanel} ${
|
||||
position === 'br'
|
||||
? 'right-0'
|
||||
: 'transform -translate-x-1/2 left-1/2'
|
||||
} ${className}`}
|
||||
className={`${s.popupPanel} ${position === 'br' ? 'right-0' : 'translate-x-1/2 left-1/2'} ${className}`}
|
||||
{...(trigger !== 'hover'
|
||||
? {}
|
||||
: {
|
||||
onMouseLeave: () => onMouseLeave(open),
|
||||
onMouseEnter: () => onMouseEnter(open),
|
||||
})}
|
||||
})
|
||||
}
|
||||
>
|
||||
{({ close }) => (
|
||||
<div
|
||||
@@ -82,10 +81,16 @@ export default function CustomPopover({
|
||||
: {
|
||||
onMouseLeave: () => onMouseLeave(open),
|
||||
onMouseEnter: () => onMouseEnter(open),
|
||||
})}
|
||||
})
|
||||
}
|
||||
>
|
||||
{cloneElement(htmlContent as React.ReactElement, {
|
||||
onClose: () => close(),
|
||||
onClose: () => onMouseLeave(open),
|
||||
...(manualClose
|
||||
? {
|
||||
onClick: close,
|
||||
}
|
||||
: {}),
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
|
Reference in New Issue
Block a user