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

    constructor(data) {
        super(data);
        this.title = data.label_name;
        this.eleID=util.getUUID();
        this.objID=this.eleID+'div';
        this.type='cutCharTitle';
        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="container-fluid flex-grow-1" id="${that.objID}div">
            ${that.data.cut_char_title_is_header_hr=='Y'?'<hr class="border-light container-m--x my-3">':''}
            <div id="${that.objID}">
                <${that.data.cut_char_title_h==''?'h3':that.data.cut_char_title_h} class="col-sm-12">${that.title}</${that.data.cut_char_title_h==''?'h3':that.data.cut_char_title_h}>
            </div>
            ${that.data.cut_char_title_is_footer_hr=='Y'?'<hr class="border-light container-m--x my-3">':''}
        </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 { vCutCharTitle }