UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

107 lines (85 loc) 2.85 kB
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _inherits from "@babel/runtime/helpers/inherits"; import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; function _createSuper(Derived) { function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } return function () { var Super = _getPrototypeOf(Derived), result; if (isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } import * as React from 'react'; import classNames from 'classnames'; var Paragraph = /*#__PURE__*/ function (_React$Component) { _inherits(Paragraph, _React$Component); var _super = _createSuper(Paragraph); function Paragraph() { _classCallCheck(this, Paragraph); return _super.apply(this, arguments); } _createClass(Paragraph, [{ key: "getWidth", value: function getWidth(index) { var _this$props = this.props, width = _this$props.width, _this$props$rows = _this$props.rows, rows = _this$props$rows === void 0 ? 2 : _this$props$rows; if (Array.isArray(width)) { return width[index]; } // last paragraph if (rows - 1 === index) { return width; } return undefined; } }, { key: "render", value: function render() { var _this = this; var _this$props2 = this.props, prefixCls = _this$props2.prefixCls, className = _this$props2.className, style = _this$props2.style, rows = _this$props2.rows; var rowList = _toConsumableArray(Array(rows)).map(function (_, index) { return (// eslint-disable-next-line react/no-array-index-key React.createElement("li", { key: index, style: { width: _this.getWidth(index) } }) ); }); return React.createElement("ul", { className: classNames(prefixCls, className), style: style }, rowList); } }]); return Paragraph; }(React.Component); export default Paragraph; //# sourceMappingURL=Paragraph.js.map