@atlaskit/editor-core
Version:
A package contains Atlassian editor core functionality
32 lines • 1.72 kB
JavaScript
import * as tslib_1 from "tslib";
import * as React from 'react';
import { Component } from 'react';
import { toolbarSize } from '../styles';
import { ColumnContainer, ColumnInner, ColumnControlsButtonWrap, HeaderButton, } from './styles';
import InsertColumnButton from './InsertColumnButton';
var ColumnControls = (function (_super) {
tslib_1.__extends(ColumnControls, _super);
function ColumnControls() {
return _super !== null && _super.apply(this, arguments) || this;
}
ColumnControls.prototype.render = function () {
var _this = this;
var cols = this.props.tableElement.querySelector('tr').children;
var nodes = [];
var tableHeight = this.props.tableElement.offsetHeight;
var _loop_1 = function (i, len) {
nodes.push(React.createElement(ColumnControlsButtonWrap, { key: i, className: this_1.props.isSelected(i) ? 'active' : '', style: { width: cols[i].offsetWidth + 1 } },
React.createElement(HeaderButton, { onClick: function () { return _this.props.selectColumn(i); }, onMouseOver: function () { return _this.props.hoverColumn(i); }, onMouseOut: this_1.props.resetHoverSelection }),
React.createElement(InsertColumnButton, { insertColumn: this_1.props.insertColumn, index: i + 1, lineMarkerHeight: tableHeight + toolbarSize })));
};
var this_1 = this;
for (var i = 0, len = cols.length; i < len; i++) {
_loop_1(i, len);
}
return (React.createElement(ColumnContainer, null,
React.createElement(ColumnInner, null, nodes)));
};
return ColumnControls;
}(Component));
export default ColumnControls;
//# sourceMappingURL=index.js.map