UNPKG

@atlaskit/editor-core

Version:

A package contains Atlassian editor core functionality

32 lines 1.66 kB
import * as tslib_1 from "tslib"; import * as React from 'react'; import { Component } from 'react'; import { toolbarSize } from '../styles'; import { RowInner, RowContainer, RowControlsButtonWrap, HeaderButton, } from './styles'; import InsertRowButton from './InsertRowButton'; var RowControls = (function (_super) { tslib_1.__extends(RowControls, _super); function RowControls() { return _super !== null && _super.apply(this, arguments) || this; } RowControls.prototype.render = function () { var _this = this; var rows = this.props.tableElement.querySelector('tbody').children; var nodes = []; var tableWidth = this.props.tableElement.offsetWidth; var _loop_1 = function (i, len) { nodes.push(React.createElement(RowControlsButtonWrap, { key: i, className: this_1.props.isSelected(i) ? 'active' : '', style: { height: rows[i].offsetHeight + 1 } }, React.createElement(HeaderButton, { onClick: function () { return _this.props.selectRow(i); }, onMouseOver: function () { return _this.props.hoverRow(i); }, onMouseOut: this_1.props.resetHoverSelection }), React.createElement(InsertRowButton, { insertRow: this_1.props.insertRow, index: i + 1, lineMarkerWidth: tableWidth + toolbarSize }))); }; var this_1 = this; for (var i = 0, len = rows.length; i < len; i++) { _loop_1(i, len); } return (React.createElement(RowContainer, null, React.createElement(RowInner, null, nodes))); }; return RowControls; }(Component)); export default RowControls; //# sourceMappingURL=index.js.map