import{F as e}from"./element-plus-DSMJnpwa.js";import{d as t}from"./index-mv7arXuk.js";/* empty css                    */import{B as n,H as s,I as u,V as l,_ as o,P as a,Q as i,L as d,F as c,ab as m,Z as r,T as v,d as p,n as f,M as h,u as x}from"./vue-vendor-DZekML78.js";import"./utils-cPVb2Haz.js";const w=["onClick"],_={class:"item-list"},I=t(n({__name:"index",props:{menu:{}},emits:["select"],setup(e,{expose:t,emit:n}){const h=n,x=p(!1),I=p(0),k=p(0),b=p(),y=p(null),g=()=>{x.value=!1,document.removeEventListener("click",g),document.removeEventListener("contextmenu",g)};return t({open:async(e,t)=>{if(e.preventDefault(),I.value=e.clientX,k.value=e.clientY,x.value=!0,await f(),!b.value)return;const n=b.value.getBoundingClientRect();let s=e.clientX,u=e.clientY;s+n.width>window.innerWidth&&(s=window.innerWidth-n.width-8),u+n.height>window.innerHeight&&(u=window.innerHeight-n.height-8),u<8&&(u=8),s<8&&(s=8),I.value=s,k.value=u,setTimeout(()=>{x.value=!0,document.addEventListener("click",g),document.addEventListener("contextmenu",g),y.value=t},10)}}),(t,n)=>(s(),u(v,{to:"body"},[l(a("div",{ref_key:"menuRef",ref:b,class:"context-menu",style:i({left:`${I.value}px`,top:`${k.value}px`,zIndex:999999})},[(s(!0),d(c,null,m(e.menu,e=>(s(),d("div",{class:"item",key:e.label,onClick:t=>(e=>{h("select",{type:e.value,value:y.value}),g()})(e)},[a("div",_,r(e.label),1)],8,w))),128))],4),[[o,x.value]])]))}}),[["__scopeId","data-v-ba50a12d"]]),k={class:"house-list"},b=["onContextmenu"],y=t(n({__name:"houseItem",props:{unit:{},fIdx:{},menuList:{}},emits:["contextmenufun"],setup(t,{emit:n}){const u=t,l=u.unit.find(e=>e.floorNo===u.fIdx)??{floorNo:"",houses:[]},o=p(),a=e=>{i("contextmenufun",e)},i=n;return(n,u)=>{const i=e;return s(),d("div",k,[(s(!0),d(c,null,m(x(l).houses,e=>(s(),d("div",{class:"house flex align-center",onContextmenu:t=>o.value.open(t,e.houseId),key:e.houseId},[h(i,{label:e.houseNo,value:e.houseId},null,8,["label","value"])],40,b))),128)),h(I,{ref_key:"contextMenu",ref:o,menu:t.menuList,onSelect:a},null,8,["menu"])])}}}),[["__scopeId","data-v-31a42ee9"]]);export{y as default};
