import { util } from '../../util/util.js'
import {verify} from '../../util/verify.js'
import {base} from "./base.js";
class vCutChar  extends base{

    constructor(data) {
        super(data);
        this.title = data.label_name;
        this.eleID=util.getUUID();
        this.objID=this.eleID+'div';
        this.type='cutChar';
        this.isValue=false;
    }
    getObjID(){
        return this.objID;
    }
    render(renderParentID) {
        let data=this.data
        if(data.kind==undefined||data.kind=='default'){
            this.renderDefault(renderParentID);
        }
        if(data.kind=='custom'){
            this.renderCustom(renderParentID);
        }
    }
    renderDefault(renderParentID){
        let that=this;
        let htmlTemplate=`
        <div class="card mb-4"  id="${that.objID}div" style="display: none">
        <h6 class="card-header">${that.title}</h6>
        <div class="card-body" id="${that.objID}">
        </div></div>
        `;
        document.getElementById(renderParentID).insertAdjacentHTML("beforeEnd", htmlTemplate);
    }
    renderCustom(renderParentID){
        //虚拟字段 不需要任何操作
    }
    hide(){
        document.getElementById(this.objID+'div').setAttribute('style', 'display:none');//隐藏
    }
    show(){
        document.getElementById(this.objID+'div').setAttribute('style', '');//展示
    }
    setDisabled(){

    }
    removeDisabled(){

    }
    getValue(){

    }
    setValue(){

    }
    hideDiv(){
        let eleObj = document.getElementById(this.getObjID());
        eleObj.style.display='none';
        let eleObjDiv = document.getElementById(this.getObjID()+'div');
        eleObjDiv.style.display='none';
    }
    showDiv(){
        let eleObj = document.getElementById(this.getObjID());
        eleObj.style.display='';
        let eleObjDiv = document.getElementById(this.getObjID()+'div');
        eleObjDiv.style.display='';
    }
    refreshCanNull(){

    }
}
export { vCutChar }