mirror of https://github.com/langgenius/dify.git
fix: Remove customContainer prop from PortalToFollowElem and adjust padding in dropdown component
This commit is contained in:
parent
8997e49f3a
commit
73007362b3
|
|
@ -114,7 +114,6 @@ const DropDown = ({
|
|||
} : {
|
||||
mainAxis: 4,
|
||||
}}
|
||||
customContainer={document.body}
|
||||
>
|
||||
<PortalToFollowElemTrigger onClick={handleTrigger}>
|
||||
<ActionButton className={cn(expand ? 'size-8 rounded-lg' : 'size-6 rounded-md')}>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import {
|
|||
FloatingPortal,
|
||||
autoUpdate,
|
||||
flip,
|
||||
hide,
|
||||
offset,
|
||||
shift,
|
||||
size,
|
||||
|
|
@ -31,7 +30,6 @@ export type PortalToFollowElemOptions = {
|
|||
offset?: number | OffsetOptions
|
||||
onOpenChange?: (open: boolean) => void
|
||||
triggerPopupSameWidth?: boolean
|
||||
customContainer?: HTMLElement | null
|
||||
}
|
||||
|
||||
export function usePortalToFollowElem({
|
||||
|
|
@ -40,9 +38,7 @@ export function usePortalToFollowElem({
|
|||
offset: offsetValue = 0,
|
||||
onOpenChange: setControlledOpen,
|
||||
triggerPopupSameWidth,
|
||||
customContainer = null,
|
||||
}: PortalToFollowElemOptions = {}) {
|
||||
const container = customContainer || document.getElementById('workflow-container') || document.body
|
||||
const [localOpen, setLocalOpen] = useState(false)
|
||||
const open = controlledOpen ?? localOpen
|
||||
const handleOpenChange = useCallback((newOpen: boolean) => {
|
||||
|
|
@ -60,17 +56,9 @@ export function usePortalToFollowElem({
|
|||
flip({
|
||||
crossAxis: placement.includes('-'),
|
||||
fallbackAxisSideDirection: 'start',
|
||||
padding: 8,
|
||||
}),
|
||||
shift({
|
||||
padding: 8,
|
||||
boundary: container,
|
||||
altBoundary: true,
|
||||
}),
|
||||
hide({
|
||||
// hide when the reference element is not visible
|
||||
boundary: container,
|
||||
padding: 5,
|
||||
}),
|
||||
shift({ padding: 5 }),
|
||||
size({
|
||||
apply({ rects, elements }) {
|
||||
if (triggerPopupSameWidth)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ const ServiceApi = ({
|
|||
mainAxis: 4,
|
||||
crossAxis: -4,
|
||||
}}
|
||||
customContainer={document.body}
|
||||
>
|
||||
<PortalToFollowElemTrigger
|
||||
className='w-full'
|
||||
|
|
|
|||
Loading…
Reference in New Issue