UNPKG

@atlaskit/editor-plugin-table

Version:

Table plugin for the @atlaskit/editor

43 lines 1.61 kB
import React, { useRef } from 'react'; import { TableCssClassName as ClassName } from '../../../types'; import { ColumnDropTarget } from './ColumnDropTarget'; export const ColumnDropTargets = ({ tableRef, tableHeight, localId, colWidths, isHeaderSticky, getScrollOffset }) => { const dropTargetRef = useRef(null); if (!tableRef) { return null; } if (isHeaderSticky && dropTargetRef.current) { var _getScrollOffset; dropTargetRef.current.style.marginLeft = `-${(_getScrollOffset = getScrollOffset === null || getScrollOffset === void 0 ? void 0 : getScrollOffset()) !== null && _getScrollOffset !== void 0 ? _getScrollOffset : 0}px`; } return /*#__PURE__*/React.createElement("div", { ref: dropTargetRef // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766 , className: ClassName.DRAG_COLUMN_DROP_TARGET_CONTROLS, contentEditable: false }, /*#__PURE__*/React.createElement("div", { // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766 className: ClassName.DRAG_COLUMN_CONTROLS_INNER, "data-testid": "table-floating-column-controls-drop-targets" }, colWidths === null || colWidths === void 0 ? void 0 : colWidths.map((width, index) => { return /*#__PURE__*/React.createElement(ColumnDropTarget // Ignored via go/ees005 // eslint-disable-next-line react/no-array-index-key , { key: index, index: index, localId: localId, width: width, height: tableHeight, marginTop: 0 }); }))); };