platypush/platypush/backend/http/webapp/dist/static/js/9651.2bef8385.js

2 lines
3.2 KiB
JavaScript

"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[9651,3459],{9651:function(e,t,o){o.r(t),o.d(t,{default:function(){return g}});var l=o(6252),n=o(3577);const r={class:"entity battery-container"},c={class:"head"},a={class:"col-1 icon"},i={class:"col-s-8 col-m-9 label"},s=["textContent"],u={class:"col-s-3 col-m-2 buttons pull-right"},d=["textContent"];function p(e,t,o,p,v,f){const h=(0,l.up)("EntityIcon");return(0,l.wg)(),(0,l.iD)("div",r,[(0,l._)("div",c,[(0,l._)("div",a,[(0,l.Wm)(h,{entity:e.value,icon:f.icon,loading:e.loading,error:e.error},null,8,["entity","icon","loading","error"])]),(0,l._)("div",i,[(0,l._)("div",{class:"name",textContent:(0,n.zw)(e.value.name)},null,8,s)]),(0,l._)("div",u,[null!=f.valuePercent?((0,l.wg)(),(0,l.iD)("span",{key:0,class:"value-percent",textContent:(0,n.zw)(f.valuePercent+"%")},null,8,d)):(0,l.kq)("",!0)])])])}var v=o(7909),f=o(3459);const h=[{iconClass:"full",color:"#157145",value:.9},{iconClass:"three-quarters",color:"#94C595",value:.825},{iconClass:"half",color:"#F0B67F",value:.625},{iconClass:"quarter",color:"#FE5F55",value:.375},{iconClass:"low",color:"#CC444B",value:.15},{iconClass:"empty",color:"#EC0B43",value:.05}];var y={name:"Battery",components:{EntityIcon:f["default"]},mixins:[v["default"]],computed:{valuePercent(){if(null==this.value?.value)return null;const e=this.value.min||0,t=this.value.max||100;return(100*this.value.value/(t-e)).toFixed(0)},icon(){const e={...this.value.meta?.icon||{}};let t=this.valuePercent,o=h[0];if(null!=t){t=parseFloat(t)/100;for(const e of h){if(t>e.value)break;o=e}}return e["class"]=`fas fa-battery-${o.iconClass}`,e["color"]=o.color,e}},methods:{prevent(e){return e.stopPropagation(),!1}}},m=o(3744);const C=(0,m.Z)(y,[["render",p],["__scopeId","data-v-fb9c9926"]]);var g=C},3459:function(e,t,o){o.r(t),o.d(t,{default:function(){return v}});var l=o(6252),n=o(3577),r=o(3540);const c={key:0,src:r,class:"loading"},a={key:1,class:"fas fa-circle-exclamation error"};function i(e,t,o,r,i,s){const u=(0,l.up)("Icon");return(0,l.wg)(),(0,l.iD)("div",{class:(0,n.C_)(["entity-icon-container",{"with-color-fill":!!s.colorFill}]),style:(0,n.j5)(s.colorFillStyle)},[o.loading?((0,l.wg)(),(0,l.iD)("img",c)):o.error?((0,l.wg)(),(0,l.iD)("i",a)):((0,l.wg)(),(0,l.j4)(u,(0,n.vs)((0,l.dG)({key:2},s.computedIconNormalized)),null,16))],6)}var s=o(1478),u={name:"EntityIcon",components:{Icon:s.Z},props:{loading:{type:Boolean,default:!1},error:{type:Boolean,default:!1},entity:{type:Object,required:!0},icon:{type:Object,default:()=>{}},hasColorFill:{type:Boolean,default:!1}},data(){return{component:null,modalVisible:!1}},computed:{computedIcon(){let e={...this.entity?.meta?.icon||{}};return Object.keys(this.icon||{}).length&&(e=this.icon),{...e}},colorFill(){return this.hasColorFill&&this.computedIcon.color},colorFillStyle(){return this.colorFill&&!this.error?{background:this.colorFill}:{}},computedIconNormalized(){const e={...this.computedIcon};return this.colorFill&&delete e.color,e},type(){let e=this.entity.type||"";return e.charAt(0).toUpperCase()+e.slice(1)}}},d=o(3744);const p=(0,d.Z)(u,[["render",i],["__scopeId","data-v-4fad24e6"]]);var v=p},3540:function(e,t,o){e.exports=o.p+"static/img/spinner.c0bee445.gif"}}]);
//# sourceMappingURL=9651.2bef8385.js.map