UNPKG

@atlaskit/editor-plugin-table

Version:

Table plugin for the @atlaskit/editor

42 lines 1.77 kB
import React, { useRef } from 'react'; import { TableCssClassName as ClassName } from '../../../types'; import { ColumnDropTarget } from './ColumnDropTarget'; export var ColumnDropTargets = function ColumnDropTargets(_ref) { var tableRef = _ref.tableRef, tableHeight = _ref.tableHeight, localId = _ref.localId, colWidths = _ref.colWidths, isHeaderSticky = _ref.isHeaderSticky, getScrollOffset = _ref.getScrollOffset; var dropTargetRef = useRef(null); if (!tableRef) { return null; } if (isHeaderSticky && dropTargetRef.current) { var _getScrollOffset; dropTargetRef.current.style.marginLeft = "-".concat((_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(function (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 }); }))); };