|
|
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
import '../../assets/FixedBox/index.less';
|
|
|
import renders from '../../app/utils/RenderUtils.js';
|
|
|
|
|
|
-export default class Form extends React.Component {
|
|
|
+export default class FixedBox extends React.Component {
|
|
|
static propTypes = {
|
|
|
render: PropTypes.string,
|
|
|
state: PropTypes.object,
|
|
|
@@ -19,7 +19,7 @@ export default class Form extends React.Component {
|
|
|
prefixCls: 'rc-fixedbox',
|
|
|
cls: '',
|
|
|
titleHeight: 55,
|
|
|
- layout: { x: 0, y: 0 }
|
|
|
+ layout: { x: 0, y: 0, w:0, h:0 }
|
|
|
}
|
|
|
|
|
|
constructor(props) {
|
|
|
@@ -33,15 +33,12 @@ export default class Form extends React.Component {
|
|
|
|
|
|
getTop(y) {
|
|
|
let { titleHeight } = this.props;
|
|
|
- let screenHeight = window.innerHeight;
|
|
|
- let contentHeight = screenHeight - titleHeight;
|
|
|
- let top = contentHeight * (y / 10);
|
|
|
- return top + titleHeight;
|
|
|
+ let height = this.getHeight(y);
|
|
|
+ return height + titleHeight;
|
|
|
}
|
|
|
|
|
|
getLeft(x) {
|
|
|
- let screenWidth = window.innerWidth;
|
|
|
- let left = screenWidth * (x / 10);
|
|
|
+ let left = this.getWidth(x);
|
|
|
return left;
|
|
|
}
|
|
|
|
|
|
@@ -62,13 +59,13 @@ export default class Form extends React.Component {
|
|
|
getContent() {
|
|
|
const {config} = this.state;
|
|
|
let {render, cls, style} = config;
|
|
|
- let className = ' ' + cls;
|
|
|
+ Object.assign(style, {height: '100%', width: '100%'});
|
|
|
|
|
|
let tel;
|
|
|
if (renders[render]) {
|
|
|
- tel = <div className={className} style={style}>{renders[render]()}</div>;
|
|
|
+ tel = <div className={cls} style={style}>{renders[render]()}</div>;
|
|
|
}else {
|
|
|
- tel = <div className={className} style={style}>{render}</div>;
|
|
|
+ tel = <div className={cls} style={style}>{render}</div>;
|
|
|
}
|
|
|
return tel;
|
|
|
}
|
|
|
@@ -77,7 +74,7 @@ export default class Form extends React.Component {
|
|
|
}
|
|
|
|
|
|
componentWillReceiveProps(nextProps) {
|
|
|
- this.setState(nextProps);
|
|
|
+ this.setState({...nextProps});
|
|
|
}
|
|
|
|
|
|
componentDidUpdate(prevProps) {
|