zwave-js-ui
Version:
Z-Wave Control Panel and MQTT Gateway
3 lines (2 loc) • 4.04 kB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ZwaveGraph-BY_l7AIV.js","./index-B9yS4Bcc.js","./index-Bm7DxUwf.css","./VExpansionPanels-BZZ3W0eQ.js","./VExpansionPanels-RsCANmDP.css","./index-_vbXjPry.js","./ZwaveGraph-CV956Kpy.css","./NodePanel-o286ziPB.js","./vuedraggable.umd-f8uV7t38.js","./NodePanel-C--3J2AU.css"])))=>i.map(i=>d[i]);
import{a2 as v,a3 as k,a4 as P,a5 as y,a6 as N,a7 as h,b as l,$ as C,_ as T,I as x,d as f,m as D,u as _,a as S,a8 as A,l as c,w as d,V as B,a9 as I,r as w,o as m,O as L,N as U,z as g}from"./index-B9yS4Bcc.js";const E=v({inset:Boolean,...k({transition:"bottom-sheet-transition"})},"VBottomSheet"),R=P()({name:"VBottomSheet",props:E(),emits:{"update:modelValue":e=>!0},setup(e,s){let{slots:n}=s;const a=y(e,"modelValue");return N(()=>{const o=h.filterProps(e);return l(h,C(o,{contentClass:["v-bottom-sheet__content",e.contentClass],modelValue:a.value,"onUpdate:modelValue":i=>a.value=i,class:["v-bottom-sheet",{"v-bottom-sheet--inset":e.inset},e.class],style:e.style}),n)}),{}}}),p={name:"Mesh",mixins:[x],props:{socket:Object},components:{ZwaveGraph:f(()=>g(()=>import("./ZwaveGraph-BY_l7AIV.js"),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)),NodePanel:f(()=>g(()=>import("./NodePanel-o286ziPB.js"),__vite__mapDeps([7,1,2,8,9]),import.meta.url))},computed:{...D(_,["nodes"])},documentListeners:{},data(){return{selectedNode:null,showProperties:!1}},methods:{...S(_,["showSnackbar","setNeighbors"]),setInitialPosition(e){const s=window.innerHeight,n=window.innerWidth,a=e.offsetHeight,o=e.offsetWidth;let i=(s-a)/2-50,t=(n-o)/10;i<0&&(i=10),t<0&&(t=10),e.style.top=i+"px",e.style.left=t+"px"},makeDivDraggable(){const e=document.getElementById("properties");if(!e||e.hasAttribute("data-draggable"))return;e.setAttribute("data-draggable",!0),setTimeout(()=>{this.setInitialPosition(e)},100);let s=0,n=0;e.onmousedown=a;function a(t){t=t||window.event,!t.target.classList.contains("handle")&&(t.preventDefault(),!t.target.classList.contains("u-over")&&(s=t.clientX,n=t.clientY,document.onmouseup=i,document.onmousemove=o))}function o(t){t=t||window.event,t.preventDefault();const u=s-t.clientX,r=n-t.clientY;s=t.clientX,n=t.clientY,e.style.top=e.offsetTop-r+"px",e.style.left=e.offsetLeft-u+"px"}function i(){document.onmouseup=null,document.onmousemove=null}},async nodeClick(e){this.selectedNode=this.selectedNode===e?null:e,this.showProperties=!!this.selectedNode,this.$vuetify.display.mdAndUp&&this.showProperties&&(await A(),this.makeDivDraggable())},debounceRefresh(){this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=setTimeout(this.refresh.bind(this),500)},async refresh(){const e=await this.app.apiRequest("refreshNeighbors",[],{infoSnack:!1,errorSnack:!1});e.success&&(this.showSnackbar("Nodes Neighbors updated","success"),this.setNeighbors(e.result))}},mounted(){this.debounceRefresh()},beforeUnmount(){this.refreshTimeout&&clearTimeout(this.refreshTimeout)}},V=()=>{I(e=>({"281cad7f":e.$vuetify.theme.current.colors.surface}))},b=p.setup;p.setup=b?(e,s)=>(V(),b(e,s)):V;function M(e,s,n,a,o,i){const t=w("zwave-graph"),u=w("node-panel");return m(),c(B,{class:"fill",fluid:""},{default:d(()=>[l(t,{ref:"mesh",id:"mesh",nodes:e.nodes,onNodeClick:i.nodeClick},null,8,["nodes","onNodeClick"]),e.$vuetify.display.mdAndUp?(m(),c(u,{key:0,node:o.selectedNode,socket:n.socket,modelValue:o.showProperties,"onUpdate:modelValue":s[0]||(s[0]=r=>o.showProperties=r),id:"properties",draggable:"",class:"details"},null,8,["node","socket","modelValue"])):(m(),c(R,{key:1,scrollable:"",modelValue:o.showProperties,"onUpdate:modelValue":s[2]||(s[2]=r=>o.showProperties=r)},{default:d(()=>[l(U,{scrollable:"",class:"text-center"},{default:d(()=>[l(L,null,{default:d(()=>[l(u,{node:o.selectedNode,socket:n.socket,modelValue:o.showProperties,"onUpdate:modelValue":s[1]||(s[1]=r=>o.showProperties=r)},null,8,["node","socket","modelValue"])]),_:1})]),_:1})]),_:1},8,["modelValue"]))]),_:1})}const O=T(p,[["render",M],["__scopeId","data-v-b648b1a2"]]);export{O as default};