package com.mortals.xhx.common.pdu.gen.component;

import com.mortals.xhx.common.code.ComponentEnum;
import com.mortals.xhx.common.pdu.gen.*;

import java.util.ArrayList;

/**
 * 输入框组件
 *
 * @author: zxfei
 * @date: 2021/10/26 10:35
 * @description:
 **/
public class InputComponent extends Component {

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

    @Override
    public FieldsItem buildDefaultComponent(ComponentCons cons) {
        FieldsItem fieldsItem = new FieldsItem();
        Config config = new Config();
        config.setLabel("");
        config.setLabelWidth("");
        config.setShowLabel(true);
        config.setChangeTag(true);
        config.setTag("el-input");
        config.setTagIcon("inuput");
        config.setRequired(true);
        config.setLayout("colFormItem");
        config.setDocument("https://element.eleme.cn/#/zh-CN/component/input");
        config.setRegList(new ArrayList<>());
        config.setSpan(12);
        fieldsItem.setConfig(config);

        Slot slot = new Slot();
        slot.setPrepend("");
        slot.setAppend("");
        fieldsItem.setSlot(slot);

        Style style = new Style();
        style.setWidth("100%");
        fieldsItem.setStyle(style);

        fieldsItem.setClearable(true);
        fieldsItem.setPrefixIcon("");
        fieldsItem.setSuffixIcon("");
        fieldsItem.setMaxlength(null);
        fieldsItem.setShowWordLimit(false);
        fieldsItem.setReadonly(false);
        fieldsItem.setDisabled(false);
        fieldsItem.setVModel("reson");

        return fieldsItem;
    }

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