Files
qhmes/web-dist/js/useSettings-CFG4Ykt4-CKCQ4yAA.js
2026-06-16 18:19:57 +08:00

2 lines
3.2 KiB
Java

import{U as H}from"./NodeContainer-D9PNfjwh-CawrgSrv.js";import{l as L}from"./propStore-Cl0CojEU-BjnqDV4W.js";import{u as V,H as M}from"./LoopBodyNode-wLHHxX8A-D3_JcFF8.js";import{aQ as $,bW as j,bZ as S}from"./index-X7Y8jykP.js";import{S as z,c as p,r as C}from"./vue-vendor-DNhG1Cve.js";function _(o){const N=L(),s=z("lfRef",C()),f=p(()=>o.isSilentMode===!0),l=p(I),h=p(()=>{var e,n;const a=[];if(!s.value)return a;const{node:c}=o,g=M(c.id);if(g){const i=s.value.getNodeDataById(g);if(Array.isArray((n=(e=i==null?void 0:i.properties)==null?void 0:e.options)==null?void 0:n.loopParams)){const{type:y,loopParams:A}=i.properties.options;a.push({nodeId:i.id,nodeName:"循环变量",field:"currentLoopTimes",name:"当前循环次数",type:"number"}),y==="array"&&a.push({nodeId:i.id,nodeName:"循环变量",field:"currentLoopItem",name:"当前循环项",type:"any"});for(const R of A)a.push({nodeId:i.id,nodeName:"循环变量",field:R.name,name:R.name,type:R.type||"string"})}}if(l.value.length===0)return a;for(const i of l.value){if(i.id===g)continue;let y=i.properties.outputParams;i.type===H.START&&(y=i.properties.inputParams),!(!Array.isArray(y)||y.length===0)&&a.push(...y.map(A=>({nodeId:i.id,nodeName:i.properties.text,field:A.field,name:A.name,type:A.type})))}return a}),d=p({get:()=>{const{options:e}=o.properties;return e},set:e=>{o.setProperties({options:e})}}),t=p({get:()=>{const{inputParams:e}=o.properties;return Array.isArray(e)?e:[]},set:e=>{o.setProperties({inputParams:e})}}),r=p({get:()=>{const{outputParams:e}=o.properties;return Array.isArray(e)?e:[]},set:e=>{o.setProperties({outputParams:e})}}),u=p(()=>t.value.filter(e=>!!e.name&&!!e.field).map(e=>P(e))),m=p(()=>r.value.filter(e=>!!e.name&&!!e.field).map(e=>P(e)));function P(e){var n,a;return{type:(a=(n=h.value.find(c=>c.nodeId===e.nodeId&&c.field===e.field))==null?void 0:n.type)!=null?a:"-",name:e.name}}function I(){if(!s.value)return[];const{graphModel:e}=s.value;return e.$J.getAllPrevNodes(o.node)}function O(e){return p({get:()=>S(d.value,e),set:n=>b({[e]:n})})}const v=[];function b(e){v.push(e),!(v.length>1)&&T()}function T(){setTimeout(()=>{if(v.length===0)return;const e=v.shift();x(e),v.length!==0&&T()},0)}function x(e){const n=Object.entries(e);if(n.length===0)return;const a=$(d.value);for(const[c,g]of n)j(a,c,g);d.value=a}function B(e){var n;return N.createStoreRef((n=o.node)==null?void 0:n.id,e)}return{lfRef:s,prevNodes:l,prevVariables:h,isReadOnly:f,options:d,inputParams:t,outputParams:r,inputVarsOptions:u,outputVarsOptions:m,updateOptions:b,createOptionRef:O,createStoreRef:B}}const D=Symbol();function k(o,N){let s=null;function f(t){return s==null&&(s=N()),S(s,t)}function l(t,r=D){r===D&&(r=f(t)),j(o.properties,t,r)}function h(t){t||(t=I=>{var O;return I.field+"_"+((O=I.nodeId)!=null?O:"")});let{inputParams:r,outputParams:u}=o.properties;Array.isArray(r)||(r=[]);const m=f("inputParams");Array.isArray(m)&&(r=V(r,m,t)),l("inputParams",r),Array.isArray(u)||(u=[]);const P=f("outputParams");Array.isArray(P)&&(u=V(u,P,t)),l("outputParams",u)}function d(t,r){if(typeof r!="function")return;t=`options.${t}`;const u=S(o.properties,t),m=f(t);r(u)&&l(t,m)}return{getDefValue:f,updateProp:l,updateOption:d,mergeIOParams:h}}export{k as C,_ as z};