platypush/platypush/backend/http/webapp/dist/static/js/818-legacy.b4ae6fe1.js

2 lines
4.3 KiB
JavaScript

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