import React from 'react'; import PropTypes from 'prop-types'; import ls from './Window.less' import Fa from "./Fa"; export default class Window extends React.Component { constructor({initWidth, initLeft, initTop}) { super(); this.state = { width: initWidth, left: initLeft, top: initTop } } render() { let {initWidth, initLeft, initTop, children, title, minimizable, onClose, ...props} = this.props; return
{title.toUpperCase()}
{minimizable && _}
{children}
} getStyle() { return { width: this.state.width, height: this.state.height, left: this.state.left, top: this.state.top, zIndex: 1 } } componentDidMount() { if (this.props.onFocus) { this.props.onFocus(this.el); } else { this.el.focus(); } } keepRef = el => this.el = el; } Window.defaultProps = { minimizable: false, };