/*
 * @Author: Zh_Strong
 * @Date: 2022-10-15 18:20:19
 * @LastEditTime: 2022-10-19 09:40:40
 * @LastEditors: Zh_Strong
 * @Description: Zh_Strong
 * @FilePath: \layui-encapsulation\layui\lib\transfer.js
 */
/**Layui穿梭框类说明
 * @parameter 传递的参数{}，参数如下：
 ** elem: "", // 绑定元素，(必填项) 指向容器选择器 类型（ string / object）
 */
class lay_transfer {
    constructor(parameter = {}) {
        this.parameter = parameter;
        let that = this;
        layui.use(['transfer'], function () {
            var transfer = layui.transfer;
            that.transfer = transfer.render(that.parameter);
        });

    };
    // 基础方法-设置穿梭框
    static set(parameter) {
        let that = this;
        layui.use(['transfer'], function () {
            var transfer = layui.transfer;
            that.transfer = transfer.set(parameter);
        });
    }
    // 基础方法-获取右侧数据
    static getData = layui.transfer.getData;
    // static getData(id) {
    // let rightData = [];
    // const getAs = async () => {
    //     await new Promise((resolve, reject) => {
    //         layui.use(['transfer'], function () {
    //             var transfer = layui.transfer;
    //             rightData = transfer.getData(id);
    //             resolve(rightData);
    //         });
    //     })
    //     return rightData;
    // }
    //  return getAs();
    // }
    // 基础方法-重载实例
    static reload(id, parameter) {
        let that = this
        layui.use(['transfer'], function () {
            var transfer = layui.transfer;
            that.transfer = transfer.reload(id, parameter)
        });
    }
    /**
     * 穿梭框类的参数提示
     */
    static config = {
        elem: "elem",
        title: "title",
        data: "data",
        parseData: "parseData",
        value: "value",
        id: "id",
        showSearch: "showSearch",
        width: "width",
        height: "height",
        text: "text",
        onchange: "onchange"
    };

    /**
     * 数据参数提示
     */
    static menu = {
        id: "value",
        title: "title",
        disabled: "disabled",
        checked: "checked"
    }
    /**
     * 暂无
     */
    static text = {
        none: "none",
        searchNone: "searchNone"
    }

};

export default lay_transfer;