platypush/platypush/backend/http/webapp/dist/static/js/7524-legacy.68534ef0.js

2 lines
4.6 KiB
JavaScript

"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[7524,3673],{3673:function(e,n,t){t.r(n),t.d(n,{default:function(){return f}});var l=t(6252),a=t(3577),i=t(3540),o={key:0,src:i,class:"loading"},r={key:1,class:"fas fa-circle-exclamation error"};function u(e,n,t,i,u,s){var c=(0,l.up)("Icon");return(0,l.wg)(),(0,l.iD)("div",{class:(0,a.C_)(["entity-icon-container",{"with-color-fill":!!s.colorFill}]),style:(0,a.j5)(s.colorFillStyle)},[t.loading?((0,l.wg)(),(0,l.iD)("img",o)):t.error?((0,l.wg)(),(0,l.iD)("i",r)):((0,l.wg)(),(0,l.j4)(c,(0,a.vs)((0,l.dG)({key:2},s.computedIcon)),null,16))],6)}var s=t(4648),c=(t(7042),t(1478)),d={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: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,s.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)}}},v=t(3744);const p=(0,v.Z)(d,[["render",u],["__scopeId","data-v-e4043550"]]);var f=p},7524:function(e,n,t){t.r(n),t.d(n,{default:function(){return b}});t(8309),t(1539),t(3948);var l=t(6252),a=t(3577),i=t(9963),o={class:"entity switch-container"},r={class:"col-1 icon"},u={class:"col-s-8 col-m-9 label"},s=["textContent"],c={class:"col-s-3 col-m-2 buttons pull-right"},d=["textContent"],v={class:"row"},p={class:"input"},f=["disabled"],h={key:0,value:"",selected:""},g=["value","selected","textContent"];function y(e,n,t,y,m,w){var k,x,_=(0,l.up)("EntityIcon");return(0,l.wg)(),(0,l.iD)("div",o,[(0,l._)("div",{class:(0,a.C_)(["head",{expanded:m.expanded}])},[(0,l._)("div",r,[(0,l.Wm)(_,{icon:(null===(k=this.value.meta)||void 0===k?void 0:k.icon)||{},loading:e.loading,error:e.error},null,8,["icon","loading","error"])]),(0,l._)("div",u,[(0,l._)("div",{class:"name",textContent:(0,a.zw)(e.value.name)},null,8,s)]),(0,l._)("div",c,[w.hasValues?((0,l.wg)(),(0,l.iD)("button",{key:0,onClick:n[0]||(n[0]=(0,i.iM)((function(e){return m.expanded=!m.expanded}),["stop"]))},[(0,l._)("i",{class:(0,a.C_)(["fas",{"fa-angle-up":m.expanded,"fa-angle-down":!m.expanded}])},null,2)])):(0,l.kq)("",!0),null!=(null===(x=e.value)||void 0===x?void 0:x.value)?((0,l.wg)(),(0,l.iD)("span",{key:1,class:"value",textContent:(0,a.zw)(e.value.values[e.value.value]||e.value.value)},null,8,d)):(0,l.kq)("",!0)])],2),m.expanded?((0,l.wg)(),(0,l.iD)("div",{key:0,class:"body",onClick:n[2]||(n[2]=(0,i.iM)((function(){return w.prevent&&w.prevent.apply(w,arguments)}),["stop"]))},[(0,l._)("div",v,[(0,l._)("div",p,[(0,l._)("select",{onInput:n[1]||(n[1]=function(){return w.setValue&&w.setValue.apply(w,arguments)}),ref:"values",disabled:e.loading},[e.value.is_write_only?((0,l.wg)(),(0,l.iD)("option",h,"--")):(0,l.kq)("",!0),((0,l.wg)(!0),(0,l.iD)(l.HY,null,(0,l.Ko)(w.displayValues,(function(n,t){return(0,l.wg)(),(0,l.iD)("option",{value:t,selected:t==e.value.value,key:t,textContent:(0,a.zw)(n)},null,8,g)})),128))],40,f)])])])):(0,l.kq)("",!0)])}var m=t(8534),w=(t(5666),t(2479),t(7909)),k=t(3673),x={name:"EnumSwitch",components:{EntityIcon:k["default"]},mixins:[w["default"]],data:function(){return{expanded:!1}},computed:{hasValues:function(){var e;return!!Object.values((null===this||void 0===this||null===(e=this.value)||void 0===e?void 0:e.values)||{}).length},displayValues:function(){var e,n;return(null===(e=this.value)||void 0===e?void 0:e.values)instanceof Array?this.value.values.reduce((function(e,n){return e[n]=n,e}),{}):(null===(n=this.value)||void 0===n?void 0:n.values)||{}}},methods:{prevent:function(e){return e.stopPropagation(),!1},setValue:function(e){var n=this;return(0,m.Z)(regeneratorRuntime.mark((function t(){var l,a;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&&(a=n,setTimeout((function(){a.$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]])})))()}}},_=t(3744);const C=(0,_.Z)(x,[["render",y],["__scopeId","data-v-9441eff8"]]);var b=C},3540:function(e,n,t){e.exports=t.p+"static/img/spinner.c0bee445.gif"}}]);
//# sourceMappingURL=7524-legacy.68534ef0.js.map