/** * 根据jasper的属性定义, 整理出符合我们自己的属性集合 * Created by TonyJiang on 16/8/9. */ import {Property} from "./Property"; import {RectF, RectUnit, PointUnit, SizeUnit, Unit, UnitType} from "../../drawing/Unit"; import { LineStyleEnum, HorizontalTextAlignEnum, HorizontalTextAlignEnumLabel, VerticalTextAlignEnum, VerticalTextAlignEnumLabel, PositionTypeEnum, StretchTypeEnum, ModeEnum, SplitTypeEnum, ScaleImageEnum } from "../../items/properties/enums"; import {RotationEnum, LineDirection} from "../../configs/enums"; import {Stroke} from "./classes/Stroke"; import {Font} from "./classes/Font"; import {FontStyle} from "./FontStyle"; import {Border} from "./classes/Border"; import {Padding} from "./classes/Padding"; import {Size} from "./classes/Size"; import {Position} from "./classes/Position"; import {PaperSettings} from "../../drawing/PaperSettings"; import {PaperEditor} from '../../design/ui/property-editor/PaperEditor/PaperEditor'; import {SpinnerEditor} from "../../design/ui/property-editor/SpinnerEditor/SpinnerEditor"; import {UnitSpinnerEditor} from "../../design/ui/property-editor/SpinnerEditor/UnitSpinnerEditor"; import {ColorEditor} from "../../design/ui/property-editor/ColorEditor"; import {AlignEditor} from "../../design/ui/property-editor/AlignEditor/AlignEditor"; import {VAlignEditor} from "../../design/ui/property-editor/AlignEditor/VAlignEditor"; import {HAlignEditor} from "../../design/ui/property-editor/AlignEditor/HAlignEditor"; import {SelectEditor} from "../../design/ui/property-editor/SelectEditor/SelectEditor"; import {FontEditor} from "../../design/ui/property-editor/FontEditor/FontEditor"; import {BorderEditor} from "../../design/ui/property-editor/BorderEditor/BorderEditor"; import {BorderStyleEditor} from "../../design/ui/property-editor/SelectEditor/BorderStyleEditor"; import {StrokeEditor} from "../../design/ui/property-editor/StrokeEditor/StrokeEditor"; import {PaddingEditor} from "../../design/ui/property-editor/PaddingEditor/PaddingEditor"; import {SizeEditor} from "../../design/ui/property-editor/SizeEditor/SizeEditor"; import {PositionEditor} from "../../design/ui/property-editor/PositionEditor/PositionEditor"; import {PaperMarginEditor} from "../../design/ui/property-editor/PaperMarginEditor"; import {ImageUrlEditor} from "../../design/ui/property-editor/ImageUrlEditor/ImageUrlEditor"; import {TextFieldEditor} from "../../design/ui/property-editor/TextFieldEditor"; const transparentColor = 'rgba(255, 255, 255, 0)'; const whiteColor = 'rgba(255, 255, 255, 1)'; const blackColor = 'rgba(0, 0, 0, 1)'; // --------- Report属性 --------- export const ReportProperty = { name: new Property("name", "", "名称"), language: new Property("language", null, "语言"), printOrder: new Property("printOrder", null, "打印方向"), orientation: new Property("orientation", null), paper: new Property('paper', null, '纸张类型', PaperEditor), paperKind: PaperSettings.PaperKindProperty, paperWidth: PaperSettings.PaperWidthProperty, paperHeight: PaperSettings.PaperHeightProperty, margin: new Property('margin', null, '边距', PaperMarginEditor), topMargin: new Property("topMargin", Unit.Empty, "上边距", UnitSpinnerEditor), leftMargin: new Property("leftMargin", Unit.Empty, "左边距", UnitSpinnerEditor), bottomMargin: new Property("bottomMargin", Unit.Empty, "下边距", UnitSpinnerEditor), rightMargin: new Property("rightMargin", Unit.Empty, "右边距", UnitSpinnerEditor), }; // --------- Band属性 --------- export const BandProperty = { height: new Property("height", Unit.Empty, "高度", UnitSpinnerEditor), isSplitAllowed: new Property("isSplitAllowed", null), splitType: new Property("splitType", SplitTypeEnum.Stretch) }; // --------- 通用属性 --------- export const CommonProperty = { position: new Property("position", new Position(Unit.Empty, Unit.Empty), "坐标", PositionEditor), size: new Property("size", new Size(Unit.Empty, Unit.Empty), "尺寸", SizeEditor), x: new Property("x", Unit.Empty, "左", UnitSpinnerEditor), y: new Property("y", Unit.Empty, "上", UnitSpinnerEditor), width: new Property("width", 0, "宽度", UnitSpinnerEditor), height: new Property("height", Unit.Empty, "高度", UnitSpinnerEditor), foreColor: new Property("foreColor", blackColor, "前景色", ColorEditor), backColor: new Property("backColor", transparentColor, "背景色", ColorEditor), opaque: new Property("opaque", true, "背景透明"), }; // --------- 打印属性 --------- export const PrintProperty = { positionType: new Property("positionType", PositionTypeEnum.FixRelativeToTop), stretchType: new Property("stretchType", StretchTypeEnum.NoStretch), isPrintRepeatedValues: new Property("isPrintRepeatedValues", true), isRemoveLineWhenBlank: new Property("isRemoveLineWhenBlank", false), isPrintInFirstWholeBand: new Property("isPrintInFirstWholeBand", false), isPrintWhenDetailOverflows: new Property("isPrintWhenDetailOverflows", false) }; // --------- 图形属性 --------- export const GraphProperty = { fill: new Property("fill", transparentColor, "填充色", ColorEditor), rotation: new Property("rotation", null, "旋转"), stroke: new Property("stroke", () => new Stroke(), "线条", StrokeEditor), lineWidth: new Property("lineWidth", () => new Unit(1), "线条宽度", SpinnerEditor), lineStyle: new Property("lineStyle", LineStyleEnum.Solid, "线条类型", BorderStyleEditor), lineColor: new Property("lineColor", blackColor, "线条颜色", ColorEditor), }; // --------- 线条属性 --------- const LineDirectionEnumLabel: any = new Map(); LineDirectionEnumLabel.set(LineDirection.EW, '水平'); LineDirectionEnumLabel.set(LineDirection.NS, '垂直'); LineDirectionEnumLabel.set(LineDirection.NWSE, '左上到右下'); LineDirectionEnumLabel.set(LineDirection.NESW, '右上到右左'); export const LineShapeProperty = { lineDirection: new Property('lineDirection', LineDirection.EW, '方向', SelectEditor, LineDirectionEnumLabel), }; // --------- 矩形属性 --------- export const RectangleProperty = { radius: new Property("radius", Unit.Empty, "圆角", SpinnerEditor), }; // --------- 带有边框元素属性 --------- export const BoxProperty = { border: new Property("border", () => new Border(), "边框", BorderEditor), // topLineWidth: new Property("topLineWidth", new Unit(1)), // topLineStyle: new Property("topLineStyle", LineStyleEnum.Solid), // topLineColor: new Property("topLineColor", "black"), // // leftLineWidth: new Property("leftLineWidth", new Unit(1)), // leftLineStyle: new Property("leftLineStyle", LineStyleEnum.Solid), // leftLineColor: new Property("leftLineColor", "black"), // // bottomLineWidth: new Property("bottomLineWidth", new Unit(1)), // bottomLineStyle: new Property("bottomLineStyle", LineStyleEnum.Solid), // bottomLineColor: new Property("bottomLineColor", "black"), // // rightLineWidth: new Property("rightLineWidth", new Unit(1)), // rightLineStyle: new Property("rightLineStyle", LineStyleEnum.Solid), // rightLineColor: new Property("rightLineColor", "black"), padding: new Property("padding", () => new Padding(), "边距", PaddingEditor), // topPadding: new Property("topPadding", Unit.pixel(0), "上边距", UnitSpinnerEditor), // leftPadding: new Property("leftPadding", Unit.pixel(0), "左边距", UnitSpinnerEditor), // bottomPadding: new Property("bottomPadding", Unit.pixel(0), "下边距", UnitSpinnerEditor), // rightPadding: new Property("rightPadding", Unit.pixel(0), "右边距", UnitSpinnerEditor) }; // --------- 文本属性 --------- export const TextProperty = { //common text: new Property("text", "", "文本内容", TextFieldEditor), textColor: CommonProperty.foreColor, align: new Property('align', null, '对齐', AlignEditor), hAlign: new Property("hAlign", HorizontalTextAlignEnum.Left, "文本水平对齐", HAlignEditor), vAlign: new Property("vAlign", VerticalTextAlignEnum.Top, "文本垂直对齐", VAlignEditor), rotation: new Property("rotation", RotationEnum.None), //font font: new Property("font", () => new Font(), "字体", FontEditor), // fontName: new Property("fontName", "宋体", "字体", FontEditor), // fontSize: new Property("fontSize", new Unit(12, UnitType.Pixel), "字体大小", SpinnerEditor), // fontStyle: new Property("fontStyle", new FontStyle(), "字体样式", FontStyleEditor), // isBold: new Property("isBold", false, "加粗", FontBoldEditor), // isItalic: new Property("isItalic", false), // isUnderline: new Property("isUnderline", false), // isStrikeThrough: new Property("isStrikeThrough", false), //paragraph lineSpacing: new Property("lineSpacing", null), lineSpacingSize: new Property("lineSpacingSize", null), firstLineIndent: new Property("firstLineIndent", null), leftIndent: new Property("leftIndent", null), rightIndent: new Property("rightIndent", null), spacingBefore: new Property("spacingBefore", null), spacingAfter: new Property("spacingAfter", null), tabStopWidth: new Property("tabStopWidth", null), }; // --------- 图片属性 --------- export const ImageProperty = { src: new Property("value", null, "图片地址", ImageUrlEditor), isLazy: new Property("isLazy", null, "启用懒加载"), scaleImage: new Property("scaleImage", ScaleImageEnum.RetainShape, "缩放"), align: new Property('align', null, '对齐', AlignEditor), hAlign: new Property("hAlign", HorizontalTextAlignEnum.Left, "水平对齐"), vAlign: new Property("vAlign", VerticalTextAlignEnum.Top, "垂直对齐"), isUsingCache: new Property("isUsingCache", null, "启用缓存"), hyperlinkType: new Property("hyperlinkType", null, "链接类型"), hyperlinkTarget: new Property("hyperlinkTarget", null, "链接地址") }; // --------- DataTable属性 --------- export const DataTableProperty = { borderColor: new Property("borderColor", "rgba(100, 149, 237, 0.5)", "边框颜色", ColorEditor) }; // --------- DataTable单元格属性 --------- export const DataTableCellProperty = { text: new Property("text", "", "文本内容", TextFieldEditor), font: new Property("font", () => new Font(), "字体", FontEditor), border: new Property("border", () => new Border(), "边框", BorderEditor), x: new Property("x", Unit.Empty, "X坐标", UnitSpinnerEditor), y: new Property("y", Unit.Empty, "Y坐标", UnitSpinnerEditor), width: new Property("width", 0, "列宽", UnitSpinnerEditor), height: new Property("height", Unit.Empty, "行高", UnitSpinnerEditor), textColor: new Property("foreColor", blackColor, "文本颜色", ColorEditor), backColor: new Property("backColor", whiteColor, "背景颜色", ColorEditor), align: new Property('align', null, '对齐', AlignEditor), hAlign: new Property("hAlign", HorizontalTextAlignEnum.Right, "水平对齐", HAlignEditor), vAlign: new Property("vAlign", VerticalTextAlignEnum.Middle, "垂直对齐", VAlignEditor) };