import { NodeSlide } from '../panel/slide.js'
import {khcModalSlide} from "../../kanhouchu/component/alert/khcModalSlide.js";
import {config} from "../../kanhouchu/config.js";
import {form} from "../../kanhouchu/component/page/form/form.js";
import {pageInfoMap} from "../../kanhouchu/pageInfoMap.js";
import {httpUtil} from "../../kanhouchu/util/httpUtil.js";
import {util} from "../../kanhouchu/util/util.js";
import {fullMap} from "../../kanhouchu/fullMap.js";
import {khcAlert} from "../../kanhouchu/component/alert/khcAlert.js";
import {khcToastr} from "../../kanhouchu/component/alert/khcToastr.js";
class KhcMenu {
    constructor(lf, lfwidth) {
        this.data = {
            //节点菜单
            nodeMenu: [
                {
                    text: '属性设置',
                    callback(node) {
                        /*let nodeSlide = new NodeSlide(lf, { nodeId: node.id, lfwidth: lfwidth, nodex: node.x });
                        nodeSlide.rander();
                        nodeSlide.show();*/
                        lf.setProperties(node.id, {
                            isActived: true,
                        });
                        let nodeArray = Array.from(lf.graphModel.nodes);
                        for (var i = 0; i < nodeArray.length; i++) {
                            if (nodeArray[i].id != node.id) {
                                lf.setProperties(nodeArray[i].id, {
                                    isActived: false,
                                });
                            }
                        }
                        let jsonConfig=this;
                        jsonConfig.lf=lf;
                        jsonConfig.lfwidth=lfwidth;
                        jsonConfig.node=node;
                        if(node.type=='userTask'){
                            jsonConfig.button_method='flwodesignEditUserTaskConfig';
                            util.import2023('../../flowdesign/menu/menuAction.js',jsonConfig);
                        }else if(node.type=='startbingfa'){
                            khcToastr.showWarningMessage('并发节点不用配置属性！')
                        }else if(node.type=='endbingfa'){
                            khcToastr.showWarningMessage('结束并发不用配置属性！')
                        }else if(node.type=='startNode'){
                            khcToastr.showWarningMessage('开始节点不用配置属性！')
                        }else if(node.type=='endNode'){
                            khcToastr.showWarningMessage('结束节点不用配置属性！')
                        }else{
                            khcToastr.showWarningMessage(node.type+'表单设计中！')
                        }
                    },
                },
            ],
            //线条菜单
            edgeMenu: [
                {
                    text: '属性设置',
                    callback(edge) {
                        /*alert(`边id:${edge.id}
                            边类型:${edge.type}
                            边坐标:(x: ${edge.x}, y: ${edge.y})
                            源节点id:${edge.sourceNodeId}
                            目标节点id:${edge.targetNodeId}`);*/
                        let jsonConfig=this;
                        jsonConfig.lf=lf;
                        jsonConfig.lfwidth=lfwidth;
                        jsonConfig.node=edge;
                        jsonConfig.button_method='flwodesignEditGatewayConfig';
                        util.import2023('../../flowdesign/menu/menuAction.js',jsonConfig);
                    },
                },
            ],
            /*画布菜单
            graphMenu: [
              {
                text: '分享3',
                callback() {
                  alert('分享成功！');
                }
              },
            ],
            */
        }
        lf.addMenuConfig(this.data);
    }

}
export { KhcMenu }