iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 2.35 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[84813],{72828:function(t,e,s){s.a(t,async function(t,i){try{s.r(e),s.d(e,{FlowPreviewGeneric:function(){return v}});s(3362),s(62953);var r=s(40445),o=s(5124),n=s(67576),a=s(51840),h=s(7986),p=s(9899),u=s(1087),_=s(38962),d=t([h,_]);[h,_]=d.then?(await d)():d;let w,l,c=t=>t;class v extends o.WF{disconnectedCallback(){super.disconnectedCallback(),this._unsub&&(this._unsub.then(t=>t()),this._unsub=void 0)}willUpdate(t){t.has("stepData")&&this._debouncedSubscribePreview()}render(){return this._error?(0,o.qy)(w||(w=c`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):(0,o.qy)(l||(l=c`<entity-preview-row .hass="${0}" .stateObj="${0}"></entity-preview-row>`),this.hass,this._preview)}async _subscribePreview(){if(this._unsub&&((await this._unsub)(),this._unsub=void 0),"config_flow"===this.flowType||"options_flow"===this.flowType||"config_subentries_flow"===this.flowType||"repair_flow"===this.flowType){this._error=void 0;try{this._unsub=(0,a.Q)(this.hass,this.domain,this.flowId,this.flowType,this.stepData,this._setPreview),await this._unsub,(0,u.r)(this,"set-flow-errors",{errors:{}})}catch(t){"string"==typeof t.message?this._error=t.message:(this._error=void 0,(0,u.r)(this,"set-flow-errors",t.message)),this._unsub=void 0,this._preview=void 0}}}constructor(...t){super(...t),this._setPreview=t=>{var e;if(t.error)return this._error=t.error,void(this._preview=void 0);const s=(new Date).toISOString();this._preview=Object.assign({entity_id:`${null!==(e=t.domain)&&void 0!==e?e:this.stepId}.___flow_preview___`,last_changed:s,last_updated:s,context:{id:"",parent_id:null,user_id:null}},t)},this._debouncedSubscribePreview=(0,p.s)(()=>{this._subscribePreview()},250)}}(0,r.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,r.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"flowType",void 0),(0,r.Cg)([(0,n.MZ)()],v.prototype,"domain",void 0),(0,r.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"stepId",void 0),(0,r.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"flowId",void 0),(0,r.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"stepData",void 0),(0,r.Cg)([(0,n.wk)()],v.prototype,"_preview",void 0),(0,r.Cg)([(0,n.wk)()],v.prototype,"_error",void 0),v=(0,r.Cg)([(0,n.EM)("flow-preview-generic")],v),i()}catch(w){i(w)}})}}]);