/**
 * 关键字输入框过滤组合组件，带已选、未选、全部
 * @param {*} dlgId 对话框随机id,防止id冲突与数据集id统一命名引用
 * @param {*} dsId 绑定过滤数据集ID
 * @param {*} filterField 过滤字段名
 * @param {*} option 扩展选项
 * @returns 
 */
 export function inputFilterSelect(dlgId, dsId, filterField, option) {
    // 过滤编辑器
    let inputFilter = {
        controlName: "HcInputFilter",
        controlId: "HcInputFilter_" + dlgId,
        size: "small",
        fireAction: "keyup",
        events: {
            filterChange: function (filterKey) {
                this.getRefCompt(dsId).filter(
                    filterKey
                  );
                // let ds = this.getWorkBook().dataset[dsId];
                // let isRemoteFilter = ds._isRemoteFilter();
                // if (filterKey) {
                //     ds.addFilterCdion({
                //         sign: isRemoteFilter ? "like" : "pinyin",
                //         name: filterField,
                //         dataType: "string",
                //         value: filterKey,
                //         enable: true,
                //     });
                // } else {
                //     ds.removeFilterCdion(filterField);
                // }
            }
        }
    };

    // 按钮方案过滤
    let buttonFilter = {
        controlName: "HcRadioGroup",
        controlId: "HcRadioGroup_" + dlgId,
        value: "0",
        size: "small",
        children: [
            {
                controlName: "HcRadioButton",
                label: true,
                title: "已选",
            },
            {
                controlName: "HcRadioButton",
                label: false,
                title: "未选",
            },
            {
                controlName: "HcRadioButton",
                label: "",
                title: "全部",
            },
        ],
        events: {
            change: function (filterKey) {
                this.getWorkBook().dataset[dsId].setCheckCdion(
                    filterKey
                );
            },
        },
    }
    // 返回布局结构
    return {
        controlName: "ElRow",
        style: "margin-top:10px;",
        gutter: 10,
        children: [
            {
                controlName: "ElCol",
                span: 12,
                children: [
                    inputFilter
                ]
            },
            {
                controlName: "ElCol",
                span: 12,
                children: [
                    buttonFilter
                ]
            }
        ]
    }
}