mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 18:27:19 +08:00
fix
This commit is contained in:
parent
4e94683fd4
commit
f8c876cc87
@ -191,12 +191,14 @@ const NodeSelector: FC<NodeSelectorProps> = ({
|
||||
</PopoverTrigger>
|
||||
)
|
||||
const triggerElement = trigger?.(open)
|
||||
const shouldRenderTriggerElementAsRoot = React.isValidElement(triggerElement)
|
||||
&& (asChild || triggerElement.type === 'button')
|
||||
const triggerElementProps = React.isValidElement(triggerElement)
|
||||
? (triggerElement.props as {
|
||||
onClick?: MouseEventHandler<HTMLElement>
|
||||
})
|
||||
: null
|
||||
const resolvedTriggerElement = asChild && React.isValidElement(triggerElement)
|
||||
const resolvedTriggerElement = shouldRenderTriggerElementAsRoot
|
||||
? React.cloneElement(
|
||||
triggerElement as React.ReactElement<{
|
||||
onClick?: MouseEventHandler<HTMLElement>
|
||||
@ -217,9 +219,8 @@ const NodeSelector: FC<NodeSelectorProps> = ({
|
||||
const resolvedOffset = typeof offset === 'number' || typeof offset === 'function' ? undefined : offset
|
||||
const sideOffset = typeof offset === 'number' ? offset : (resolvedOffset?.mainAxis ?? 0)
|
||||
const alignOffset = typeof offset === 'number' ? 0 : (resolvedOffset?.crossAxis ?? 0)
|
||||
const nativeButton = asChild
|
||||
? React.isValidElement(triggerElement) && (typeof triggerElement.type !== 'string' || triggerElement.type === 'button')
|
||||
: false
|
||||
const nativeButton = shouldRenderTriggerElementAsRoot
|
||||
&& (typeof triggerElement.type !== 'string' || triggerElement.type === 'button')
|
||||
|
||||
return (
|
||||
<Popover
|
||||
|
||||
Loading…
Reference in New Issue
Block a user