import React, { useMemo, useState, useContext } from 'react' import classnames from 'classnames' import { Draggable } from "react-beautiful-dnd"; import { RowContext, TableContext } from './context' import { setStyle, getListRange } from './_utils' const getPrefixCls = (cls) => 'gant-' + cls; const BodyRow = ({ isDeleted, rowIndex, className, sortable, children, originRecord, ...props }) => { const rowData = useMemo(() => ({ dataRowKey: props['data-row-key'], originRecord }), [props]) const { outlineNum, thresholdInner, renderRowKeys, virtualScroll, } = useContext(TableContext) const style = useMemo(() => { const s = { ...(props.style || {}) } if (virtualScroll) { const keysRange = getListRange(renderRowKeys, outlineNum, thresholdInner) if (!keysRange.includes(rowData.dataRowKey)) { return { ...s, display: 'none' } } } return s }, [props.style, rowData]) const [trRef, setTrRef] = useState(null) const row = useMemo(() => { // 非拖动排序 if (!sortable) { return (