UNPKG

shineout

Version:

Shein 前端组件库

60 lines (50 loc) 1.83 kB
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose"; import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; import React, { PureComponent } from 'react'; import classnames from 'classnames'; import List from '../AnimationList'; import { tabsClass } from './styles'; var CollapseList = List(['collapse'], 'fast'); var Panel = /*#__PURE__*/ function (_PureComponent) { _inheritsLoose(Panel, _PureComponent); function Panel(props) { var _this; _this = _PureComponent.call(this, props) || this; _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "isPristine", void 0); _this.isPristine = true; return _this; } var _proto = Panel.prototype; _proto.render = function render() { var _this$props = this.props, children = _this$props.children, background = _this$props.background, color = _this$props.color, isActive = _this$props.isActive, collapsible = _this$props.collapsible, collapsed = _this$props.collapsed, lazy = _this$props.lazy; if (!isActive && this.isPristine && lazy) return null; this.isPristine = false; var style = Object.assign({ background: background || '#fff', color: color }, this.props.style); var className = classnames(tabsClass('panel', isActive && 'show'), this.props.className); var result = React.createElement("div", { style: style, className: className }, children); if (!collapsible) return result; return React.createElement(CollapseList, { show: !collapsed }, result); }; return Panel; }(PureComponent); _defineProperty(Panel, "isTabPanel", void 0); Panel.isTabPanel = true; export default Panel;