UNPKG

@up-group-ui/react-controls

Version:
38 lines 1.84 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var jsx_runtime_1 = require("react/jsx-runtime"); var react_1 = (0, tslib_1.__importDefault)(require("react")); var HorizontalLines = (function (_super) { (0, tslib_1.__extends)(HorizontalLines, _super); function HorizontalLines() { return _super !== null && _super.apply(this, arguments) || this; } HorizontalLines.prototype.shouldComponentUpdate = function (nextProps, nextState) { return !(nextProps.canvasWidth === this.props.canvasWidth && nextProps.lineHeight === this.props.lineHeight && nextProps.lineCount === this.props.lineCount && nextProps.groupHeights === this.props.groupHeights); }; HorizontalLines.prototype.render = function () { var _a = this.props, lineCount = _a.lineCount, canvasWidth = _a.canvasWidth, groupHeights = _a.groupHeights, headerHeight = _a.headerHeight; var lines = []; var totalHeight = headerHeight; for (var i = 0; i < lineCount; i++) { lines.push((0, jsx_runtime_1.jsx)("div", { className: i % 2 === 0 ? 'rct-hl-even' : 'rct-hl-odd', style: { top: totalHeight + "px", left: '0px', width: canvasWidth + "px", height: groupHeights[i] - 1 + "px", } }, "horizontal-line-" + i)); totalHeight += groupHeights[i]; } return (0, jsx_runtime_1.jsx)("div", (0, tslib_1.__assign)({ className: "rct-horizontal-lines" }, { children: lines }), void 0); }; HorizontalLines.defaultProps = { borderWidth: 1, }; return HorizontalLines; }(react_1.default.Component)); exports.default = HorizontalLines; //# sourceMappingURL=HorizontalLines.js.map