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>

View File

@ -18,7 +18,6 @@ const translation = {
choose: 'Choose',
details: 'Details',
editInfo: 'Edit info',
exportDSL: 'Export DSL',
useTemplate: 'Use this Knowledge Pipeline',
backToDataSource: 'Back to Data Source',
process: 'Process',

View File

@ -18,7 +18,6 @@ const translation = {
choose: '选择',
details: '详情',
editInfo: '编辑信息',
exportDSL: '导出 DSL',
useTemplate: '使用此知识流水线',
backToDataSource: '返回数据源',
process: '处理',