import { type ComponentConfigModel } from "epic-designer";
import $Bus from "@/utils/mittBus";

export default {
    component: async () => await import("./index.vue"),
    groupName: "自定义",
    // icon: "icon-chukusaomiao",
    defaultSchema: {
        type: "epic-approve-select",
        label: "关联审批单",
        input: true,
        field: "epic-approve-select", // 框架会自动添加唯一标识后缀
        componentProps: {
            placeholder: "选择审批单"
        }
    },
    config: {
        attribute: [
            {
                field: "field",
                label: "字段名",
                type: "input",
                componentProps: {
                    disabled: true // 禁止修改field，确保唯一性
                }
            },
            {
                field: "label",
                label: "标题",
                type: "input"
            },
            // {
            //     field: "componentProps.placeholder",
            //     label: "占位文本",
            //     type: "input"
            // },
            {
                field: "componentProps.defaultValue",
                label: "关联审批单",
                type: "button",
                componentProps: {
                    // label: "打开组件弹窗",
                    onClick: () => {
                        // 仅触发事件，不传递标识
                        $Bus.emit("trigger-approve-select-modal");
                    }
                }
            }
        ],
        event: [
            // {
            //     type: "userSelected",
            //     describe: "用户选择完成时触发"
            // }
        ]
    },
    // bindModel: "componentProps.defaultValue",
    sort: 100
} as ComponentConfigModel;
