import designerInfo from '@/config/designer';
import common from "@/utils/common"

const label = 'reportDesigner.replenish';
const name = 'replenish';
const category = 2;//0-表示默认基础组件，1-表示报告组件；2-布局组件
export default {
    initData: function(flag){
        var commonId = common.guid();
        //组件一级对象
        var obj = {
            icon: 'icon-space',
            label,
            id: commonId,
            name,
            category: category,
            disabledMove: false,
            displayContentList: [],
            //二级对象,用来封装属性和样式
            data: {},
            result: {}
        };
        if (flag)
        {
            obj.data = this.props();
            obj.result = this.finals();

            var divider = designerInfo.initAppointModule('divider');
            divider.result.parentId = commonId;
            divider.result.parentName = name;
            divider.result.pattern.borderWeight=1.5;
            obj.result.tasks.push(divider);
    
            var labelName = designerInfo.initAppointModule('label');
            labelName.result.parentId = commonId;
            labelName.result.parentName = name;
            labelName.result.pattern.horizontalAlignment = "Left";
            labelName.result.pattern.width = 0;
            labelName.result.property.placeholder = "reportDesigner.AdditionalRemarksContent";
            obj.result.tasks.push(labelName);
        }
        return obj;
    },
    props: function() {
        return {
            //特殊样式
            specialStyle: [ 
                {icon: "", title: 'reportDesigner.AlignLeft', type: "left", sort: 10, value: false, show: true, group: "horizontalAlignment"},
                {icon: "", title: 'reportDesigner.AlignCenter', type: "center", sort: 11, value: false, show: true, group: "horizontalAlignment"},
                {icon: "", title: 'reportDesigner.AlignRight', type: "right", sort: 12, value: false, show: true, group: "horizontalAlignment"},
                {icon: "", title: 'reportDesigner.Justify', type: "bothends", sort: 13, value: false, show: true, group: "horizontalAlignment"}
            ],
            //样式
            pattern: [
                {
                    type: 'input', field: 'interval', title: 'reportDesigner.interval', require: false, value: '1', unit: "mm"
                }, 
            ],
            //属性
            property: {
                contentSet:[],
                formatSet:[
                    {type: 'switch', field: 'isHidden', title: 'reportDesigner.hidden', require: false, value: '0', unit: "", rules:[], labelWidth:"270px"}, 
                ]
            }
        }
    },
    finals: function(){
        return {
            //父组件id
            parentId: "",
            parentName: "",
            tasks: [],
            //占位符
            space: "",
            offsetWidth: 0,
            offsetHeight: 40,
            //样式，每个组件可根据自身特点进行增减
            pattern: {
                //Left,Right,Center,Bothends
                horizontalAlignment:"",
                //间隔
                interval:1//单位mm
            },
            //属性，每个组件可根据自身特点进行增减
            property: {
                //是否隐藏
                isHidden: false,
            },
            //位置坐标
            margin: {
                sort: 0,
                //0-表示absolute;1-relative
                position: 0,
                //如果采用相对定位，则需要填写上一个组件的组件id
                previousId:"",
                top: 0.0,
                bottom: 0.0,
                left: 0.0,
                right: 0.0,
            }
        }
    }
}