feat(portal): add customContainer prop to PortalToFollowElem for flexible rendering

This commit is contained in:
twwu
2025-09-02 17:25:47 +08:00
parent 273dae6738
commit 00b5772012
5 changed files with 5 additions and 4 deletions

View File

@ -112,6 +112,7 @@ const DropDown = ({
} : {
mainAxis: 4,
}}
customContainer={document.body}
>
<PortalToFollowElemTrigger onClick={handleTrigger}>
<ActionButton className={cn(expand ? 'size-8 rounded-lg' : 'size-6 rounded-md')}>

View File

@ -31,6 +31,7 @@ export type PortalToFollowElemOptions = {
offset?: number | OffsetOptions
onOpenChange?: (open: boolean) => void
triggerPopupSameWidth?: boolean
customContainer?: HTMLElement | null
}
export function usePortalToFollowElem({
@ -39,8 +40,9 @@ export function usePortalToFollowElem({
offset: offsetValue = 0,
onOpenChange: setControlledOpen,
triggerPopupSameWidth,
customContainer = null,
}: PortalToFollowElemOptions = {}) {
const container = document.getElementById('workflow-container') || document.body
const container = customContainer || document.getElementById('workflow-container') || document.body
const [localOpen, setLocalOpen] = useState(false)
const open = controlledOpen ?? localOpen
const handleOpenChange = useCallback((newOpen: boolean) => {

View File

@ -49,7 +49,7 @@ const Operations = ({
onClick={onClickExport}
>
<span className='system-md-regular px-1 text-text-secondary'>
{t('datasetPipeline.operations.exportDSL')}
{t('datasetPipeline.operations.exportPipeline')}
</span>
</div>
</div>