UNPKG

iobroker.lovelace

Version:

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

1 lines 2.99 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[77388],{51527:function(t,i,e){e.a(t,async function(t,n){try{e.r(i);e(16280),e(3362),e(62953);var s=e(40445),o=e(67576),r=e(1087),a=e(33121),h=e(37693),c=t([h]);h=(c.then?(await c)():c)[0];class d extends h.E{static async getConfigElement(){return await Promise.all([e.e(66432),e.e(91863),e.e(88815),e.e(91793)]).then(e.bind(e,82632)),document.createElement("hui-conditional-card-editor")}static getStubConfig(){return{type:"conditional",conditions:[],card:{}}}setConfig(t){if(this.validateConfig(t),!t.card)throw new Error("No card configured");this._element=this._createCardElement(t.card)}getCardSize(){return(0,a.Z)(this._element)}_createCardElement(t){const i=document.createElement("hui-card");return i.hass=this.hass,i.preview=this.preview,i.config=t,i.load(),i}setVisibility(t){const i=this.preview||t,e=this.hidden;super.setVisibility(t),e!==this.hidden&&(0,r.r)(this,"card-visibility-changed",{value:i})}}d=(0,s.Cg)([(0,o.EM)("hui-conditional-card")],d),n()}catch(d){n(d)}})},37693:function(t,i,e){e.a(t,async function(t,n){try{e.d(i,{E:function(){return d}});e(49255),e(16280),e(18111),e(22489),e(62953);var s=e(40445),o=e(5124),r=e(67576),a=e(91263),h=e(14487),c=t([a,h]);[a,h]=c.then?(await c)():c;class d extends((0,a.M)(o.mN)){createRenderRoot(){return this}validateConfig(t){if(!t.conditions)throw new Error("No conditions configured");if(!Array.isArray(t.conditions))throw new Error("Conditions need to be an array");if(!(0,h.db)(t.conditions))throw new Error("Conditions are invalid");this.lastChild&&this.removeChild(this.lastChild),this._config=t}disconnectedCallback(){super.disconnectedCallback()}connectedCallback(){super.connectedCallback(),this._updateVisibility()}setupConditionalListeners(){if(!this._config||!this.hass)return;const t=this._config.conditions.filter(t=>"condition"in t);super.setupConditionalListeners(t)}update(t){super.update(t),(t.has("_element")||t.has("_config")||t.has("hass")||t.has("preview"))&&(this.clearConditionalListeners(),this.setupConditionalListeners(),this._updateVisibility())}_updateVisibility(t){if(!this._element||!this.hass||!this._config)return;this._element.preview=this.preview;const i=null!=t?t:(0,h.XH)(this._config.conditions,this.hass,this._conditionContext);this.setVisibility(i)}setVisibility(t){if(!this._element||!this.hass)return;const i=this.preview||t;this.hidden!==!i&&(this.toggleAttribute("hidden",!i),this.style.setProperty("display",i?"":"none")),i?(this._element.hass=this.hass,this._element.parentElement||this.appendChild(this._element)):this._element.parentElement&&this.removeChild(this._element)}constructor(...t){super(...t),this.preview=!1}}(0,s.Cg)([(0,r.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean})],d.prototype,"preview",void 0),(0,s.Cg)([(0,r.wk)()],d.prototype,"_config",void 0),d=(0,s.Cg)([(0,r.EM)("hui-conditional-base")],d),n()}catch(d){n(d)}})}}]);