Files
qhmes/web-dist/js/BindingParamsEditor-CYr4nMsu.js

2 lines
6.7 KiB
Java
Raw Normal View History

2026-06-16 18:19:57 +08:00
var J=Object.defineProperty,X=Object.defineProperties;var Z=Object.getOwnPropertyDescriptors;var A=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var q=(r,l,o)=>l in r?J(r,l,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[l]=o,U=(r,l)=>{for(var o in l||(l={}))ee.call(l,o)&&q(r,o,l[o]);if(A)for(var o of A(l))te.call(l,o)&&q(r,o,l[o]);return r},I=(r,l)=>X(r,Z(l));import{M as ae,s as ne,aG as oe,aE as le,au as se}from"./index-X7Y8jykP.js";import{e as ie,o as re,d as ue,h as me,C as E,z as b,Q as f,f as u,A as v,K as de,r as g,c as pe,E as h,y as H,H as ce,F as fe,D as ve}from"./vue-vendor-DNhG1Cve.js";import{_ as ke}from"./index-DTjkSGYl.js";import ye from"./index-DklMb9Qc.js";import we from"./index-saD4h7VJ.js";import"./emoji-mart-vue-fast-R0uJEDq-.js";import"./eagerComputed-BTlOruLW.js";import"./fromPairs-Dx9PT-t0.js";import"./useMaxLevel-DE205ncc.js";import"./index-DSsDi_fL.js";import"./Group-UHkub2tu.js";import"./Checkbox-Dbxs4we4.js";import"./index-BuONesFs.js";import"./index-CfNJyBRj.js";import"./dropdown-jkliuVyN.js";import"./index-DfHu-LAS.js";import"./Group-DBzJABA_.js";import"./RadioButton-DRBix2Fq.js";import"./index-C7ckZv9Z.js";import"./DirectoryTree-nk_YTTIy.js";import"./FolderOpenOutlined-SzIPA7z0.js";import"./index-Cl-8Hzo4.js";import"./scrollTo-D49dA-9c.js";import"./operationUnit-vCu2co3e.js";import"./UpOutlined-B1UMbtrP.js";const be={class:"binding-params-editor"},ge={class:"binding-actions-row"},he={class:"modal-section"},_e={class:"modal-section"},xe=ie({__name:"BindingParamsEditor",props:{params:{}},emits:["update:params"],setup(r,{emit:l}){const o=r,_=l,{createMessage:M}=ne(),P=g(typeof window!="undefined"?window.innerHeight:800);function R(){P.value=window.innerHeight}re(()=>window.addEventListener("resize",R)),ue(()=>window.removeEventListener("resize",R));const V=pe(()=>{const t=P.value;return Math.round(Math.min(520,Math.max(260,t-360)))}),L=[{title:"参数键",dataIndex:"key",ellipsis:!0},{title:"显示名",dataIndex:"label",ellipsis:!0}],m=g([]),x=g(!1),C=g(1),d=g([{key:"",label:""}]);me(()=>o.params,()=>{const t=new Set(o.params.map(e=>e.key));m.value=m.value.filter(e=>t.has(e))});function T(t){m.value=t}function z(){C.value=1,d.value=[{key:"",label:""}]}function D(){z(),x.value=!0}function F(){const t=new Set(o.params.map(e=>e.key.trim()).filter(Boolean));return d.value.forEach(e=>{const a=e.key.trim();a&&t.add(a)}),t}function G(t){let e=0;for(const a of t){const n=String(a).match(/^Parameter(\d+)$/i);n&&(e=Math.max(e,Number(n[1])))}return e}function O(){const t=Math.max(1,Math.min(200,Math.floor(Number(C.value)||1))),e=F();let a=Math.max(1,G(e)+1);for(let n=0;n<t;n++){for(;e.has(`Parameter${a}`);)a+=1;const s=`Parameter${a}`;e.add(s),d.value.push({key:s,label:`参数${a}`}),a+=1}M.success(`已新增 ${t} 行到下方列表,可修改后点「确定添加」。`)}function Q(){d.value.push({key:"",label:""})}function W(t){d.value.length<=1||d.value.splice(t,1)}function Y(){const t=new Set(o.params.map(n=>n.key.trim()).filter(Boolean)),e=[],a=new Set(t);for(const n of d.value){const s=n.key.trim();if(!s||a.has(s))continue;a.add(s);const p=n.label.trim();e.push({key:s,label:p||void 0})}e.length&&_("update:params",[...o.params,...e]),x.value=!1,z()}function j(){if(!m.value.length)return;const t=new Set(m.value);_("update:params",o.params.filter(e=>!t.has(e.key))),m.value=[]}function N(t,e){return typeof e=="number"&&e>=0?e:o.params.findIndex(a=>a.key===t.key)}function K(t,e,a){const n=[...o.params];if(t<0||t>=n.length)return;const s=n[t];if(e==="label"){const c=a.trim();n[t]=I(U({},s),{label:c||void 0}),_("update:params",n);return}const p=a.trim();if(!p){M.warning("参数键不能为空");return}if(p!==s.key&&n.some((c,S)=>S!==t&&c.key===p)){M.warning("参数键已存在");return}const B=s.key;n[t]=I(U({},s),{key:p}),_("update:params",n),m.value=m.value.map(c=>c===B?p:c)}return(t,e)=>{const a=de("a-button"),n=oe,s=ke,p=ye,B=le,c=we,S=ae;return b(),E("div",be,[f("div",ge,[u(a,{type:"primary",size:"small",onClick:D},{default:v(()=>