import{E}from"./el-checkbox-Cxc7yQYm.js";import{d as C,o as i,a0 as L,w as $,aF as B,q as w,O as S,c as f,I as g,J as y,z as N,bj as z,r as c,n as D,G as b,m as I,e as H}from"./index-XuO881sr.js";import"./omit-nuy_stBf.js";import"./_baseClone-CIlxLVYA.js";const M=["onClick"],R={class:"item-list"},T=C({__name:"index",props:{menu:{}},emits:["select"],setup(h,{expose:_,emit:p}){const x=p,t=c(!1),l=c(0),u=c(0),r=c(),d=c(null),n=async(e,m)=>{if(e.preventDefault(),l.value=e.clientX,u.value=e.clientY,t.value=!0,await D(),!r.value)return;const s=r.value.getBoundingClientRect();let a=e.clientX,v=e.clientY;a+s.width>window.innerWidth&&(a=window.innerWidth-s.width-8),v+s.height>window.innerHeight&&(v=window.innerHeight-s.height-8),v<8&&(v=8),a<8&&(a=8),l.value=a,u.value=v,setTimeout(()=>{t.value=!0,document.addEventListener("click",o),document.addEventListener("contextmenu",o),d.value=m},10)},o=()=>{t.value=!1,document.removeEventListener("click",o),document.removeEventListener("contextmenu",o)},k=e=>{x("select",{type:e.value,value:d.value}),o()};return _({open:n}),(e,m)=>(i(),L(z,{to:"body"},[$(w("div",{ref_key:"menuRef",ref:r,class:"context-menu",style:S({left:`${l.value}px`,top:`${u.value}px`,zIndex:999999})},[(i(!0),f(g,null,y(h.menu,s=>(i(),f("div",{class:"item",key:s.label,onClick:a=>k(s)},[w("div",R,N(s.label),1)],8,M))),128))],4),[[B,t.value]])]))}}),F=b(T,[["__scopeId","data-v-26a7d1bd"]]),V={class:"house-list"},W=["onContextmenu"],X=C({__name:"houseItem",props:{unit:{},fIdx:{},menuList:{}},emits:["change","contextmenufun"],setup(h,{emit:_}){const p=h,x=p.unit.find(n=>n.floorNo===p.fIdx),t=c([]),l=c(),u=n=>{d("contextmenufun",n)};function r(n){t.value=t.value.includes(n.houseId)?t.value.filter(o=>o!==n.houseId):t.value.concat(n.houseId),d("change",t.value)}const d=_;return(n,o)=>{const k=E;return i(),f("div",V,[(i(!0),f(g,null,y(H(x).houses,e=>(i(),f("div",{class:"house flex align-center",onContextmenu:m=>l.value.open(m,e.houseId),key:e.houseId},[I(k,{onClick:m=>r(e),label:e.houseNo,value:e.houseId},null,8,["onClick","label","value"])],40,W))),128)),I(F,{ref_key:"contextMenu",ref:l,menu:h.menuList,onSelect:u},null,8,["menu"])])}}}),J=b(X,[["__scopeId","data-v-1a0fee28"]]);export{J as default};
