/*
 * @Author: Zh_Strong
 * @Date: 2022-10-15 18:20:19
 * @LastEditTime: 2022-10-19 17:15:03
 * @LastEditors: Zh_Strong
 * @Description: Zh_Strong
 * @FilePath: \layui-encapsulation\layui\lib\tree.js
 */
/**Layui树形组件类说明
 * @parameter 传递的参数{}，参数如下：
 ** elem: "", // 绑定元素，(必填项) 指向容器选择器 类型（ string / object）
 */
class lay_tree {
    constructor(parameter = {}) {
        this.parameter = parameter;
        let that = this;
        layui.use(['tree'], function () {
            var tree = layui.tree;
            that.tree = tree.render(that.parameter);
        });
    };
    /**
     * 评分类的参数提示
     */
    static config = {
        elem: "elem",
        data: "data",
        id: "id",
        showCheckbox: "showCheckbox",
        edit: "edit",
        accordion: "accordion",
        onlyIconControl: "onlyIconControl",
        isJump: "isJump",
        showLine: "showLine",
        text: "text",
        oncheck: "oncheck",
        operate: "operate",
        click: "click"
    };
    static menu = {
        title: "title",
        id: "id",
        field: "field",
        children: "children",
        href: "href",
        spread: "spread",
        checked: "checked",
        disabled: "disabled"
    }

    static text = {
        none: "none",
        defaultNodeName: "defaultNodeName"
    }

    static edit = {
        add: "add",
        update: "update",
        del: "del"
    }

    static getChecked = layui.tree.getChecked;
    static setChecked = layui.tree.setChecked;
    static reload = function (id = '', parameter = {}) {
        let that = this;
        layui.use(['tree'], function () {
            var tree = layui.tree;
            that.tree = tree.reload(id, parameter);;
        });
    }
};

export default lay_tree;