UNPKG

zwave-js-ui

Version:

Z-Wave Control Panel and MQTT Gateway

3 lines (2 loc) 13.5 kB
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ExpandedNode-DkVECifD.js","./index-DwzE-W2i.js","./index-B2zoqM3Y.css","./VTextarea-DtC2nuOc.js","./VTextarea-DyGjqrlm.css","./ExpandedNode-Bq-MvLVB.css","./RichValue-CgCQhKXQ.js","./RichValue-C1OidLuR.css","./StatisticsArrows-CqPYeYu2.js","./StatisticsArrows-Bzojvm2s.css","./ReinterviewBadge-DqLicNzJ.js","./FirmwareUpdateBadge-CYIZ5638.js"])))=>i.map(i=>d[i]); import{a4 as J,bl as E,bm as O,a3 as ge,a5 as fe,bn as j,bo as ye,a6 as be,b as a,W as ve,n as we,bp as he,bq as xe,br as Ve,bs as _e,bt as Pe,bu as ke,H as c,bv as Se,_ as De,a as Ie,d as w,s as h,e as S,z as p,w as s,u as x,V,c as D,P as Ce,an as Be,f as I,F as $,o as L,G,q as M,k as _,t as g,am as W,bw as Re,bx as Ne,T as ze,af as K,by as Te,l as C,D as Le,K as Ae,bz as Ee,i as Z,a7 as Fe,ag as Ue,b2 as Oe,b8 as je,b4 as A,ba as $e,bb as Ge,bc as Me,bA as We,bB as Ke,b3 as q,b5 as Ze,b6 as qe,b7 as He,bC as Je,bD as H,bE as Qe,j as Xe,x as Ye,y as P,bd as et,be as tt,bf as at,bg as st,bh as rt,bi as ot,bj as lt}from"./index-DwzE-W2i.js";import{c as i}from"./colors-DoZdCu1D.js";import{c as it,a as nt,p as dt,b as ut,u as ct,d as mt,e as pt,f as gt,g as ft,h as yt,i as bt,m as vt,j as wt,k as ht,l as xt,n as Vt}from"./sort-C8HQTCiq.js";import{V as _t}from"./VFab-BoiUHyPJ.js";const Pt=J({items:{type:Array,default:()=>[]},itemValue:{type:[String,Array,Function],default:"id"},itemSelectable:{type:[String,Array,Function],default:null},returnObject:Boolean},"DataIterator-items");function kt(t,e){const r=t.returnObject?e:O(e,t.itemValue),d=O(e,t.itemSelectable,!0);return{type:"item",value:r,selectable:d,raw:e}}function St(t,e){const r=[];for(const d of e)r.push(kt(t,d));return r}function Dt(t){return{items:E(()=>St(t,t.items))}}const It=J({search:String,loading:Boolean,..._e(),...Pt(),...Vt(),...xt(),...ht({itemsPerPage:5}),...wt(),...vt(),...Ve(),...xe(),...he({transition:{component:Pe,hideOnLeave:!0}})},"VDataIterator"),Ct=ge()({name:"VDataIterator",props:It(),emits:{"update:modelValue":t=>!0,"update:groupBy":t=>!0,"update:page":t=>!0,"update:itemsPerPage":t=>!0,"update:sortBy":t=>!0,"update:options":t=>!0,"update:expanded":t=>!0,"update:currentItems":t=>!0},setup(t,e){let{slots:r}=e;const d=fe(t,"groupBy"),l=j(()=>t.search),{items:u}=Dt(t),{filteredItems:m}=ye(t,u,l,{transform:v=>v.raw}),{sortBy:f,multiSort:B,mustSort:R}=it(t),{page:y,itemsPerPage:n}=nt(t),{toggleSort:k}=dt({sortBy:f,multiSort:B,mustSort:R,page:y}),{sortByWithGroups:N,opened:o,extractRows:b,isGroupOpen:Q,toggleGroup:X}=ut({groupBy:d,sortBy:f}),{sortedItems:Y}=ct(t,m,N,{transform:v=>v.raw}),{flatItems:F}=mt(Y,d,o,!1),ee=j(()=>F.value.length),{startIndex:te,stopIndex:ae,pageCount:se,prevPage:re,nextPage:oe,setItemsPerPage:le,setPage:ie}=pt({page:y,itemsPerPage:n,itemsLength:ee}),{paginatedItems:z}=gt({items:F,startIndex:te,stopIndex:ae,itemsPerPage:n}),U=E(()=>b(z.value)),{isSelected:ne,select:de,selectAll:ue,toggleSelect:ce}=ft(t,{allItems:u,currentPage:U}),{isExpanded:me,toggleExpand:pe}=yt(t);bt({page:y,itemsPerPage:n,sortBy:f,groupBy:d,search:l});const T=E(()=>({page:y.value,itemsPerPage:n.value,sortBy:f.value,pageCount:se.value,toggleSort:k,prevPage:re,nextPage:oe,setPage:ie,setItemsPerPage:le,isSelected:ne,select:de,selectAll:ue,toggleSelect:ce,isExpanded:me,toggleExpand:pe,isGroupOpen:Q,toggleGroup:X,items:U.value,itemsCount:m.value.length,groupedItems:z.value}));return be(()=>a(t.tag,{class:we(["v-data-iterator",{"v-data-iterator--loading":t.loading},t.class]),style:ve(t.style)},{default:()=>[r.header?.(T.value),a(ke,{transition:t.transition},{default:()=>[t.loading?a(Se,{key:"loader",name:"v-data-iterator",active:!0},{default:v=>r.loader?.(v)}):c("div",{key:"items"},[z.value.length?r.default?.(T.value):r["no-data"]?.()])]}),r.footer?.(T.value)]})),{}}}),Bt={props:{socket:Object},components:{ExpandedNode:w(()=>P(()=>import("./ExpandedNode-DkVECifD.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)),RichValue:w(()=>P(()=>import("./RichValue-CgCQhKXQ.js"),__vite__mapDeps([6,1,2,7]),import.meta.url)),StatisticsArrows:w(()=>P(()=>import("./StatisticsArrows-CqPYeYu2.js"),__vite__mapDeps([8,1,2,9]),import.meta.url)),ReinterviewBadge:w(()=>P(()=>import("./ReinterviewBadge-DqLicNzJ.js"),__vite__mapDeps([10,1,2]),import.meta.url)),FirmwareUpdateBadge:w(()=>P(()=>import("./FirmwareUpdateBadge-CYIZ5638.js"),__vite__mapDeps([11,1,2]),import.meta.url))},watch:{selected(){this.$emit("selected",this.selected)}},computed:{...Ie(Ye,["nodes"]),sortingRules(){return[{key:this.sortBy.toLowerCase(),order:this.sortDesc?"desc":"asc"}]}},data(){return{search:"",sortBy:"id",keys:[{title:"ID",value:"id"},{title:"Name",value:"name"},{title:"Location",value:"loc"},{title:"Status",value:"status"},{title:"Ready",value:"ready"}],sortDesc:!1,selected:[],loading:!1,expandedNode:null,expandedNodeDialog:!1}},methods:{padId(t){return t.toString().padStart(3,"0")},nodeInfo(t){return Xe({Manufacturer:t.manufacturer,"Product Description":t.productDescription,"Product Label":t.productLabel,"Zwave+ Version":t.zwavePlusVersion||"N/A"})},showNodeDialog(t){this.expandedNode=t,this.expandedNodeDialog=!0},closeDialog(){this.expandedNode=null,this.expandedNodeDialog=!1},getProgress(t){return t.firmwareUpdate?Math.round(t.firmwareUpdate.sentFragments/t.firmwareUpdate.totalFragments*100):null},readyRichValue(t){const e=t.ready||!1;let r={align:"center",icon:"",iconStyle:`color: ${i.grey.base}`,description:e?"Ready":"Not ready",size:18};return e?(r.icon=q,r.iconStyle=`color: ${i.green.base}`):(r.icon=H,r.iconStyle=`color: ${i.red.base}`),r},rebuildRoutesRichValue(t){const e=t.rebuildRoutesProgress||"done";let r={align:"center",icon:"",iconStyle:`color: ${i.grey.base}`,description:"Rebuild routes "+e,size:18};switch(e){case"done":r.icon=Qe,r.iconStyle=`color: ${i.green.base}`;break;case"failed":r.icon=H,r.iconStyle=`color: ${i.red.base}`;break;case"skipped":r.icon=Je,r.iconStyle=`color: ${i.blue.base}`;break;case"pending":r.loading=!0}return r},statusRichValue(t){let e={align:"center",icon:A,iconStyle:`color: ${i.grey.base}`,description:t.status,size:40};switch(t.status){case"Asleep":e.icon=He,e.iconStyle=`color: ${i.orange.base}`;break;case"Awake":e.icon=qe,e.iconStyle=`color: ${i.green.base}`;break;case"Dead":e.icon=Ze,e.iconStyle=`color: ${i.red.base}`;break;case"Alive":e.icon=q,e.iconStyle=`color: ${i.green.base}`;break}return e},securityRichValue(t){let e={align:"center",icon:A,iconStyle:`color: ${i.grey.base}`,description:"Unknown security status",size:18};return t.isSecure===!0?(e.icon=We,e.iconStyle=t.security==="S0_Legacy"?`color: ${i.orange.base}`:`color: ${i.green.base}`,e.description=t.security):t.isSecure===!1&&(e.icon=Ke,e.iconStyle=`color: ${i.red.base}`,e.description="No security"),e},zwavePlusRichValue(t){let e={align:"center",icon:t.ready?je:A,iconStyle:t.ready?`color: ${i.red.base}`:"color: grey",description:t.ready?"No":"Unknown ZWave+ version",size:18};return t.zwavePlusVersion===void 0||(e.description=`ZWave+ version: ${t.zwavePlusVersion}`,e.iconStyle=`color: ${i.green.base}`,t.zwavePlusVersion===1?e.icon=$e:t.zwavePlusVersion===2?e.icon=Ge:(e.icon=Me,e.displayValue=`${t.zwavePlusVersion}`)),e},powerRichValue(t){let e=t.minBatteryLevel,r=`color: ${i.green.base};`,d="",l="";return t.isListening?(d=et,l="Main power source"):(l=Oe(t),e==null?(d=tt,l="Battery level: unknown",r=`color: ${i.grey.base}`):e<=10?(d=at,r=`color: ${i.red.base}`):e<=30?(d=st,r=`color: ${i.orange.base}`):e<=70?d=rt:e<=90?d=ot:d=lt),{align:"center",icon:d,size:18,iconStyle:r,displayStyle:"",description:l,rawValue:e}}}},Rt={class:"my-2 d-flex justify-center",style:{"column-gap":"10px","flex-wrap":"wrap"}},Nt=["onClick"],zt={class:"text-caption pb-0 font-weight-bold text-primary text-truncate text-capitalize"},Tt={class:"text-caption pb-0 font-weight-bold text-truncate text-capitalize"},Lt=["textContent"],At={key:2,class:"mt-2"},Et={class:"text-caption font-weight-bold mb-0 mt-1"};function Ft(t,e,r,d,l,u){const m=h("rich-value"),f=h("reinterview-badge"),B=h("firmware-update-badge"),R=h("statistics-arrows"),y=h("expanded-node");return p(),S(x,{fluid:"",class:"fill pa-0"},{default:s(()=>[a(Ct,{loading:l.loading,items:t.nodes,search:l.search,modelValue:l.selected,"onUpdate:modelValue":e[4]||(e[4]=n=>l.selected=n),"item-key":"id","sort-by":u.sortingRules,"hide-default-footer":"",itemsPerPage:-1},{header:s(()=>[c("div",Rt,[c("div",null,[a(Le,{modelValue:l.search,"onUpdate:modelValue":e[0]||(e[0]=n=>l.search=n),clearable:"",flat:"",variant:"solo-inverted","hide-details":"","single-line":"",class:"mx-auto my-1",style:{"max-width":"250px","min-width":"250px"},"prepend-inner-icon":"search",label:"Search"},null,8,["modelValue"])]),c("div",null,[a(Ae,{modelValue:l.sortBy,"onUpdate:modelValue":e[1]||(e[1]=n=>l.sortBy=n),flat:"",variant:"solo-inverted","single-line":"","hide-details":"",class:"mx-auto my-1",style:{"max-width":"150px"},items:l.keys,"prepend-inner-icon":"sort",label:"Sort by"},null,8,["modelValue","items"])]),c("div",null,[a(Ee,{class:"mx-auto my-2",modelValue:l.sortDesc,"onUpdate:modelValue":e[2]||(e[2]=n=>l.sortDesc=n),mandatory:""},{default:s(()=>[a(Z,{variant:"flat",modelValue:!1},{default:s(()=>[a(C,null,{default:s(()=>[...e[8]||(e[8]=[_("arrow_upward",-1)])]),_:1})]),_:1}),a(Z,{variant:"flat",modelValue:!0},{default:s(()=>[a(C,null,{default:s(()=>[...e[9]||(e[9]=[_("arrow_downward",-1)])]),_:1})]),_:1})]),_:1},8,["modelValue"])])])]),"no-data":s(()=>[a(x,null,{default:s(()=>[a(V,{class:"pa-0"},{default:s(()=>[a(I,{cols:"12",class:"text-center"},{default:s(()=>[a(C,{class:"text-h1"},{default:s(()=>[...e[10]||(e[10]=[_("search",-1)])]),_:1}),e[11]||(e[11]=c("h3",{class:"font-weight-light"},"No nodes Found",-1))]),_:1})]),_:1})]),_:1})]),"no-results":s(()=>[a(x,null,{default:s(()=>[a(V,{class:"pa-0"},{default:s(()=>[a(I,{cols:"12",class:"text-center"},{default:s(()=>[a(C,{class:"text-h1"},{default:s(()=>[...e[12]||(e[12]=[_("search",-1)])]),_:1}),e[13]||(e[13]=c("h3",{class:"font-weight-light"},"No nodes Found",-1))]),_:1})]),_:1})]),_:1})]),loading:s(()=>[a(x,null,{default:s(()=>[a(V,{class:"pa-0"},{default:s(()=>[a(I,{cols:"12",class:"text-center"},{default:s(()=>[e[14]||(e[14]=c("h3",{class:"font-weight-light"},"Loading Nodes...",-1)),a(K,{indeterminate:""})]),_:1})]),_:1})]),_:1})]),default:s(({items:n,isSelected:k,select:N})=>[a(x,{style:{"min-height":"600px"}},{default:s(()=>[a(V,{justify:"center",class:"pa-0"},{default:s(()=>[(p(!0),D(Ce,null,Be(n,o=>(p(),S(I,{key:o.raw.id,width:"170px",style:{"max-width":"170px"}},{default:s(()=>[a($,{onClick:L(b=>u.showNodeDialog(o.raw),["stop"]),hover:"",border:"",height:"150",width:"150",color:k(o)?t.$vuetify.theme.current.colors.primary:t.$vuetify.theme.current.colors.surface},{default:s(()=>[a(G,{class:"text-center pa-1 d-flex flex-column"},{default:s(()=>[a(V,{class:"pa-0 ma-0",justify:"space-between"},{default:s(()=>[M((p(),D("strong",{onClick:L(b=>N([o],!k(o)),["stop"]),style:{"font-size":"14px","line-height":"1.3",padding:"2px",border:"1px solid #ccc","border-radius":"4px"}},[_(g(u.padId(o.raw.id)),1)],8,Nt)),[[W,"Click to select","bottom"]]),a(m,{value:u.powerRichValue(o.raw)},null,8,["value"]),a(m,{value:u.rebuildRoutesRichValue(o.raw)},null,8,["value"]),a(m,{value:u.securityRichValue(o.raw)},null,8,["value"]),a(m,{value:u.readyRichValue(o.raw)},null,8,["value"])]),_:2},1024),c("span",zt,g(o.raw._name||"---"),1),c("span",Tt,g(o.raw.loc||"‍"),1),o.raw.interviewStage==="Complete"?(p(),S(Re,{key:0,class:"align-self-center",bordered:"","offset-y":"2",content:"v"+o.raw.firmwareVersion,"model-value":!!o.raw.firmwareVersion},{default:s(()=>[c("div",null,[a(Ne,{location:"bottom"},{activator:s(({props:b})=>[c("div",ze({ref_for:!0},b,{class:"text-h4"}),[a(m,{value:u.statusRichValue(o.raw)},null,8,["value"])],16)]),default:s(()=>[c("span",{style:{"white-space":"pre-wrap"},textContent:g(u.nodeInfo(o.raw))},null,8,Lt)]),_:2},1024),a(f,{node:o.raw,"b-style":{position:"absolute",top:"0",left:"31px"}},null,8,["node"]),a(B,{node:o.raw,"b-style":{position:"absolute",top:"0",left:"54px"}},null,8,["node"])])]),_:2},1032,["content","model-value"])):(p(),D("div",{key:1,onClick:e[3]||(e[3]=L(()=>{},["stop"])),class:"text-center"},[M(a(K,{indeterminate:"",class:"ma-1",size:"32",color:"primary"},null,512),[[W,"Interview stage: "+o.raw.interviewStage,"bottom"]])])),o.raw.firmwareUpdate&&!o.raw.isControllerNode?(p(),D("div",At,[a(Te,{"model-value":o.raw.firmwareUpdate.progress,height:"5",class:"mt-1",color:"primary"},null,8,["model-value"]),c("p",Et,g(o.raw.firmwareUpdate.currentFile)+"/"+g(o.raw.firmwareUpdate.totalFiles)+": "+g(u.getProgress(o.raw))+"% ",1)])):(p(),S(R,{key:3,node:o.raw},null,8,["node"]))]),_:2},1024)]),_:2},1032,["onClick","color"])]),_:2},1024))),128))]),_:2},1024)]),_:2},1024)]),_:1},8,["loading","items","search","modelValue","sort-by"]),a(Fe,{fullscreen:t.$vuetify.display.xs,"max-width":"1200px",modelValue:l.expandedNodeDialog,"onUpdate:modelValue":e[6]||(e[6]=n=>l.expandedNodeDialog=n),onKeydown:e[7]||(e[7]=Ue(n=>u.closeDialog(),["exit"]))},{default:s(()=>[a($,{"min-height":"90vh"},{default:s(()=>[a(_t,{style:{position:"absolute",right:"5px",top:"5px"},size:"small",variant:"text",onClick:e[5]||(e[5]=n=>u.closeDialog()),icon:"close"}),a(G,{class:"pt-5"},{default:s(()=>[a(y,{node:l.expandedNode,socket:r.socket},null,8,["node","socket"])]),_:1})]),_:1})]),_:1},8,["fullscreen","modelValue"])]),_:1})}const Gt=De(Bt,[["render",Ft]]);export{Gt as default};