UNPKG

choerodon-ui

Version:

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

121 lines (103 loc) 3.95 kB
import _extends from "@babel/runtime/helpers/extends"; import _objectSpread from "@babel/runtime/helpers/objectSpread2"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; 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); }; } // @ts-nocheck import * as React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { defaultClassPrefix, getUnhandledProps, prefix } from './utils'; import TableContext from './TableContext'; var Row = /*#__PURE__*/ function (_React$PureComponent) { _inherits(Row, _React$PureComponent); var _super = _createSuper(Row); function Row() { _classCallCheck(this, Row); return _super.apply(this, arguments); } _createClass(Row, [{ key: "render", value: function render() { var _this$props = this.props, className = _this$props.className, width = _this$props.width, height = _this$props.height, top = _this$props.top, style = _this$props.style, isHeaderRow = _this$props.isHeaderRow, headerHeight = _this$props.headerHeight, rowRef = _this$props.rowRef, classPrefix = _this$props.classPrefix, children = _this$props.children, rest = _objectWithoutProperties(_this$props, ["className", "width", "height", "top", "style", "isHeaderRow", "headerHeight", "rowRef", "classPrefix", "children"]); var addPrefix = prefix(classPrefix); var classes = classNames(classPrefix, className, _defineProperty({}, addPrefix('header'), isHeaderRow)); var styles = _objectSpread({ minWidth: width, height: isHeaderRow ? headerHeight : height }, style); var unhandledProps = getUnhandledProps(Row, rest); return React.createElement(TableContext.Consumer, null, function (_ref) { var translateDOMPositionXY = _ref.translateDOMPositionXY; translateDOMPositionXY === null || translateDOMPositionXY === void 0 ? void 0 : translateDOMPositionXY(styles, 0, top); return React.createElement("div", _extends({ role: "row" }, unhandledProps, { ref: rowRef, className: classes, style: styles }), children); }); } }]); return Row; }(React.PureComponent); Row.propTypes = { width: PropTypes.number, height: PropTypes.number, headerHeight: PropTypes.number, top: PropTypes.number, isHeaderRow: PropTypes.bool, rowRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), className: PropTypes.string, classPrefix: PropTypes.string, style: PropTypes.object }; Row.defaultProps = { classPrefix: defaultClassPrefix('performance-table-row'), height: 46, headerHeight: 40 }; export default Row; //# sourceMappingURL=Row.js.map