package com.mortals.xhx.common.formdesign.component;

import cn.hutool.core.util.IdUtil;
import com.google.common.collect.Lists;
import com.mortals.xhx.common.code.ComponentEnum;
import com.mortals.xhx.common.formdesign.ColumnsItem;
import com.mortals.xhx.common.formdesign.DesignComponent;
import com.mortals.xhx.common.formdesign.ListItem;
import com.mortals.xhx.common.pdu.gen.*;
import com.mortals.xhx.common.pdu.gen.component.ComponentCons;

/**
 * 按钮组件
 *
 * @author: zxfei
 * @date: 2021/10/26 10:35
 * @description:
 **/
public class DesignButtonComponent extends DesignComponent {

    public DesignButtonComponent(String type) {
        super(type);
    }

    @Override
    public ListItem buildDefaultComponent(ComponentCons cons) {
        ListItem columnsItem = new ListItem();
        columnsItem.setId(cons.getVal());
        columnsItem.set_id(cons.getVal());
        columnsItem.setCompType("button");
        columnsItem.setCompName(cons.getLabel());
        columnsItem.setCompIcon("button");
        columnsItem.setEle("el-button");
        columnsItem.setViewType("component");
        columnsItem.setConfig(true);
        columnsItem.setShowLabel(true);
        columnsItem.setLabel(cons.getLabel());
        columnsItem.setLabelWidth(120);
        columnsItem.setType("primary");
        columnsItem.setText("按钮");
        columnsItem.setPlain(true);
        columnsItem.setRound(false);
        columnsItem.setCircle(false);
        columnsItem.setLoading(false);
        columnsItem.setLayout("colItem");
        return columnsItem;
    }

    @Override
    public String getType() {
        return ComponentEnum.BUTTON.getValue();
    }
}
