"use strict";
import { fullMap } from '../../../fullMap.js';
import { khcAlert } from '../../../component/alert/khcAlert.js'
import { form } from '../../../component/page/form/form.js';
import { util } from '../../../util/util.js'
import { khcModal } from '../../../component/alert/khcModal.js'
let functionMap=new Map();// 使用 Map 来存储多个函数。每个函数都通过 set 方法添加到 Map 中，键是函数名，值是对应的函数。
export function main(jsonConfig) {
    try {
        functionMap.get(jsonConfig.button_method).apply(jsonConfig);
    } catch (error) {
        khcAlert.showSystemError(error.message);
        console.log(error);
    }
}

function iconTableRenderAfter(){
    let jsonConfig=this;
    let table=fullMap.getObj(jsonConfig.objID);
    let trObjArray = document.getElementById(table.eleID).querySelector('tbody').querySelectorAll('tr');
    for (let trObj of trObjArray) {
        let tdArray = trObj.querySelectorAll('td');
        for (let tdObj of tdArray) {
            if (tdObj.getAttribute('eleName') == 'icon_code') {
                let iconHtml='<i class="'+util.toOldChar(tdObj.innerHTML)+'"></i>';
                tdObj.innerHTML=iconHtml;
                tdObj.style.fontSize='18px'
            }
        }
    }
}
functionMap.set('iconTableRenderAfter', iconTableRenderAfter);// 将函数添加到 Map 中