/** * Created by guopeng on 16/7/5. * 边距块 * */ import * as React from "react"; import {Unit, UnitType} from "../../../drawing/Unit"; import {Report as ReportModel, Report} from "../../../items/Report"; import {DesignerHost} from "../../DesignerHost"; import {RULE_WIDTH} from "./consts"; import {ReportRootDesigner} from "../../designer/ReportRootDesigner"; class MarginBlock extends React.Component<{}, {}> { private _direction: string; protected ruleModel; constructor(props, context) { super(props, context); this.ruleModel = props.ruleModel; } get reportDesigner(): ReportRootDesigner { return DesignerHost.instance().designReport; } get reportModel():Report { return this.reportDesigner.report; } getStyles(): any { let styles = { position: "absolute", backgroundColor: "#F2F2F2", opacity: "0.9" }; if (this._direction === "horizon") { styles["height"] = RULE_WIDTH; } else { styles["width"] = RULE_WIDTH; } return { root: styles }; } set direction(direction: string) { this._direction = direction; } } export default MarginBlock;