platypush/platypush/backend/http/webapp/dist/static/js/818.3f4c9ffa.js

2 lines
3.6 KiB
JavaScript

"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[818,3673],{3673:function(e,t,l){l.r(t),l.d(t,{default:function(){return v}});var n=l(6252),o=l(3577),a=l(3540);const i={key:0,src:a,class:"loading"},s={key:1,class:"fas fa-circle-exclamation error"};function r(e,t,l,a,r,c){const u=(0,n.up)("Icon");return(0,n.wg)(),(0,n.iD)("div",{class:(0,o.C_)(["entity-icon-container",{"with-color-fill":!!c.colorFill}]),style:(0,o.j5)(c.colorFillStyle)},[l.loading?((0,n.wg)(),(0,n.iD)("img",i)):l.error?((0,n.wg)(),(0,n.iD)("i",s)):((0,n.wg)(),(0,n.j4)(u,(0,o.vs)((0,n.dG)({key:2},c.computedIcon)),null,16))],6)}var c=l(1478),u={name:"EntityIcon",components:{Icon:c.Z},props:{loading:{type:Boolean,default:!1},error:{type:Boolean,default:!1},icon:{type:Object,required:!0},hasColorFill:{type:Boolean,default:!1}},data(){return{component:null,modalVisible:!1}},computed:{colorFill(){return this.hasColorFill&&this.icon.color?this.icon.color:null},colorFillStyle(){return this.colorFill&&!this.error?{background:this.colorFill}:{}},computedIcon(){const e={...this.icon};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)(u,[["render",r],["__scopeId","data-v-e4043550"]]);var v=p},818:function(e,t,l){l.r(t),l.d(t,{default:function(){return x}});var n=l(6252),o=l(3577),a=l(9963);const i={class:"entity switch-container"},s={class:"col-1 icon"},r={class:"col-s-8 col-m-9 label"},c=["textContent"],u={class:"col-s-3 col-m-2 buttons pull-right"},d=["textContent"],p={class:"row"},v={class:"input"},h={key:0,value:"",selected:""},g=["value","textContent"];function y(e,t,l,y,f,m){const w=(0,n.up)("EntityIcon");return(0,n.wg)(),(0,n.iD)("div",i,[(0,n._)("div",{class:(0,o.C_)(["head",{expanded:f.expanded}])},[(0,n._)("div",s,[(0,n.Wm)(w,{icon:this.value.meta?.icon||{},loading:e.loading,error:e.error},null,8,["icon","loading","error"])]),(0,n._)("div",r,[(0,n._)("div",{class:"name",textContent:(0,o.zw)(e.value.name)},null,8,c)]),(0,n._)("div",u,[m.hasValues?((0,n.wg)(),(0,n.iD)("button",{key:0,onClick:t[0]||(t[0]=(0,a.iM)((e=>f.expanded=!f.expanded),["stop"]))},[(0,n._)("i",{class:(0,o.C_)(["fas",{"fa-angle-up":f.expanded,"fa-angle-down":!f.expanded}])},null,2)])):(0,n.kq)("",!0),null!=e.value?.value?((0,n.wg)(),(0,n.iD)("span",{key:1,class:"value",textContent:(0,o.zw)(e.value.value)},null,8,d)):(0,n.kq)("",!0)])],2),f.expanded?((0,n.wg)(),(0,n.iD)("div",{key:0,class:"body",onClick:t[2]||(t[2]=(0,a.iM)(((...e)=>m.prevent&&m.prevent(...e)),["stop"]))},[(0,n._)("div",p,[(0,n._)("div",v,[(0,n._)("select",{onInput:t[1]||(t[1]=(...e)=>m.setValue&&m.setValue(...e)),ref:"values"},[e.value.is_write_only?((0,n.wg)(),(0,n.iD)("option",h,"--")):(0,n.kq)("",!0),((0,n.wg)(!0),(0,n.iD)(n.HY,null,(0,n.Ko)(e.value.values,(e=>((0,n.wg)(),(0,n.iD)("option",{value:e,key:e,textContent:(0,o.zw)(e)},null,8,g)))),128))],544)])])])):(0,n.kq)("",!0)])}var f=l(7909),m=l(3673),w={name:"EnumSwitch",components:{EntityIcon:m["default"]},mixins:[f["default"]],data(){return{expanded:!1}},computed:{hasValues(){return!!this?.value?.values?.length}},methods:{prevent(e){return e.stopPropagation(),!1},async setValue(e){if(e.target.value?.length){if(this.$emit("loading",!0),this.value.is_write_only){const e=this;setTimeout((()=>{e.$refs.values.value=""}),1e3)}try{await this.request("entities.execute",{id:this.value.id,action:"set_value",data:e.target.value})}finally{this.$emit("loading",!1)}}}}},_=l(3744);const k=(0,_.Z)(w,[["render",y],["__scopeId","data-v-714faba4"]]);var x=k},3540:function(e,t,l){e.exports=l.p+"static/img/spinner.c0bee445.gif"}}]);
//# sourceMappingURL=818.3f4c9ffa.js.map