import{r as c,o as a,g as o,d as $,e as z,u as l,a as n,F as B,D as T,c as E,w as b,t as S,h as d,i as v,f as x,n as q,b as y,L as G,bb as H,a_ as A}from"./app-BYcXwl4U.js";import{T as I}from"./app-CrjU8lgK.js";import{_ as J}from"./app-Ufpj4Ll4.js";import{T as K}from"./app-D2Wz0BUQ.js";import{u as Q}from"./app-a6cKceqE.js";import{P as W}from"./app-0YmIdYYs.js";const X={class:"label-group"},Y={key:0},Z={key:1,class:"disabled"},ee={key:0,class:"label-group"},te={key:0},se={key:1,class:"disabled"},le=["name","value"],ne=["onClick"],ae=n("i",{class:"pi pi-pencil small"},null,-1),ie=[ae],oe=["onClick"],ue=n("i",{class:"pi pi-times small"},null,-1),re=[ue],ce={key:1},de={class:"ui fields inline"},ve={class:"ui field"},fe={class:"ui field"},pe={class:"ui field"},me=n("i",{class:"pi pi-times small"},null,-1),he=[me],_e={key:2},we={__name:"ValuesBox",props:["values","v-values","size","maxlength","name","placeholder","v-allow-empty","validator"],emits:["change"],setup(p,{expose:N,emit:U}){const D=Q(),r=p,{realValues:s,isUpdating:f,isAdding:h,index:k,value:u,isEditing:_}=function(){let e=r.values;return e==null&&(e=[]),r.vValues!=null&&typeof r.vValues=="object"&&(e=r.vValues),{realValues:c(e),isUpdating:c(!1),isAdding:c(!1),index:c(0),value:c(""),isEditing:c(!1)}}(),C=U,m=c(),L=function(){h.value=!0,setTimeout(function(){m.value.focus()},200)},R=function(e){V(),f.value=!0,k.value=e,u.value=s.value[e],setTimeout(function(){m.value.focus()},200)},w=function(){if(!(u.value.length==0&&(typeof r.vAllowEmpty!="boolean"||!r.vAllowEmpty))){if(typeof r.validator=="function"){let e=r.validator.call(m,u.value);if(typeof e=="object"&&typeof e.isOk=="boolean"&&!e.isOk){typeof e.message=="string"&&D.warn(e.message,function(){m.value.focus()});return}}f.value?s.value[k.value]=u.value:s.value.push(u.value),V(),C("change",s.value)}},j=function(e){s.value.$remove(e),C("change",s.value)},V=function(){f.value=!1,h.value=!1,u.value=""},F=function(e){s.value=e},O=function(e){s.value.push(e)},P=function(){_.value=!_.value};return N({updateAll:F,addValue:O,allValues:function(){return s.value}}),(e,i)=>(a(),o("div",null,[$(n("div",X,[(a(!0),o(B,null,T(l(s),(t,g)=>(a(),E(K,{class:"outlined"},{default:b(()=>[t.toString().length>0?(a(),o("span",Y,S(t),1)):d("",!0),t.toString().length==0?(a(),o("span",Z,"[空]")):d("",!0)]),_:2},1024))),256)),n("a",{href:"",onClick:v(P,["prevent"]),style:{"font-size":"0.8em","margin-left":"0.2em"}},"[修改]")],512),[[z,!l(_)&&l(s).length>0]]),$(n("div",null,[l(s).length>0?(a(),o("div",ee,[(a(!0),o(B,null,T(l(s),(t,g)=>(a(),E(K,{class:q({blue:g==l(k)&&l(f)}),outlined:""},{default:b(()=>[t.toString().length>0?(a(),o("span",te,S(t),1)):d("",!0),t.toString().length==0?(a(),o("span",se,"[空]")):d("",!0),n("input",{type:"hidden",name:p.name,value:t},null,8,le),x("   "),n("a",{href:"",onClick:v(M=>R(g),["prevent"]),title:"修改"},ie,8,ne),x("  "),n("a",{href:"",onClick:v(M=>j(g),["prevent"]),title:"删除"},re,8,oe)]),_:2},1032,["class"]))),256)),y(G)])):d("",!0),l(h)||l(f)?(a(),o("div",ce,[n("div",de,[n("div",ve,[y(J,{type:"text",size:p.size,maxlength:p.maxlength,placeholder:p.placeholder,modelValue:l(u),"onUpdate:modelValue":i[0]||(i[0]=t=>H(u)?u.value=t:null),ref_key:"valueRef",ref:m,onKeyup:i[1]||(i[1]=A(t=>w(),["enter"])),onKeypress:A(v(t=>1,["prevent"]),["enter"])},null,8,["size","maxlength","placeholder","modelValue","onKeypress"])]),n("div",fe,[y(I,{secondary:"",size:"small",type:"button",onClick:i[2]||(i[2]=v(t=>w(),["prevent"]))},{default:b(()=>[x("确定")]),_:1})]),n("div",pe,[n("a",{href:"",onClick:i[3]||(i[3]=v(t=>V(),["prevent"])),title:"取消"},he)])])])):d("",!0),!l(h)&&!l(f)?(a(),o("div",_e,[y(W,{size:"small",type:"button",onClick:i[4]||(i[4]=v(t=>L(),["prevent"]))})])):d("",!0)],512),[[z,l(_)||l(s).length==0]])]))}};export{we as _};
