UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

1 lines 2.2 kB
export const __rspack_esm_id=84813;export const __rspack_esm_ids=[84813];export const __webpack_modules__={72828(e,t,i){i.a(e,async function(e,s){try{i.r(t),i.d(t,{FlowPreviewGeneric:()=>u});var r=i(62826),o=i(5124),_=i(22441),a=i(51840),p=i(7986),n=i(9899),h=i(1087),d=i(38962),w=e([p,d]);[p,d]=w.then?(await w)():w;class u extends o.WF{disconnectedCallback(){super.disconnectedCallback(),this._unsub&&(this._unsub.then(e=>e()),this._unsub=void 0)}willUpdate(e){e.has("stepData")&&this._debouncedSubscribePreview()}render(){return this._error?o.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:o.qy`<entity-preview-row .hass="${this.hass}" .stateObj="${this._preview}"></entity-preview-row>`}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,h.r)(this,"set-flow-errors",{errors:{}})}catch(e){"string"==typeof e.message?this._error=e.message:(this._error=void 0,(0,h.r)(this,"set-flow-errors",e.message)),this._unsub=void 0,this._preview=void 0}}}constructor(...e){super(...e),this._setPreview=e=>{if(e.error)return this._error=e.error,void(this._preview=void 0);const t=(new Date).toISOString();this._preview={entity_id:`${e.domain??this.stepId}.___flow_preview___`,last_changed:t,last_updated:t,context:{id:"",parent_id:null,user_id:null},...e}},this._debouncedSubscribePreview=(0,n.s)(()=>{this._subscribePreview()},250)}}(0,r.Cg)([(0,_.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,r.Cg)([(0,_.MZ)({attribute:!1})],u.prototype,"flowType",void 0),(0,r.Cg)([(0,_.MZ)()],u.prototype,"domain",void 0),(0,r.Cg)([(0,_.MZ)({attribute:!1})],u.prototype,"stepId",void 0),(0,r.Cg)([(0,_.MZ)({attribute:!1})],u.prototype,"flowId",void 0),(0,r.Cg)([(0,_.MZ)({attribute:!1})],u.prototype,"stepData",void 0),(0,r.Cg)([(0,_.wk)()],u.prototype,"_preview",void 0),(0,r.Cg)([(0,_.wk)()],u.prototype,"_error",void 0),u=(0,r.Cg)([(0,_.EM)("flow-preview-generic")],u),s()}catch(e){s(e)}})}};