iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 2.62 kB
JavaScript
export const __rspack_esm_id=8550;export const __rspack_esm_ids=[8550];export const __webpack_modules__={71154(t,i,s){s.a(t,async function(t,a){try{s.r(i),s.d(i,{HuiUpdatesCard:()=>g});s(18111),s(22489);var e=s(62826),o=s(5124),n=s(22441),c=s(1087),h=s(91926),r=(s(76776),s(22573),s(80933),s(32248),s(24247)),l=s(22064),d=s(97176),_=s(51989),p=t([r]);r=(p.then?(await p)():p)[0];const u="M20.54,5.23C20.83,5.57 21,6 21,6.5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V6.5C3,6 3.17,5.57 3.46,5.23L4.84,3.55C5.12,3.21 5.53,3 6,3H18C18.47,3 18.88,3.21 19.15,3.55L20.54,5.23M5.12,5H18.87L17.93,4H5.93L5.12,5M12,9.5L6.5,15H10V17H14V15H17.5L12,9.5Z";class g extends o.WF{setConfig(t){this._config=t}getCardSize(){return this._config?.vertical?2:1}getGridOptions(){let t=6,i=1;return this._config?.vertical&&(i++,t=3),{columns:6,rows:i,min_columns:t,min_rows:i}}_getUpdateEntities(){return this.hass?(0,r.ZS)(this.hass.states,this.hass.locale.language).filter(t=>(0,r.VK)(t,!1)):[]}async _handleAction(t){"tap"!==t.detail.action||(0,d.h)(this._config?.tap_action)?(0,l.$)(this,this.hass,this._config,t.detail.action):(0,h.oo)("/config/updates")}get _hasCardAction(){return!this._config?.tap_action||(0,d.h)(this._config?.tap_action)||(0,d.h)(this._config?.hold_action)||(0,d.h)(this._config?.double_tap_action)}willUpdate(t){if(super.willUpdate(t),!this._config||!this.hass)return;const i=this._getUpdateEntities(),s=Boolean(!this.hass.user?.is_admin||this._config.hide_empty&&0===i.length);s!==this.hidden&&(this.style.display=s?"none":"",this.toggleAttribute("hidden",s),(0,c.r)(this,"card-visibility-changed",{value:!s}))}render(){if(!this._config||!this.hass)return o.s6;const t=this._getUpdateEntities().length,i=this.hass.localize("ui.card.updates.title"),s=t>0?this.hass.localize("ui.card.updates.count_updates",{count:t}):this.hass.localize("ui.card.updates.no_updates");return o.qy` <ha-card> <ha-tile-container .vertical="${Boolean(this._config.vertical)}" .interactive="${this._hasCardAction}" .actionHandlerOptions="${{hasHold:(0,d.h)(this._config.hold_action),hasDoubleClick:(0,d.h)(this._config.double_tap_action)}}" ="${this._handleAction}"> <ha-tile-icon slot="icon" .iconPath="${u}"></ha-tile-icon> <ha-tile-info slot="info" .primary="${i}" .secondary="${s}"></ha-tile-info> </ha-tile-container> </ha-card> `}constructor(...t){super(...t),this.connectedWhileHidden=!0}}g.styles=[_.c,o.AH`:host{--tile-color:var(--info-color)}`],(0,e.Cg)([(0,n.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,e.Cg)([(0,n.wk)()],g.prototype,"_config",void 0),g=(0,e.Cg)([(0,n.EM)("hui-updates-card")],g),a()}catch(t){a(t)}})}};