platypush/platypush/backend/http/webapp/dist/static/js/3593.e56e04e9.js

2 lines
6.2 KiB
JavaScript

"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[3593,3459],{1583:function(e,t,l){l.d(t,{Z:function(){return f}});var a=l(6252),n=l(3577),i=l(9963);const s={class:"slider-wrapper"},o=["textContent"],r=["textContent"],u={class:"slider-container"},c=["min","max","step","disabled","value"],d={class:"track-inner",ref:"track"},p={class:"thumb",ref:"thumb"},h=["textContent"];function v(e,t,l,v,g,m){return(0,a.wg)(),(0,a.iD)("label",s,[l.withRange?((0,a.wg)(),(0,a.iD)("span",{key:0,class:(0,n.C_)(["range-labels",{"with-label":l.withLabel}])},[l.withRange?((0,a.wg)(),(0,a.iD)("span",{key:0,class:"label left",textContent:(0,n.zw)(l.range[0])},null,8,o)):(0,a.kq)("",!0),l.withRange?((0,a.wg)(),(0,a.iD)("span",{key:1,class:"label right",textContent:(0,n.zw)(l.range[1])},null,8,r)):(0,a.kq)("",!0)],2)):(0,a.kq)("",!0),(0,a._)("span",u,[(0,a._)("input",{class:(0,n.C_)(["slider",{"with-label":l.withLabel}]),type:"range",min:l.range[0],max:l.range[1],step:l.step,disabled:l.disabled,value:l.value,ref:"range",onInput:t[0]||(t[0]=(0,i.iM)(((...e)=>m.onUpdate&&m.onUpdate(...e)),["stop"])),onChange:t[1]||(t[1]=(0,i.iM)(((...e)=>m.onUpdate&&m.onUpdate(...e)),["stop"]))},null,42,c),(0,a._)("div",{class:(0,n.C_)(["track",{"with-label":l.withLabel}])},[(0,a._)("div",d,null,512)],2),(0,a._)("div",p,null,512),l.withLabel?((0,a.wg)(),(0,a.iD)("span",{key:0,class:"label",textContent:(0,n.zw)(l.value),ref:"label"},null,8,h)):(0,a.kq)("",!0)])])}var g={name:"Slider",emits:["input","change","mouseup","mousedown","touchstart","touchend","keyup","keydown"],props:{value:{type:Number},disabled:{type:Boolean,default:!1},range:{type:Array,default:()=>[0,100]},step:{type:Number,default:1},withLabel:{type:Boolean,default:!1},withRange:{type:Boolean,default:!1}},methods:{onUpdate(e){this.update(e.target.value),this.$emit(e.type,{...e,target:{...e.target,value:this.$refs.range.value}})},update(e){const t=this.$refs.range.clientWidth,l=(e-this.range[0])/(this.range[1]-this.range[0]),a=l*t,n=this.$refs.thumb;n.style.left=a-n.clientWidth/2+"px",this.$refs.thumb.style.transform=`translate(-${l}%, -50%)`,this.$refs.track.style.width=`${a}px`}},mounted(){null!=this.value&&this.update(this.value),this.$watch((()=>this.value),(e=>this.update(e)))}},m=l(3744);const y=(0,m.Z)(g,[["render",v],["__scopeId","data-v-28d31846"]]);var f=y},3593:function(e,t,l){l.r(t),l.d(t,{default:function(){return $}});var a=l(6252),n=l(3577),i=l(9963);const s={class:"entity dimmer-container"},o={class:"col-1 icon"},r={class:"col-s-7 col-m-8 label"},u=["textContent"],c={class:"col-s-4 col-m-3 buttons pull-right"},d=["textContent"],p={class:"row"},h={key:0,class:"input"},v={class:"col-10"},g={class:"col-2 value"},m=["value"],y={key:1,class:"input"},f={class:"col-12 value"},w=["value"];function b(e,t,l,b,_,k){const C=(0,a.up)("EntityIcon"),x=(0,a.up)("Slider");return(0,a.wg)(),(0,a.iD)("div",s,[(0,a._)("div",{class:(0,n.C_)(["head",{collapsed:e.collapsed}])},[(0,a._)("div",o,[(0,a.Wm)(C,{entity:e.value,loading:e.loading,error:e.error},null,8,["entity","loading","error"])]),(0,a._)("div",r,[(0,a._)("div",{class:"name",textContent:(0,n.zw)(e.value.name)},null,8,u)]),(0,a._)("div",c,[(0,a._)("button",{onClick:t[0]||(t[0]=(0,i.iM)((t=>e.collapsed=!e.collapsed),["stop"]))},[(0,a._)("i",{class:(0,n.C_)(["fas",{"fa-angle-up":!e.collapsed,"fa-angle-down":e.collapsed}])},null,2)]),null!=k.parsedValue?((0,a.wg)(),(0,a.iD)("span",{key:0,class:"value-percent",textContent:(0,n.zw)(k.parsedValue)},null,8,d)):(0,a.kq)("",!0)])],2),e.collapsed?(0,a.kq)("",!0):((0,a.wg)(),(0,a.iD)("div",{key:0,class:"body",onClick:t[3]||(t[3]=(0,i.iM)(((...e)=>k.prevent&&k.prevent(...e)),["stop"]))},[(0,a._)("div",p,[null!=e.value?.min&&null!=e.value?.max?((0,a.wg)(),(0,a.iD)("div",h,[(0,a._)("div",v,[(0,a.Wm)(x,{range:[e.value.min,e.value.max],"with-range":"",value:e.value.value,onInput:k.setValue},null,8,["range","value","onInput"])]),(0,a._)("div",g,[(0,a._)("input",{type:"number",value:e.value.value,onChange:t[1]||(t[1]=(...e)=>k.setValue&&k.setValue(...e))},null,40,m)])])):((0,a.wg)(),(0,a.iD)("div",y,[(0,a._)("div",f,[(0,a._)("input",{type:"number",value:e.value.value,onChange:t[2]||(t[2]=(...e)=>k.setValue&&k.setValue(...e))},null,40,w)])]))])]))])}var _=l(1583),k=l(7909),C=l(3459),x={name:"Dimmer",components:{Slider:_.Z,EntityIcon:C["default"]},mixins:[k["default"]],computed:{parsedValue(){if(this.value?.is_write_only||null==this.value?.value)return null;let e=this.value.value;return this.value.unit&&(e=`${e} ${this.value.unit}`),e}},methods:{prevent(e){return e.stopPropagation(),!1},async setValue(e){if(e.target.value?.length){this.$emit("loading",!0);try{await this.request("entities.execute",{id:this.value.id,action:"set",value:+e.target.value})}finally{this.$emit("loading",!1)}}}}},I=l(3744);const D=(0,I.Z)(x,[["render",b],["__scopeId","data-v-915be50e"]]);var $=D},3459:function(e,t,l){l.r(t),l.d(t,{default:function(){return h}});var a=l(6252),n=l(3577),i=l(3540);const s={key:0,src:i,class:"loading"},o={key:1,class:"fas fa-circle-exclamation error"};function r(e,t,l,i,r,u){const c=(0,a.up)("Icon");return(0,a.wg)(),(0,a.iD)("div",{class:(0,n.C_)(["entity-icon-container",{"with-color-fill":!!u.colorFill}]),style:(0,n.j5)(u.colorFillStyle)},[l.loading?((0,a.wg)(),(0,a.iD)("img",s)):l.error?((0,a.wg)(),(0,a.iD)("i",o)):((0,a.wg)(),(0,a.j4)(c,(0,n.vs)((0,a.dG)({key:2},u.computedIconNormalized)),null,16))],6)}var u=l(1478),c={name:"EntityIcon",components:{Icon:u.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=l(3744);const p=(0,d.Z)(c,[["render",r],["__scopeId","data-v-4fad24e6"]]);var h=p},3540:function(e,t,l){e.exports=l.p+"static/img/spinner.c0bee445.gif"}}]);
//# sourceMappingURL=3593.e56e04e9.js.map