@blueking/bkflow-canvas-editor 1.1.0-beta.4 → 1.1.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),_=require("./index-BoQLjwKV.cjs"),E=require("./composable-D55LNZ1F.cjs"),$={class:"debug-result-node-list"},L=["data-node-id","aria-selected","onClick","onKeydown"],G=["title"],P={key:0,class:"debug-result-node-list__mock","data-test":"node-mock-flag"},A={key:1,class:"debug-result-node-list__empty"},D=e.defineComponent({__name:"node-list",props:{nodes:{},modelValue:{default:""}},emits:["update:modelValue"],setup(l,{emit:r}){const t=l,s=r,u=e.ref(""),a=e.ref("all"),d=e.ref(null),m=[{value:"all",label:"全部"},{value:"finished",icon:"bkflow-canvas-dark-circle-checkbox",iconColor:"#2dcb56"},{value:"failed",icon:"bkflow-canvas-circle-alert-filled",iconColor:"#ea3636"},{value:"running",iconComponent:_.LoadingStatusIcon,iconColor:"#3a84ff"},{value:"suspended",icon:"bkflow-canvas-guaqi",iconColor:"#ff9c01"},{value:"skipped",icon:"bkflow-canvas-tiaoguo",iconColor:"#6e89af"}],v=e.computed(()=>m.map(c=>({...c,count:c.value==="all"?t.nodes.length:t.nodes.filter(i=>i.status===c.value).length}))),b=e.computed(()=>{const c=u.value.trim().toLowerCase();return t.nodes.filter(i=>a.value!=="all"&&i.status!==a.value?!1:c?i.name.toLowerCase().includes(c)||i.type.toLowerCase().includes(c)||(i.typeName??"").toLowerCase().includes(c):!0)}),f={finished:"成功",failed:"失败",running:"正在调试",suspended:"挂起",skipped:"跳过"},y=e.computed(()=>u.value.trim()?"搜索结果为空":a.value!=="all"?`暂无${f[a.value]}状态节点`:"暂无节点"),V=()=>{u.value="",a.value="all"};return e.watch(()=>t.modelValue,async c=>{if(!c)return;!b.value.some(o=>o.id===c)&&t.nodes.some(o=>o.id===c)&&(u.value="",a.value="all",await e.nextTick()),d.value?.querySelector(`[data-node-id="${CSS.escape(c)}"]`)?.scrollIntoView({block:"nearest"})}),(c,i)=>{const n=e.resolveComponent("bk-input");return e.openBlock(),e.createElementBlock("aside",$,[e.createVNode(n,{modelValue:u.value,"onUpdate:modelValue":i[0]||(i[0]=o=>u.value=o),class:"debug-result-node-list__search",placeholder:"搜索节点名称 / 类型",type:"search",clearable:"","data-test":"node-search"},null,8,["modelValue"]),e.createVNode(_.SegmentTabs,{modelValue:a.value,"onUpdate:modelValue":i[1]||(i[1]=o=>a.value=o),class:"debug-result-node-list__filters","data-test":"status-filters",items:v.value},null,8,["modelValue","items"]),b.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"itemsRef",ref:d,class:"debug-result-node-list__items",role:"listbox"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.id,class:e.normalizeClass(["debug-result-node-list__item",`is-${o.status}`,{"is-active":o.id===t.modelValue,"is-unconfigured":!o.isConfigured}]),role:"option","data-test":"node-item","data-node-id":o.id,"aria-selected":o.id===t.modelValue,tabindex:"0",onClick:g=>s("update:modelValue",o.id),onKeydown:e.withKeys(e.withModifiers(g=>s("update:modelValue",o.id),["prevent"]),["enter","space"])},[e.createElementVNode("span",{class:e.normalizeClass(["debug-result-node-list__status",`is-${o.status}`,{"is-placeholder":!o.isConfigured}])},[o.isConfigured&&o.status==="running"?(e.openBlock(),e.createBlock(_.LoadingStatusIcon,{key:0,size:12})):o.icon?(e.openBlock(),e.createElementBlock("i",{key:1,class:e.normalizeClass(o.icon),"data-test":"node-icon"},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",{class:"debug-result-node-list__name",title:o.isConfigured?`${o.name} ${o.typeName||o.type}`:o.name},e.toDisplayString(o.name),9,G),o.isMock?(e.openBlock(),e.createElementBlock("span",P,"MOCK")):e.createCommentVNode("",!0)],42,L))),128))],512)):(e.openBlock(),e.createElementBlock("div",A,[e.createVNode(_.EmptyException,{"is-search":!1,title:y.value,onClear:V},null,8,["title"])]))])}}}),z=_._export_sfc(D,[["__scopeId","data-v-7088d550"]]);function U(l){if(l==null)return"";if(typeof l=="string")return l;if(typeof l=="object"){const r=l,t=r.message;if(typeof t=="string"&&t){const s=r.type;return typeof s=="string"&&s?`${s}: ${t}`:t}try{return JSON.stringify(l)}catch{return String(l)}}return String(l)}const I={class:"debug-result-tabs"},O={class:"debug-result-tabs__execution","data-test":"tab-execution"},F={class:"debug-result-tabs__row"},j={class:"value"},q={class:"debug-result-tabs__row"},H={class:"value"},Y={key:0,class:"debug-result-tabs__row is-error"},K={class:"value"},J={key:0,class:"debug-result-tabs__mock-banner","data-test":"mock-banner"},W={key:1,class:"debug-result-tabs__error-banner","data-test":"output-error"},Q={key:0,class:"debug-result-tabs__error-text"},X={class:"debug-result-tabs__error-guide"},Z={class:"debug-result-tabs__logs","data-test":"tab-logs"},ee=e.defineComponent({__name:"result-tabs",props:{result:{},isMock:{type:Boolean,default:!1}},emits:["reEditMock","runReal","runMock"],setup(l,{emit:r}){const t=l,s=r,u=e.ref("execution"),a={not_run:"未调试",running:"正在调试",finished:"成功",failed:"失败",suspended:"挂起",skipped:"跳过"},d=e.computed(()=>a[t.result.execution.status]??t.result.execution.status),m=e.computed(()=>{const i=t.result.execution.durationMs;return i==null?"--":`${(i/1e3).toFixed(1)}s`}),v=e.computed(()=>U(t.result.error||t.result.execution.errorDetail)),b=e.computed(()=>t.result.execution.status==="failed"),f=i=>Object.entries(i??{}).map(([n,o])=>({key:n,name:n,value:o})),y=e.computed(()=>f(t.result.inputs)),V=e.computed(()=>f(t.result.outputs)),c=e.computed(()=>t.result.logs==null?"":_.normalizeLogText(t.result.logs));return(i,n)=>{const o=e.resolveComponent("bk-tab-panel"),g=e.resolveComponent("bk-button"),N=e.resolveComponent("bk-tab");return e.openBlock(),e.createElementBlock("div",I,[e.createVNode(N,{active:u.value,"onUpdate:active":n[3]||(n[3]=w=>u.value=w),type:"card-grid"},{default:e.withCtx(()=>[e.createVNode(o,{name:"execution",label:"执行信息"},{default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createElementVNode("div",F,[n[4]||(n[4]=e.createElementVNode("span",{class:"label"},"执行状态",-1)),e.createElementVNode("span",j,e.toDisplayString(d.value),1)]),e.createElementVNode("div",q,[n[5]||(n[5]=e.createElementVNode("span",{class:"label"},"调试用时",-1)),e.createElementVNode("span",H,e.toDisplayString(m.value),1)]),v.value?(e.openBlock(),e.createElementBlock("div",Y,[n[6]||(n[6]=e.createElementVNode("span",{class:"label"},"错误信息",-1)),e.createElementVNode("span",K,e.toDisplayString(v.value),1)])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(o,{name:"inputs",label:"输入参数"},{default:e.withCtx(()=>[e.createVNode(_.DebugValueTable,{rows:y.value,loading:t.result.loading,error:t.result.error,"empty-text":"暂无输入参数"},null,8,["rows","loading","error"])]),_:1}),e.createVNode(o,{name:"outputs",label:"输出结果"},{default:e.withCtx(()=>[t.isMock?(e.openBlock(),e.createElementBlock("div",J,[n[8]||(n[8]=e.createElementVNode("span",null,"当前为 Mock 数据",-1)),e.createVNode(g,{text:"",theme:"primary",size:"small","data-test":"re-edit-mock",onClick:n[0]||(n[0]=w=>s("reEditMock"))},{default:e.withCtx(()=>[...n[7]||(n[7]=[e.createTextVNode(" 重新编辑 ",-1)])]),_:1})])):e.createCommentVNode("",!0),b.value?(e.openBlock(),e.createElementBlock("div",W,[v.value?(e.openBlock(),e.createElementBlock("p",Q,e.toDisplayString(v.value),1)):e.createCommentVNode("",!0),e.createElementVNode("p",X,[n[11]||(n[11]=e.createElementVNode("span",null,"该节点调试失败,可",-1)),e.createVNode(g,{text:"",theme:"primary","data-test":"rerun-real",onClick:n[1]||(n[1]=w=>s("runReal"))},{default:e.withCtx(()=>[...n[9]||(n[9]=[e.createTextVNode("重新调试",-1)])]),_:1}),n[12]||(n[12]=e.createElementVNode("span",null,"或直接",-1)),e.createVNode(g,{text:"",theme:"primary","data-test":"run-mock",onClick:n[2]||(n[2]=w=>s("runMock"))},{default:e.withCtx(()=>[...n[10]||(n[10]=[e.createTextVNode("Mock 输出",-1)])]),_:1})])])):(e.openBlock(),e.createBlock(_.DebugValueTable,{key:2,rows:V.value,loading:t.result.loading,"empty-text":"暂无输出结果"},null,8,["rows","loading"]))]),_:1}),e.createVNode(o,{name:"logs",label:"调用日志"},{default:e.withCtx(()=>[e.createElementVNode("div",Z,[e.createVNode(_.CallLogsViewer,{"log-text":c.value,loading:t.result.loading,error:t.result.error},null,8,["log-text","loading","error"])])]),_:1})]),_:1},8,["active"])])}}}),te=_._export_sfc(ee,[["__scopeId","data-v-16a27efa"]]),oe={ExclusiveGateway:"bkflow-canvas-fenzhiwangguan",ParallelGateway:"bkflow-canvas-bingxingwangguan",ConditionalParallelGateway:"bkflow-canvas-tiaojianbingxingwangguan",ConvergeGateway:"bkflow-canvas-huijuwangguan"},C={ServiceActivity:"任务节点",EmptyStartEvent:"开始节点",EmptyEndEvent:"结束节点",ExclusiveGateway:"分支网关",ParallelGateway:"并行网关",ConditionalParallelGateway:"条件并行网关",ConvergeGateway:"汇聚网关"};function ne(l){if(!l.component?.code)return"";if(l.component.code==="uniform_api"){const r=l.component.api_meta?.category?.name??"";return E.PLUGGIN_GROUP_FONT_CLASS_MAP[r]??E.PLUGGIN_GROUP_FONT_CLASS_MAP.bkflow}return E.PLUGGIN_GROUP_FONT_CLASS_MAP.bkflow}function le(l,r){const t=l?.location?.find(d=>d.id===r),s=t?.icon??"",u=l?.activities?.[r];if(u)return{name:!!u.component?.code?u.name||t?.name||r:"节点未配置",type:u.type||"ServiceActivity",typeName:C[u.type]??"任务节点",icon:ne(u)};const a=l?.gateways?.[r];return a?{name:a.name||t?.name||C[a.type]||r,type:a.type,typeName:C[a.type]??"网关",icon:s||oe[a.type]||""}:l?.start_event?.id===r?{name:l.start_event.name||"开始",type:"EmptyStartEvent",typeName:"开始节点",icon:s||"bkflow-canvas-kaishi"}:l?.end_event?.id===r?{name:l.end_event.name||"结束",type:"EmptyEndEvent",typeName:"结束节点",icon:s||"bkflow-canvas-stop"}:t?{name:t.name||r,type:t.type||"",typeName:"",icon:s}:{name:r,type:"",typeName:"",icon:""}}function ae(l,r,t=new Set){const s=l?.activities;if(!s)return[];const u=new Map((r??[]).map(a=>[a.node_id,a.status]));return Object.values(s).map(a=>{const d=!!a.component?.code,m=le(l,a.id);return{id:a.id,name:m.name,type:m.type||a.type,typeName:m.typeName,icon:m.icon,status:u.get(a.id)??"not_run",isMock:t.has(a.id),isConfigured:d}})}const se={class:"debug-result-drawer__header"},re={class:"debug-result-drawer__header-left"},ue={class:"debug-result-drawer__body"},ie={key:0,class:"debug-result-drawer__params","data-test":"params-panel"},ce={class:"debug-result-drawer__params-body"},de={class:"debug-result-drawer__content"},me={class:"debug-result-drawer__result"},pe=44,_e=e.defineComponent({__name:"index",props:{open:{type:Boolean},context:{},pipelineTree:{},mockNodeIds:{},modelValue:{default:""},result:{},hasGlobalRun:{type:Boolean,default:!1},globalInputs:{default:()=>({})}},emits:["update:open","update:modelValue","reEditMock","runReal","runMock"],setup(l,{emit:r}){const t=l,s=r,u=e.ref(!1),a=u,d=e.ref(420),m=e.ref(!1);let v=0,b=0,f="",y="";const V=e.computed(()=>({height:`${t.open?d.value:pe}px`})),c=()=>{s("update:open",!t.open)},i=k=>{const p=b-(k.clientY-v);d.value=Math.max(200,Math.min(window.innerHeight*.8,p))},n=()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",n),document.body.style.cursor=f,document.body.style.userSelect=y,m.value=!1},o=k=>{k.preventDefault(),m.value=!0,v=k.clientY,b=d.value,f=document.body.style.cursor,y=document.body.style.userSelect,document.body.style.cursor="ns-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",i),document.addEventListener("mouseup",n)};e.onBeforeUnmount(n);const g=e.computed({get:()=>t.modelValue,set:k=>s("update:modelValue",k)}),N=e.computed(()=>ae(t.pipelineTree,t.context?.nodes,t.mockNodeIds)),w=e.computed(()=>t.mockNodeIds.has(t.modelValue)),x=()=>{t.hasGlobalRun&&(u.value=!u.value)},h=()=>{t.modelValue&&s("reEditMock",t.modelValue)},B=()=>{t.modelValue&&s("runReal",t.modelValue)},S=()=>{t.modelValue&&s("runMock",t.modelValue)};return(k,p)=>{const M=e.resolveComponent("bk-button"),T=e.resolveDirective("bk-tooltips");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["debug-result-drawer-wrapper",{"is-resizing":m.value}]),style:e.normalizeStyle(V.value)},[t.open?(e.openBlock(),e.createElementBlock("div",{key:0,class:"debug-result-drawer__resize",onMousedown:o},null,32)):e.createCommentVNode("",!0),e.createElementVNode("section",{class:e.normalizeClass(["debug-result-drawer",{"is-collapsed":!t.open}])},[e.createElementVNode("header",se,[e.createElementVNode("div",re,[p[2]||(p[2]=e.createElementVNode("span",{class:"debug-result-drawer__title"},"调试结果",-1)),p[3]||(p[3]=e.createElementVNode("span",{class:"debug-result-drawer__divider"},null,-1)),e.withDirectives((e.openBlock(),e.createBlock(M,{text:"",theme:"primary","data-test":"view-params",disabled:!t.hasGlobalRun,onClick:x},{default:e.withCtx(()=>[...p[1]||(p[1]=[e.createTextVNode(" 查看参数 ",-1)])]),_:1},8,["disabled"])),[[T,{content:"请先进行调试",disabled:t.hasGlobalRun}]])]),e.createElementVNode("span",{class:"debug-result-drawer__collapse",onClick:c},[e.createElementVNode("span",null,e.toDisplayString(t.open?"收起":"展开"),1),e.createElementVNode("i",{class:e.normalizeClass(["bkflow-canvas-icon bkflow-canvas-arrows-down debug-result-drawer__collapse-icon",{"is-expanded":t.open}])},null,2)])]),e.createElementVNode("div",ue,[e.unref(a)?(e.openBlock(),e.createElementBlock("div",ie,[p[4]||(p[4]=e.createElementVNode("div",{class:"debug-result-drawer__params-title"},"本次调试输入参数",-1)),e.createElementVNode("div",ce,[e.createVNode(_.DebugJsonViewer,{value:t.globalInputs??{},"default-expanded":!0},null,8,["value"])])])):e.createCommentVNode("",!0),e.createElementVNode("div",de,[e.createVNode(z,{modelValue:g.value,"onUpdate:modelValue":p[0]||(p[0]=R=>g.value=R),nodes:N.value},null,8,["modelValue","nodes"]),e.createElementVNode("div",me,[e.createVNode(te,{result:t.result,"is-mock":w.value,onReEditMock:h,onRunReal:B,onRunMock:S},null,8,["result","is-mock"])])])])],2)],6)}}}),ve=_._export_sfc(_e,[["__scopeId","data-v-a977e91c"]]);exports.default=ve;