package com.bohuikeji.frame.module.admin.entity.web.block;


import com.bohuikeji.frame.module.admin.annotation.TableNewField;
import com.bohuikeji.frame.module.admin.base.EntityBase;
import com.bohuikeji.frame.module.admin.base.HtmlBlockFormBase;
import com.bohuikeji.frame.module.admin.entity.configure.BaseInputAn;
import com.bohuikeji.frame.module.admin.entity.configure.FieldConf;
import lombok.Data;

import java.lang.reflect.Field;

/**
 * 单行输入元素块
 * @author 10552
 */
@Data
public class InputBlock extends HtmlBlockFormBase<InputBlock> {
    public InputBlock(Field field, EntityBase entity){
       super(field,entity);
        TableNewField tableNewField=field.getAnnotation(TableNewField.class);
        /**
         * 设置正则表达式
         */
        if(tableNewField!=null){
            this.limit=tableNewField.limit();
        }
    }
    public InputBlock(FieldConf fieldConf, BaseInputAn inputAn){
        super(fieldConf,inputAn);
        this.limit=inputAn.getRegEx();
    }

    /**
     * 输入提示
     */
    private String placeholder;
    /**
     * 最大输入字符
     */
    private int maxlength=100;
    /**
     * 正则表达式
     */
    private String limit="";

}
