UNPKG

iobroker.lovelace

Version:

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

1 lines 9.27 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[59127],{71550:function(e,a,t){t.a(e,async function(e,a){try{t(3362),t(62953);var i=t(40445),o=(t(68825),t(5124)),s=t(67576),l=t(93905),c=t(1087),r=t(18350),n=(t(76776),t(29823)),d=(t(70947),t(26300)),h=t(35952),p=t(91984),v=t(65063),u=t(14503),g=t(33121),C=t(82360),_=t(75196),b=t(85633),m=e([r,n,d]);[r,n,d]=m.then?(await m)():m;let f,w,y,A=e=>e;const H="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z",V="M19,3L13,9L15,11L22,4V3M12,12.5A0.5,0.5 0 0,1 11.5,12A0.5,0.5 0 0,1 12,11.5A0.5,0.5 0 0,1 12.5,12A0.5,0.5 0 0,1 12,12.5M6,20A2,2 0 0,1 4,18C4,16.89 4.9,16 6,16A2,2 0 0,1 8,18C8,19.11 7.1,20 6,20M6,8A2,2 0 0,1 4,6C4,4.89 4.9,4 6,4A2,2 0 0,1 8,6C8,7.11 7.1,8 6,8M9.64,7.64C9.87,7.14 10,6.59 10,6A4,4 0 0,0 6,2A4,4 0 0,0 2,6A4,4 0 0,0 6,10C6.59,10 7.14,9.87 7.64,9.64L10,12L7.64,14.36C7.14,14.13 6.59,14 6,14A4,4 0 0,0 2,18A4,4 0 0,0 6,22A4,4 0 0,0 10,18C10,17.41 9.87,16.86 9.64,16.36L12,14L19,21H22V20L9.64,7.64Z",M="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",$="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",x="M14 2H6C4.9 2 4 2.9 4 4V20C4 20.41 4.12 20.8 4.34 21.12C4.41 21.23 4.5 21.33 4.59 21.41C4.95 21.78 5.45 22 6 22H13.53C13 21.42 12.61 20.75 12.35 20H6V4H13V9H18V12C18.7 12 19.37 12.12 20 12.34V8L14 2M18 23L23 18.5L20 15.8L18 14V17H14V20H18V23Z",z="M19,13H5V11H19V13Z",k="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",L="M16,8H14V11H11V13H14V16H16V13H19V11H16M2,12C2,9.21 3.64,6.8 6,5.68V3.5C2.5,4.76 0,8.09 0,12C0,15.91 2.5,19.24 6,20.5V18.32C3.64,17.2 2,14.79 2,12M15,3C10.04,3 6,7.04 6,12C6,16.96 10.04,21 15,21C19.96,21 24,16.96 24,12C24,7.04 19.96,3 15,3M15,19C11.14,19 8,15.86 8,12C8,8.14 11.14,5 15,5C18.86,5 22,8.14 22,12C22,15.86 18.86,19 15,19Z";class P extends o.WF{getCardSize(){return this._assignedElements?(0,g.Z)(this._assignedElements[0]):1}updated(e){if(!e.has("path")||!this.path)return;const{viewIndex:a}=(0,_.gO)(this.path);this.classList.toggle("panel",this.lovelace.config.views[a].panel)}get _cards(){const e=(0,_.S2)(this.path);return(0,_.jW)("cards",this.lovelace.config,e)}render(){const{cardIndex:e}=(0,_.gO)(this.path);return(0,o.qy)(f||(f=A` <div class="card"><slot></slot></div> <ha-card> <div class="card-actions"> <ha-button appearance="plain" @click="${0}">${0}</ha-button> <div class="right"> <slot name="buttons"></slot> ${0} <ha-dropdown @wa-select="${0}" placement="bottom-end"> <ha-icon-button slot="trigger" .label="${0}" .path="${0}"></ha-icon-button> <ha-dropdown-item value="move"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> <ha-dropdown-item value="duplicate"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> <ha-dropdown-item value="copy"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> <ha-dropdown-item value="cut"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> <wa-divider></wa-divider> <ha-dropdown-item value="delete" variant="danger"> <ha-svg-icon class="warning" slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> </ha-dropdown> </div> </div> </ha-card> `),this._editCard,this.hass.localize("ui.panel.lovelace.editor.edit_card.edit"),this.hidePosition?o.s6:(0,o.qy)(w||(w=A` <ha-icon-button .label="${0}" .path="${0}" class="move-arrow" @click="${0}" ?disabled="${0}"></ha-icon-button> <ha-icon-button @click="${0}" .label="${0}"> <div class="position-badge">${0}</div> </ha-icon-button> <ha-icon-button .label="${0}" .path="${0}" class="move-arrow" @click="${0}" .disabled="${0}"></ha-icon-button> `),this.hass.localize("ui.panel.lovelace.editor.edit_card.decrease_position"),z,this._decreaseCardPosiion,0===e,this._changeCardPosition,this.hass.localize("ui.panel.lovelace.editor.edit_card.change_position"),e+1,this.hass.localize("ui.panel.lovelace.editor.edit_card.increase_position"),k,this._increaseCardPosition,this._cards.length===e+1),this._handleDropdownSelect,this.hass.localize("ui.panel.lovelace.editor.edit_card.options"),$,x,this.hass.localize("ui.panel.lovelace.editor.edit_card.move"),L,this.hass.localize("ui.panel.lovelace.editor.edit_card.duplicate"),H,this.hass.localize("ui.panel.lovelace.editor.edit_card.copy"),V,this.hass.localize("ui.panel.lovelace.editor.edit_card.cut"),M,this.hass.localize("ui.panel.lovelace.editor.edit_card.delete"))}static get styles(){return[u.RF,(0,o.AH)(y||(y=A`:host(:hover){outline:2px solid var(--primary-color)}:host(:not(.panel)) ::slotted(*){display:block}:host(.panel) .card{height:calc(100% - 59px)}ha-card{border-top-right-radius:0;border-top-left-radius:0}.card-actions{display:flex;justify-content:space-between;align-items:center}.right{display:flex;align-items:center}.position-badge{display:block;width:24px;line-height:var(--ha-line-height-normal);box-sizing:border-box;border-radius:var(--ha-border-radius-circle);font-weight:var(--ha-font-weight-medium);text-align:center;font-size:var(--ha-font-size-m);background-color:var(--app-header-edit-background-color,#455a64);color:var(--app-header-edit-text-color,#fff)}ha-icon-button{color:var(--primary-text-color)}ha-icon-button.move-arrow[disabled]{color:var(--disabled-text-color)}`))]}_handleDropdownSelect(e){var a;const t=null===(a=e.detail)||void 0===a||null===(a=a.item)||void 0===a?void 0:a.value;if(t)switch(t){case"move":this._moveCard();break;case"duplicate":this._duplicateCard();break;case"copy":this._copyCard();break;case"cut":this._cutCard();break;case"delete":this._deleteCard()}}_duplicateCard(){(0,c.r)(this,"ll-duplicate-card",{path:this.path})}_editCard(){(0,c.r)(this,"ll-edit-card",{path:this.path})}_cutCard(){(0,c.r)(this,"ll-copy-card",{path:this.path}),(0,c.r)(this,"ll-delete-card",{path:this.path,silent:!0})}_copyCard(){(0,c.r)(this,"ll-copy-card",{path:this.path})}_deleteCard(){(0,c.r)(this,"ll-delete-card",{path:this.path,silent:!1})}_decreaseCardPosiion(){const e=this.lovelace,a=this.path,{cardIndex:t}=(0,_.gO)(a);e.saveConfig((0,C.d6)(e.config,a,t-1))}_increaseCardPosition(){const e=this.lovelace,a=this.path,{cardIndex:t}=(0,_.gO)(a);e.saveConfig((0,C.d6)(e.config,a,t+1))}async _changeCardPosition(){const e=this.lovelace,a=this.path,{cardIndex:t}=(0,_.gO)(a),i=await(0,v.an)(this,{title:this.hass.localize("ui.panel.lovelace.editor.change_position.title"),text:this.hass.localize("ui.panel.lovelace.editor.change_position.text"),inputType:"number",inputMin:"1",placeholder:String(t+1)});if(!i)return;const o=parseInt(i);if(isNaN(o))return;const s=o-1;e.saveConfig((0,C.d6)(e.config,a,s))}_moveCard(){(0,b.X)(this,{lovelaceConfig:this.lovelace.config,urlPath:this.lovelace.urlPath,allowDashboardChange:!0,header:this.hass.localize("ui.panel.lovelace.editor.move_card.header"),viewSelectedCallback:async(e,a,t)=>{if(!this.lovelace)return;const i=a.views[t],o=a,s=async()=>{this.lovelace.saveConfig(a)};if((0,p.R6)(i))return void(0,v.showAlertDialog)(this,{title:this.hass.localize("ui.panel.lovelace.editor.move_card.error_title"),text:this.hass.localize("ui.panel.lovelace.editor.move_card.error_text_strategy"),warning:!0});const l=[t];if(e===this.lovelace.urlPath)return this.lovelace.saveConfig((0,C.Ei)(o,this.path,l)),void this.lovelace.showToast({message:this.hass.localize("ui.panel.lovelace.editor.move_card.success"),duration:4e3,action:{action:s,text:this.hass.localize("ui.common.undo")}});try{const{cardIndex:a}=(0,_.gO)(this.path),t=this._cards[a];await(0,h.ql)(this.hass,e,(0,C.gm)(o,l,t)),this.lovelace.saveConfig((0,C.GO)(this.lovelace.config,this.path)),this.lovelace.showToast({message:this.hass.localize("ui.panel.lovelace.editor.move_card.success"),duration:4e3,action:{action:s,text:this.hass.localize("ui.common.undo")}})}catch(c){this.lovelace.showToast({message:this.hass.localize("ui.panel.lovelace.editor.move_card.error")})}}})}constructor(...e){super(...e),this.hidePosition=!1}}(0,i.Cg)([(0,s.MZ)({attribute:!1})],P.prototype,"hass",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],P.prototype,"lovelace",void 0),(0,i.Cg)([(0,s.MZ)({type:Array})],P.prototype,"path",void 0),(0,i.Cg)([(0,s.KN)()],P.prototype,"_assignedElements",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"hide-position",type:Boolean})],P.prototype,"hidePosition",void 0),(0,i.Cg)([(0,l.I)({key:"dashboardCardClipboard",state:!1,subscribe:!1,storage:"sessionStorage"})],P.prototype,"_clipboard",void 0),P=(0,i.Cg)([(0,s.EM)("hui-card-options")],P),a()}catch(f){a(f)}})},72821:function(e,a,t){t.d(a,{d:function(){return i}});t(3362),t(62953);const i=()=>t.e(70133).then(t.bind(t,79316))},85633:function(e,a,t){t.d(a,{X:function(){return o}});t(3362),t(62953);var i=t(1087);const o=(e,a)=>{(0,i.r)(e,"show-dialog",{dialogTag:"hui-dialog-select-view",dialogImport:()=>Promise.all([t.e(44335),t.e(40901)]).then(t.bind(t,54564)),dialogParams:a})}},70410:function(e,a,t){t.a(e,async function(e,i){try{t.r(a);var o=t(71550),s=t(21146),l=t(72821),c=t(15950),r=e([o]);o=(r.then?(await r)():r)[0],(0,s.a)(),(0,l.d)(),(0,c.S)(),i()}catch(n){i(n)}})}}]);