sign.77210e3b.js 3.9 KB

1
  1. import{d as L,S as w,K as y,b as P,u as l,o as p,h as x,j as $,f as h,L as g,l as q,t as f,e as B,m as D,eG as C,ez as F,ew as T,_ as R,eC as E,eH as z,eI as H,ei as M,eJ as K,c as S,eh as U,ct as b,cl as N,eK as V,F as A,D as G,eL as J,cq as O,eM as W,r as Q,eq as X,eN as Y}from"./index.932f1548.js";import{D as Z}from"./DownOutlined.e8d377cc.js";import{M as ee}from"./Menu.b368adf3.js";import{D as te}from"./dropdown.4b29a5a7.js";const ne={key:0,class:"count"},se=L({__name:"style-type-select",props:{value:null,all:{type:Boolean},count:{type:Boolean}},emits:["update:value"],setup(i,{emit:r}){const o=i,d={name:w.t("sys.all"),id:-1},v=s=>s.id===d.id?F.value.length:s.children?s.children.reduceRight((n,t)=>n+F.value.filter(u=>{var m;return((m=T(u.styleId))==null?void 0:m.typeId)===t.id}).length,0):F.value.filter(n=>{var t;return((t=T(n.styleId))==null?void 0:t.typeId)===s.id}).length,_=(s=C)=>s.map(n=>{let t=0;return o.count&&(t=v(n)),{label:n.name+(o.count?` \uFF08${t}\uFF09 `:""),title:n.name,count:t,key:n.id,children:"children"in n?_(n.children):null}}).filter(n=>!o.count||n.count||n.key===d.id),k=(s,n=a.value)=>{for(const t of n){if(s===t.key)return[t];if("children"in t&&t.children){const u=k(s,t.children);if(u.length)return[t,...u]}}return[]},I=y(()=>o.all?[d,...C]:C),a=y(()=>_(I.value)),e=y(()=>k(o.value));o.count&&o.all&&P(()=>{(e.value.length===0||e.value[e.value.length-1].count===0)&&r("update:value",d.id)});const c=s=>{r("update:value",s.key)};return(s,n)=>l(e).length?(p(),x(l(te),{key:0,placement:"bottom"},{overlay:$(()=>[h(l(ee),{style:{width:"auto"},"active-key":i.value.toString(),mode:"vertical",popupClassName:"child-items",items:l(a),onClick:c},null,8,["active-key","items"])]),default:$(()=>[g("span",null,[q(f(l(e).map(t=>t.title).join("/"))+" ",1),i.count?(p(),B("span",ne,"\uFF08"+f(l(e)[l(e).length-1].count)+"\uFF09",1)):D("",!0),h(l(Z))])]),_:1})):D("",!0)}});const de=R(se,[["__scopeId","data-v-a0e77bd8"]]),le={class:"info"},oe=["src"],ae=L({__name:"sign",props:{tagging:null,selected:{type:Boolean},edit:{type:Boolean,default:!0}},emits:["delete","edit","select","fixed"],setup(i,{emit:r}){const o=i;y(()=>T(o.tagging.styleId));const d=y(()=>E(o.tagging)),v=y(()=>{var e;let a=o.tagging.images.find(c=>z(H(M(c)))===K.image);return a||((e=T(o.tagging.styleId))==null?void 0:e.icon)}),_=[{label:w.t("sys.edit"),value:"edit"},{label:w.t("sys.del"),value:"delete"}],k={edit:()=>r("edit"),delete:()=>r("delete")},I=(a,e)=>{const c=E(a);let s=!1;const n=t=>{if(s||t>=c.length){e&&G(e);return}const u=c[t],m=J(u.modelId);if(!m||!O(m).value){n(t+1);return}const j=W.push(Q(new WeakSet([u])));X.comeTo({position:Y(u).getImageCenter(),modelId:u.modelId,dur:300,maxDis:15,isFlyToTag:!0}),setTimeout(()=>{j(),n(t+1)},2e3)};return n(0),()=>s=!0};return P(a=>{if(o.selected){const e=()=>r("select",!1),c=I(o.tagging,e),s=n=>n.code==="Escape"&&e();document.documentElement.addEventListener("keyup",s,!1),a(()=>{c(),document.documentElement.removeEventListener("keyup",s,!1)})}}),(a,e)=>{const c=S("ui-icon"),s=S("ui-more"),n=S("ui-group-option");return p(),x(n,{class:N(["sign-tagging",{active:i.selected,edit:i.edit}]),onClick:e[4]||(e[4]=t=>i.edit&&l(V)(i.tagging)&&r("select",!0))},{default:$(()=>[g("div",le,[l(v)?(p(),B("img",{key:0,src:l(U)(l(M)(l(v)))},null,8,oe)):D("",!0),g("div",null,[g("p",null,f(i.tagging.title),1),g("span",null,f(a.$t("tagging.pos"))+"\uFF1A"+f(l(d).length),1)])]),g("div",{class:"actions",onClick:e[3]||(e[3]=b(()=>{},["stop"]))},[i.edit?(p(),B(A,{key:1},[h(c,{type:"pin1",ctrl:"",onClick:e[1]||(e[1]=b(t=>a.$emit("fixed"),["stop"])),tip:a.$t("tagging.pos")},null,8,["tip"]),h(s,{options:_,style:{"margin-left":"20px"},onClick:e[2]||(e[2]=t=>k[t]())})],64)):(p(),x(c,{key:0,type:"pin",ctrl:"",onClick:e[0]||(e[0]=b(t=>a.$emit("select",!0),["stop"])),class:N({disabled:!l(V)(i.tagging)})},null,8,["class"]))])]),_:1},8,["class"])}}});const ge=R(ae,[["__scopeId","data-v-e2a40b1c"]]);export{de as S,ge as T};