index-C-IrQJDk.js 1.6 KB

1
  1. import{M as _}from"./index-AOcxwHT9.js";import{ae as k,ag as c,bo as M,aQ as C,aR as I,ah as d,ai as v,aj as w,ak as B,al as f,am as R,an as p,au as D,aW as S,aY as b,b9 as F,aX as K,b7 as N}from"./index-D68iA7pN.js";import{u as T}from"./hooks-Bm-hi6ta.js";const U={class:"d-flex algin-center"},X=k({__name:"index",setup(W){const{dialog:o}=T(),{isShow:i}=o,m=c(!1);o.onReveal(l=>{m.value=!!l.isMultiple});const x=M(),{list:h}=C(x),a=c([]),r=I(()=>h.value.filter(e=>e.name).map(({name:e})=>e)),n=c(""),V=()=>{n.value===""?a.value=[]:a.value=[r.value.findIndex(l=>l.toLocaleLowerCase()===n.value.toLocaleLowerCase())]},y=[{name:"确定",fun:()=>{o.confirm(a.value.map(l=>r.value[l]))},primary:!0},{name:"关闭",fun:()=>o.showDialog(!1)}],L=(l,e)=>{if(m.value){if(l.ctrlKey)a.value.indexOf(e)===-1?a.value=[...a.value,e]:a.value=a.value.filter(s=>s!==e);else if(l.shiftKey){const t=a.value;let s=Math.min(...t),u=Math.max(...t);s>e?s=e:u=e,a.value=r.value.map((j,g)=>g).slice(s,u+1)}}else a.value=[e]};return(l,e)=>(f(),d(_,{maxWidth:"400px",ref:"layerDialog",modelValue:w(i),"onUpdate:modelValue":e[1]||(e[1]=t=>B(i)?i.value=t:null),title:"选择图层",footerBtnList:y},{default:v(()=>[R("div",U,[p(D,{placeholder:l.t("目标图层"),modelValue:n.value,"onUpdate:modelValue":[e[0]||(e[0]=t=>n.value=t),V]},null,8,["placeholder","modelValue"])]),p(N,{density:"compact",color:"primary",style:{height:"300px"}},{default:v(()=>[(f(!0),S(K,null,b(r.value,(t,s)=>(f(),d(F,{class:"ma-0",title:t,ref_for:!0,ref:"refItems",key:s,onClick:u=>L(u,s),active:a.value.includes(s)},null,8,["title","onClick","active"]))),128))]),_:1})]),_:1},8,["modelValue"]))}});export{X as default};