UNPKG

iobroker.lovelace

Version:

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

2 lines 3.33 kB
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["91773"],{27447:function(e,a,i){i.r(a),i.d(a,{PanelView:()=>b});var t=i(61701),d=i(72621),r=(i(71695),i(40251),i(47021),i(57243)),o=i(50778),s=i(35359),n=i(36522),l=i(20172);let c,h,u,v,f=e=>e;let k=!1,b=(0,t.Z)(null,(function(e,a){class t extends a{constructor(...a){super(...a),e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"lovelace",value:void 0},{kind:"field",decorators:[(0,o.Cb)({type:Number})],key:"index",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"isStrategy",value(){return!1}},{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"cards",value(){return[]}},{kind:"field",decorators:[(0,o.SB)()],key:"_card",value:void 0},{kind:"method",key:"setConfig",value:function(e){}},{kind:"method",key:"willUpdate",value:function(e){var a,r,o;if((0,d.Z)(t,"willUpdate",this,3)([e]),null!==(a=this.lovelace)&&void 0!==a&&a.editMode&&!k&&(k=!0,Promise.all([i.e("41103"),i.e("39341")]).then(i.bind(i,14370))),e.has("cards")&&this._createCard(),!e.has("lovelace"))return;const s=e.get("lovelace");(!e.has("cards")&&(null==s?void 0:s.config)!==(null===(r=this.lovelace)||void 0===r?void 0:r.config)||s&&(null==s?void 0:s.editMode)!==(null===(o=this.lovelace)||void 0===o?void 0:o.editMode))&&this._createCard()}},{kind:"method",key:"render",value:function(){var e;return(0,r.dy)(c||(c=f` ${0} ${0} ${0} `),this.cards.length>1?(0,r.dy)(h||(h=f`<hui-warning> ${0} </hui-warning>`),this.hass.localize("ui.panel.lovelace.editor.view.panel_mode.warning_multiple_cards")):"",this._card,null!==(e=this.lovelace)&&void 0!==e&&e.editMode&&0===this.cards.length?(0,r.dy)(u||(u=f` <ha-fab .label="${0}" extended @click="${0}" class="${0}"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> </ha-fab> `),this.hass.localize("ui.panel.lovelace.editor.edit_card.add"),this._addCard,(0,s.$)({rtl:(0,l.HE)(this.hass)}),"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"):"")}},{kind:"method",key:"_addCard",value:function(){(0,n.B)(this,"ll-create-card")}},{kind:"method",key:"_createCard",value:function(){var e;if(0===this.cards.length)return void(this._card=void 0);const a=this.cards[0];if(a.layout="panel",this.isStrategy||null===(e=this.lovelace)||void 0===e||!e.editMode)return a.preview=!1,void(this._card=a);const i=document.createElement("hui-card-options");i.hass=this.hass,i.lovelace=this.lovelace,i.path=[this.index,0],i.hidePosition=!0,a.preview=!0,i.appendChild(a),this._card=i}},{kind:"field",static:!0,key:"styles",value(){return(0,r.iv)(v||(v=f`:host{display:block;height:100%;--restore-card-border-radius:var(--ha-card-border-radius, 12px);--restore-card-border-width:var(--ha-card-border-width, 1px);--restore-card-box-shadow:var(--ha-card-box-shadow, none)}*{--ha-card-border-radius:0;--ha-card-border-width:0;--ha-card-box-shadow:none}ha-fab{position:fixed;right:calc(16px + env(safe-area-inset-right));bottom:calc(16px + env(safe-area-inset-bottom));z-index:1;float:var(--float-end);inset-inline-end:calc(16px + env(safe-area-inset-right));inset-inline-start:initial}`))}}]}}),r.oi);customElements.define("hui-panel-view",b)}}]); //# sourceMappingURL=91773.a0187bc60294662c.js.map