import * as React from 'react';
import { createPortal } from 'react-dom';
import { DragOverlay } from '@dnd-kit/core';
import { ROW_HEIGHTS } from './constants';
/**
 * Portal wrapper: renders DragOverlay into document.body to escape
 * ancestors with `filter: blur(0px)` (e.g. cn-ui-page) which create
 * a containing block that breaks `position: fixed` overlay positioning.
 */
function PortaledDragOverlay({ children, ...props }) {
    return createPortal(React.createElement(DragOverlay, { ...props }, children), document.body);
}
/**
 * 列拖拽预览组件
 */
export const ColumnDragPreview = ({ active, width, height, modifier, }) => {
    return (React.createElement(PortaledDragOverlay, { modifiers: [modifier], dropAnimation: null }, active ? (React.createElement("div", { className: "ai-table-column-drag-preview", style: {
            width,
            height,
        } })) : null));
};
/**
 * 行拖拽预览组件
 */
export const RowDragPreview = ({ active, width, rowHeight, modifier, }) => {
    return (React.createElement(PortaledDragOverlay, { modifiers: [modifier], dropAnimation: null }, active ? (React.createElement("div", { className: "ai-table-row-drag-preview", style: {
            width,
            height: ROW_HEIGHTS[rowHeight],
        } })) : null));
};
